Ubuntu – Bootable USB from casper / PinguyBuilder backup

backupbootlive-usbsquashfs

I am trying to make a bootable LiveUSB backup of my system. After getting into trouble with Systemback, I am trying PinguyBuilder. It seems nice, since it is a simple script that can be adapted.

However, I fail to boot from the ISO files it creates. I am suspecting (but I don't know) that the problem is within the creation or burning process of the ISO. My (compressed) system is larger than 4GB. So I hat to tweak PinguyBuilder a little bit to generate these larger images. Nevertheless I can generate a bootable USB stick based on it.

The error I am encountering occurs when booting from the stick. After choosing from a dialog to boot the LiveUSB, it will show a message that it failed to mount my squashfs. However, the contained squashfs mounts just fine on my working system.

I am wondering If I can generate my bootable LiveUSB directly from the files (mostly the squashfs) that PinguyBuilder generated. It leaves a working directory ISOTMP containing
boot casper dists EFI install isolinux md5sum.txt pool preseed README.diskdefines ubuntu.

The casper subdirectory contains essentials like filesystem.squashfs and vmlinuz. But how can I generate a bootable USB stick from it? Note that I don't necessarily need a tool. I can partition the USB stick and copy files myself, if necessary.

Best Answer

mkusb is a great tool for making boot drives. The boot system works for both BIOS and UEFI. Following shows a method to clone an existing OS drive to USB.

Create a persistent USB drive using mkusb, use defaults, use any handy ISO.

Boot computer from a second live USB.

Using gparted delete the OS partition and the casper-rw partition from the persistent USB. Leave the NTFS data partition if you want a partition Windows and Linux can access. confirm there is room for the cloned partition.

Select the drive whose partition(s) you want to copy, right click the partition, select copy.

Select the Target drive and select the empty space, right click and paste.

After gparted is complete, copy the OS menuentry from boot/grub/grub.cfg of the new partition to be the first menuentry in the grub.cfg of the USB's boot partition.

The boot drive will not work as an installer drive.