Linux Cookbook 2: Migrate your installation to another machine

How-To Linux

1) Clean after youself! It is really good idea to first clean up your drive, before you start making full backup of it. First, you wont transfer any unused software or data to your new machine, and secondly it is going ot be much faster!

2) Make the data backup. For that we are going to user rsync. Thanks to that we can keep the file permissions and stuff. You will need some external disk with EXT4 partition. Note: We are exluding /home here. You will need to back it up separatelly in case you are using encryption.

sudo rsync -avHX --exclude /proc --exclude /mnt  --exclude /media --exclude /timeshift --exclude /home / /media/externalDataDisk/

This way we made a backup of the whole disk, excluding the home folder. Backup this separatelly, in case of using home folder encryption.

sudo rsync -avHX /home/helu/ /media/helu/20f4e93a-4de0-4805-bc01-bdc5ad01b474/home/helu/

3) To refresh the copy run following from bootable Live USB:

sudo rsync -avHX /media/source/ /media/destination/

4) Pokud jsme měli ecryptfs home složku, musíme si ověřit že na nové machine to máme stejně. Pokud jsme měli encrypted home folder, musíme mít vytvořeného encrypted usera.

5) Now you need to fix drive UUID inside /etc/fstab

update fstab!

2) Mount chosen partition:

sudo mount /dev/nvme1n1p3 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc

3) Enter Chroot for /mnt, update GRUB and exit Chroot:

sudo chroot /mnt
sudo dpkg --configure -a
sudo update-initramfs -k all -u
sudo update-grub
exit

5) You should be done and can reboot now.

Previous Post Next Post