4 December 2014

I got my first SSD, Samsung 850 PRO to be more precise. First thing that got on my mind was that I would not like to do a format. So I decided to go with migrating my root partition. Other partitions, var and home I decided to leave to the HDD. There were a lot of tutorials, all different. I needed something that made sense to me. I decided to create a partition manually to my ssd and then boot Arch live cd and do the rest of the magic. I want to write this down incase I have to do it again. It might work with other Linux distributions as well, but it would require modifications.

From your current installation

Assuming you are currently logged in to your operating system and have already attached your SSD follow next steps as the first part of this guid.
  • Open your favourite partition editor, I suggest GParted.
  • In my experience, the program asked me if I want to create partition table, when I tried to do a partition. In my research I found that "gpt" is ok selection.
  • I created a partition for my root directory as usual I used ext4 for it, as ext4 supports SSD.
SSD GParted

Copy from one partition to another

  • Boot from Arch Linux live cd or usb flash drive.
  • Mount the new SSD partition and mount HDD root partition.
Source code viewer
  1. cd /mnt
  2. mkdir ssd_mount
  3. mount /dev/sda1 /mnt/ssd_mount
  4. mkdir hdd_mount
  5. mount /dev/sdb1 /mnt/hdd_mount
  6. cp -a /mnt/hdd_mount/* /mnt/ssd_mount/
  7. reboot
Programming Language: Bash

Fixes for booting

Source code viewer
  1. # Mount your new system.
  2. mount /dev/sda1 /mnt
  3. mkdir /mnt/var
  4. mount /dev/sdb2 /mnt/var
  5. mkdir /mnt/home
  6. mount /dev/sdb3 /mnt/home
  7.  
  8. # Generate an fstab.
  9. genfstab -U -p /mnt > /mnt/etc/fstab
  10. # OR (advanced)
  11. genfstab -U -p /mnt >> /mnt/etc/fstab
  12. # Open /mnt/etc/fstab with your favourite text editor and merge the results. You can also change the SSD partition attributes for better performance and life-time. First you have to check what your SSD supports and if your partition supports things like TRIM for an example. I have "defaults,noatime,discard".
  13.  
  14. # Chroot into your newly installed system.
  15. arch-chroot /mnt /bin/bash
  16.  
  17. # Create an initial ramdisk environment (I don't know it this is actually necessary).
  18. mkinitcpio -p linux
  19.  
  20. # Install the bootloader.
  21. syslinux-install_update -iam
  22.  
  23. # Change the syslinux.cfg to point to your new root partition.
  24. # vim /boot/syslinux/syslinux.cfg
  25.  
  26. # Now we create the boot partition for grub. Select the free space (1007 KB) in top.
  27. cgdisk /dev/sda
  28. # Use "ef02" as the file system type code GUID.
  29. # "Write".
  30. # "Quit".
  31.  
  32. # Regenerate GRUB configuration.
  33. grub-install --target=i386-pc --recheck /dev/sda
  34. grub-mkconfig -o /boot/grub/grub.cfg
Programming Language: Bash

Move root partition from HDD to SSD finished

Source code viewer
  1. exit
  2. reboot
Programming Language: Bash
You should be up and running, remove old stuff from /etc/fstab and write ssd performance flags for an example.