Add a data partition to a live USB ISO

I found very useful adding a data partition to a live usb iso: for example, when I use a clonezilla USB image to backup and restore, i can save or use an image directly on the same USB Pen drive without adding an extra storage device.

So i would like to do the same on the Urbackup Live CD iso.

On Linux i have no issue at all, but usually, I need to create a procedure for my customers that run Windows most of the time.

It should sound simple anyway, you’re thinking: burn the iso with balena Etcher, add a partition with Windows’ Disk manager and…OUCH! My ISO doesn’t boot anymore!? Why?

Ok, let’s check the partition table of the hybrid iso of clonezilla (clonezilla iso doens’t have issue adding a new data partition, remember).

$ sudo fdisk clonezilla-live-2.6.4-10-amd64.iso
 Welcome to fdisk (util-linux 2.33.1).
 Changes will remain in memory only, until you decide to write them.
 Be careful before using the write command.
 Command (m for help): p
 Disk clonezilla-live-2.6.4-10-amd64.iso: 279 MiB, 292552704 bytes, 571392 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos
 Disk identifier: 0x01876737
 Device                              Boot Start    End Sectors  Size Id Type
 clonezilla-live-2.6.4-10-amd64.iso1 *       64 571391  571328  279M 17 Hidden HPFS/NTFS

As you can see, Clonezilla ISO has one only partition and windows show it correclty in this way

And you can add a new data partition on the spare space at the end of the disk.

Everything are clear here? Ok, let’s go on!

Now, let’s have a look to the Urbackup LiveCD ISO.

$ sudo fdisk urbackup_restore_2.3.1.iso
 Welcome to fdisk (util-linux 2.33.1).
 Changes will remain in memory only, until you decide to write them.
 Be careful before using the write command.
 Command (m for help): p
 Disk /media/sf_Downloads/urbackup_restore_2.3.1.iso: 274 MiB, 287309824 bytes, 561152 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos
 Disk identifier: 0x0e50079d
 Device                                          Boot Start    End Sectors  Size Id Type
 urbackup_restore_2.3.1.iso1 *       64 561151  561088  274M  0 Empty
 urbackup_restore_2.3.1.iso2        708   6403    5696  2.8M ef EFI (FAT-12/16/32)

As you can see, we have 2 partitions here instead of the single one of Clonezilla’s ISO. On linux, there is no problem at all, but when you burn it in Windows with Etcher or Rufus, you will see this:

Oh crap! Where is the first partition?!

Windows has a bug on the partition algorithm, i discovered: infact, it doesn’t manage the partition that have partition type == 0x00.

If you look again in the fdisk report of the Urbackup LiveCD Iso, you will see the the type of the first partition it shows “Empty”.

Ok, now we understood the issue, we could solve it! How? Simply changing the partition type of the first partition before burning it!

 $ sudo fdisk urbackup_restore_2.3.1.iso 
  
 Welcome to fdisk (util-linux 2.33.1).
 Changes will remain in memory only, until you decide to write them.
 Be careful before using the write command.

 Command (m for help): t
 Partition number (1,2, default 2): 1
 Hex code (type L to list all codes): b
  
 Changed type of partition 'Empty' to 'W95 FAT32'.
  
 Command (m for help): p
 Disk live-image-amd64.hybrid.iso: 991 MiB, 1039138816 bytes, 2029568 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos
 Disk identifier: 0x91c57fbc
  
 Device                       Boot Start     End Sectors  Size Id Type
  urbackup_restore_2.3.1.iso1 *       64 2029567 2029504  991M  b W95 FAT32
  urbackup_restore_2.3.1.iso2        740    6435    5696  2.8M ef EFI (FAT-12/16/32)
  
 Command (m for help): w
 The partition table has been altered.
 Syncing disks.

Now let’s burn it with Etcher as usual

And we can add a data partition too of course!

Isn’t it simple now? 🙂

EDIT: Meanwhile i’ve posted on livebuild debian mailing list here: https://lists.debian.org/debian-live/2020/03/msg00213.html and you can find very useful comment about this.

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *

The maximum upload file size: 30 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here