Cloning Linux Kubuntu from PC to USB
This video demo below shows cloning of a Kubuntu 20.04 partition on the PC's GPT drive onto a USB partition (MBR drive).
Using Partclone this is quite straight forward, using these commands in a root
The captial O is to overwrite the previous installation of Kubuntu 18.04. If your Linux is on a ext4 partition, just replace ext3
with ext4. The tricky bit is to get the clone bootable.
- # partclone.ext3 -c -s /dev/sdb6 -o k2004.img
- # partclone.restore -s 2004.img -O /dev/sdd3
View Video 6 min
You cannot have two partitions with the same UUID on a system, so the first action is to change the UUID of the cloned partition:
The next step is to boot the cloned partition from another system's bootmenu. I usually boot into another Linux system and
update-grub, and the os-prober will create a menuentry for the clone. But it would pick up the wrong UUID (the one of the source),
so first manually edit the UUID of Section 10 in the clone's /boot/grub/grub. And also edit the UUID of the clones /etc/fstab!
Now you can use the new menu entry to boot the clone do that!
- # tune2fs /dev/sdd3 -U uuid
To make the clone bootable you now have to add a boatloader in a root terminal:
- # grub-install --force --target=i386-pc /dev/sdd3
If your source was on a GPT disk, you will have to install the i386-pc module (I already have it installed on my Linux GPT partitions),
when cloning to a MBR disk. Or you might have to install the grub-efi module, if cloning from MBR to GPT.
(for Fedora and openSUSE: replace grub with grub2 above!)
And finally do update-grub:
(Fedora and openSUSE: replace grub with grub2 above!)
- # grub-mkconfig -o /boot/grub/grub.cfg
Restoring from image to USB flash drive