Can I move a working boot partition / root filesystem to another drive/partition and just boot from there?
Or will device names be changed and this cause the system to stop 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 communityCan I move a working boot partition / root filesystem to another drive/partition and just boot from there?
Or will device names be changed and this cause the system to stop working?
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.
/boot
partition with dd
and changed the new boot partition UUID using GParted. After that, I followed your instructions to change the /etc/fstab
boot entry and do update-grub
and grub-install
.
Dec 25, 2019 at 1:47
If you use UUIDs in /etc/fstab
(and other related files that may be relevant in your distro), like /dev/disk/by-uuid/57c59366-9196-4613-ba53-5ad24dcecfb9
, and adjust your boot loader configuration if you move your kernel boot partition, then it should work.
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 .