I need to move my running Linux Debian machine to my new m.2 nvme Samsung drive to gain 10x IO speed improvement. It’s crazy fast!
-
- The procedure is very similar as below
- http://lucasmanual.com/blog/move-root-partition-to-home-partition/
- Prerequisites:
-
- You already installed NVME and partitioned it
- You have gpt2 with grub partition similar to :
/dev/nvme0n1p1 [ 2.00 MiB]
/dev/nvme0n1p2 [ 550.00 MiB]
/dev/nvme0n1p3 [ 465.22 GiB] - You have mount your /dev/nvme0n1p3 partition to /nvme to confirm your current system sees everything and can write to it.
-
- Lets continue:
- We mount everything using Debian live as in the link
- We rsync src and dest (exclude home)
rsync -aAXv --exclude=/lost+found --exclude=/root/trash/* --exclude=/var/tmp/* --exclude=/home/* /mnt/src/* /mnt/dest/
-
- We continue with instructions on the other page and when its all done lets make sure we upate /etc/fstab
- We update fstab old partition to new:
# change current "/" to "/home"
#change "/nvme" to "/"
-
- At this point I would recommend you restart, but note you will only be able to login via a command line. aka CTRL+ALT+F2, because when we reboot the /home is at /home/home and gnome-shell will not like that. We will need to move it, and move everything else to a temporary root_home folder we will create. The reason I’m recommending reboot is to make sure you have done everything properly. If it boots you are good to now move the old unused files, if it doesn’t boot, you can still go back to the old system by reverting /etc/fstab and try instructions again.
- If you confirmed its all good, and only then let’s do below:
cd /home
mkdir root_home
mv /home/* /home/root_home
mv /home/root_home/home/* /home/
- Lets reboot again and confirm we can log in with gnome-shell.
- If yes, we are set. I did move my /var/log to /home/log in next bonus post.
- Now lets do our speed test. Octane Score using firefox of 43,855
Bonus:
- Move /var/log to /home/log
- To move /var/log to /home/log we will need to rsync everything then mount it.
/etc/init.d/rsyslog stop
cd /home/
sudo mkdir log
cd /var
sudo rsync --remove-source-files -azv /var/log/ /home/log
#Note I had to repeat above multiple times because there were other services like apache and mysql
#Now lets edit fstab
sudo vi /etc/fstab
#Add a mount point that tells the syste to link /home/log as /var/log. This way all logs go to hdd,while rest of your system runs on nvme/ssd.
/home/log /var/log auto defaults,nofail,nobootwait,bind 0 2 - Enjoy!