Let’s assume the following scenario. A Linux administrator called Bob, as many fictive persons have that name, got the task to get a Linux system ready for a backup server that a client has ordered. Unfortunately he has no hard drive available so he decided to install Linux on a usb stick which he would migrate to a hard drive later because as an experienced Linux user he already knew the steps that would be required for the migration.
Two days after Bob ordered a new hard drive from an online store he immediately started to migrate. Firstly he downloaded his favourite Arch Linux Live ISO and booted it. With the
dd tool he cloned the usb stick. Then he resized the root partition with an ext file system.
Now it was time to install the Grub2 boot loader so he mounted the cloned root directory and chrooted to it.
mount /dev/sdb1 /mnt arch-chroot /mnt
The chroot is necessary to let the current running processes and their children work on the new environment and not on the environment from the ISO itself.
As an exact clone of the usb stick was made the cloned partitions have the same universally unique identifier (UUID) as the original partitions, so there’s no need to update
To make the new disk usable the boot loader must be installed on this disk by executing
grub-install /dev/sdb. Instead of installing the boot loader an error message showed up unexpectedly.
Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
Bob was then checking all the configuration files for the correct UUIDs but whatever he tried to fix it, it didn’t work. Although Bob was sure that the Grub configuration file was correct he finally just recreated it.
grub-mkconfig -o /boot/grub/grub.cfg
Right after Bob ran
grub-install again, his face color changed back to normal.