2

Using this awesome tutorial I was able to create a bootable Debian live USB with persistence.

After some days using it, it's quite configured and I would like to be able to replicate it into another usb drive.

Is there any way to do it?

I was thinking of creating an ISO image of the configured USB flash drive, but since it has multiple partitions I don't even know if it is possible.

3 Answers 3

0

Just dd or cat the whole device file like /dev/sdb into a file and the other way around.

1
  • It's also required to umount first the device in order to make iso image or dump the iso image.
    – Uxio
    Aug 15, 2017 at 11:58
0

If the new USB drive is equal in size or larger, you can use dd to duplicate the drive (/dev/sdX being the template drive, /dev/sdY being the new drive):

dd if=/dev/sdX of=/dev/sdY bs=1M conv=sync

Otherwise, or if the new drive is larger than the template drive and you want to use a maximum amount of space for the persistence partition, you can prepare the new drive like you did prepare the template drive and then copy the persistence partition contents from the template drive to the new drive (simple file copy).

0

Clone 'any' persistent live system

You can clone the whole drive from a USB pendrive with a persistent live system to a drive with at least the same size.

  • It is straightforward if there is an MSDOS partition table (MBR).

  • There is a complication if there is a GUID partition table (GPT), and the size of the target drive is not exactly the same (not one single byte should be different). It is not enough that the nominal size is the same (the size printed on the outside of the drive).

    In this case you must also repair the backup partition table. You can do it with gdisk, or easier with the shellscript gpt-fix, that uses gdisk.

Create a persistent live drive with mkusb

You can create a persistent live drive using mkusb and the operating systems Ubuntu, Debian (and operating systems created from Ubuntu or Debian, where the boot structure is not changed too much). The process will be automatic, and the whole drive will be used. There will be a partition for persistence with the ext4 file system and a partition for carrying files back and forth between your linux system and Windows with the NTFS file system (and some small partitions).

  • Such a persistent live system (and installed systems too, installed like into an internal drive) can be cloned to a drive of at least the same size. gpt-fix functionality is built into mkusb.

Flexible alternatives to cloning

  • There is a built-in backup system for a persistent live system created by mkusb, so that you can backup only the content of the casper-rw drive. This system is tailor-made for Ubuntu, and creates a compressed tarfile, a tarball.

  • For Debian you can do the corresponding thing 'manually',

    • when booted into a live-only session and
    • the partition for persistence is mounted.
    • You can create a compressed tarfile, a tarball, of the whole content of the partition for persistence. The tarball should be created in another partition (on another drive or in the NTFS partition on the persistent live drive).
  • You can restore the same persistent live system by

    • re-formatting the partition for persistence
    • restoring by extracting the content of the tarball to the partition for persistence.
  • You can create a new persistent live drive (maybe of different size) but from the same live Ubuntu or Debian iso file by

    • creating a persistent live system using mkusb
    • extracting the content of the tarball to the partition for persistence.
  • You can upgrade to a new persistent live drive (maybe of different size) from a new version of the same live Ubuntu or Debian flavour (desktop environment) by

    • backing up only the content of the /home directory in the partition of persistence into a tarball.
    • creating a persistent live system using mkusb
    • extracting the '/home directory content' of the tarball to the partition for persistence. This way you can preserve user specific tweaks and also personal files, but you have to re-install program packages and general system tweaks (for example in /etc).
    • This corresponds to keeping the 'home' partition, when you re-install an installed system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .