When building my NAS I’ve picked a spare laptop hdd (spinny type) for the OS to boot from, but I’ve reached to a point where I wanted my NAS os to boot from a SDD.

Copy data

Since a stock Fedora 20 doesn’t use so much disk space, I wanted to switch from a 250Gb SATA hdd to a smaller but faster 80Gb SSD (an old Intel X25-M which I have for few years now).

Since the existing disk was partitioned automatically, I’ve decided to create similar partitions on the new disk. Existing partitions were:

One thing not to forget is to set the new boot partition to be bootable. Also, not mentioned is the swap partition, it should be created too (and later have the new UUID updated in /etc/fstab).
After creating the new partitions (I’m copying /dev/sde to /dev/sda) was to mount the new partitions, so that I can proceed to copy the data:

Copying the data was done with dump and restore similar to:

So here goes:

A detailed output of copying the root partition:

Prepare new disk for boot

Two remaining things: update grup as well as update UUIDs in /etc/fstab. To update grub, we need to chroot into the new root partition, but before that, we need to mount the new boot partition onto the boot folder into the new root. Sounds complicated but it is not:

Now, the /media/ssh/root points to the new root partition, and /media/ssh/root/boot points to the new boot partition. This is done so that grup utilities will actually write the files correctly onto the new hard disk.

Install grub: (first command is to create the proper configuration file, second command is to set the bootloader:)

Now we can exit the chroot environment (with exit) and the only remaining thing is to replace the UUIDs in /media/ssd/root/etc/fstab with the new UUIDs: For this I’ve relied on a perl oneliner.

Since I am copying from sde to sda the ‘bbbb…’ UUID has to be found and replaced with the ‘aaaa…’ one.

The perl one liner has to be called for all 4 partitions (root, swap, home and boot).