|
|
Krister's Blog
krister at hallergard dot com
| Last Updated:
2022-04-25 Older version
|
Cloning Linux Kubuntu 2204 LTS from PC to USB3
This video demo below shows cloning of a Kubuntu 22.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
terminal:
- # partclone.ext3 -c -s /dev/sdb6 -o k2204.img
- # partclone.restore -s k2204.img -O /dev/sdd2
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.
View Video 4½ 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:
- # tune2fs /dev/sdd2 -U uuid
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.cfg. And also edit the UUID of the clones /etc/fstab!
Now you can use the new menu entry to boot the clone do that!
To make the clone bootable you now have to add a bootloader in a root terminal:
- # grub-install --force --target=i386-pc /dev/sdd2
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:
- # grub-mkconfig -o /boot/grub/grub.cfg
(Fedora and openSUSE: replace grub with grub2 above!)
|
PC Image Restored to USB Drive
|
|