Saturday, March 8, 2014

How to move Ubuntu to an SSD

How to move Ubuntu to an SSD:

You want to copy the FILES, not the whole partition (including its free space), so you don't need to resize the partition first. Boot from the livecd and mount both the HD and SSD (after formatting a partition on the SSD of course), then copy all of the files over:
sudo cp -ax /media/hd /media/ssd
Use the correct names for the hd and ssd mount points of course. Then you just need to edit the /etc/fstab on the ssd to point to the new fs UUID (you can look it up with blkid). Finally you need to install grub on the ssd:
sudo -s for f in sys dev proc ; do mount --bind /$f /media/ssd/$f ; done chroot /media/ssd grub-install /dev/ssd update-grub
Of course, use the correct device for /dev/ssd. The whole disk, not a partition number. Finally reboot and make sure your bios is set to boot from the SSD.

My fstab has only two entries:

LABEL=LINUX-ROOT    /        ext4    errors=remount-ro,noatime 0       1
LABEL=LINUX-SWAP    none     swap    sw                        0       2

I need to create two partitions on the SSD, format then (16 GB for swap, 100 GB for root) and set the labels accordingly. After that just follow the procedure.

To activate trim read this and decide what to do: option discard in fstab (automatic trim) or fstrim / (periodic trim via a cron job).

No comments:

Post a Comment