Can I move working boot partition / root filesystem to another drive/partition and just boot from there?
Or device names will be changed and prevent from working?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Yes it is possible. Also its not easy. If you intent to move separated /boot partition and or / partition you should consider first of all changing the fstab entries.
If you are moving the files to new partition then don't forget to use
cp -p while copying to preserve permissions. adjust then your
/etc/fstab to the new UUID's of partitions that you will use. YOu can get the partition uuid by running
blkid /dev/sdXn where X is name of the drive and n number of partition.
You can also use blkid to attach labels to your partitions and then mount via labels which is much easier read
man blkid to learn more.
After you change the partitions and adjust /etc/fstab you should run the
update-grub - available on Debian/Ubuntu script or
grub-mkconfig -o /boot/grub/grub.cfg to generate a new config file and then reinstall grub into the first hdd that you bot from.
grub-install --recheck /dev/sda
Of course do not forget that when copiying mount a new / or /boot partition on /mnt and after copying all of the files mount them as / and /boot chroot and only then run update of the grub if you want things to be done correctly.
I just like to mention what I did to move Debian Stretch installed in old MBR style disk which is near to dying and moved the OS to new disk with GPT, in my case ESP(EFI system partition) is present in old disk, so I was already booting using UEFI. I followed answer already given above by user in1t3r .