Does it matter to partition something before dd?

Guerlando OCs asked:

Normally, to burn an ISO to a disk, let’s say an ISO for installing Ubuntu, we dd to the /dev/sda, not to the partition like /dev/sda1, so in this case, where the target file is /dev/sda which is presumably the entire disk, does it make any sense to partition first? Wouldn’t the iso contain the partitions?

My answer:


Yes, the ISO image contains its own partition table, and thus it should be copied directly to the whole disk device, not to any existing disk partition.

$ fdisk -l ubuntu-20.04.1-live-server-amd64.iso | cat
Disk ubuntu-20.04.1-live-server-amd64.iso: 914 MiB, 958398464 bytes, 1871872 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: 0x7b19ba11

Device                                Boot Start     End Sectors  Size Id Type
ubuntu-20.04.1-live-server-amd64.iso1 *        0 1871871 1871872  914M  0 Empty
ubuntu-20.04.1-live-server-amd64.iso2       3688   11623    7936  3.9M ef EFI (FAT-12/16/32)

(Note that the partition type of 0/Empty is ignored by Linux.)

Modern ISO installation images are built as hybrid ISO images, which can be booted with legacy/CSM boot from either hard disk (your USB stick is treated as a removable hard drive at boot time) or optical media (CD, DVD, BR) which uses a completely different legacy boot method than hard drive booting. Such ISO images can be burned to a DVD or copied to fixed or removable media such as USB drives. It could even be copied the same way to an internal hard drive and still boot.

These images are also built for UEFI boot, but this works the same regardless of media type and is not related in any way to the image being an ISO. The image must be written directly to the disk and the partition table visible to the BIOS at boot time so that it can find the EFI partition, so again, you have to dd it to the whole disk device.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.