Score:0

Does it matter to partition something before dd?

jp flag

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?

Score:1
cz flag

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.

jp flag
but dd won't work for windows 10, and also formatting to FAT32 and copying the files won't work anymore as there's a file larger than 4GB. Shouldn't dd work? It simply has the partitions, it should be just a matter of dding the iso
Michael Hampton avatar
cz flag
@GuerlandoOCs I wouldn't bother with dd on Windows. There are too many layers of indirection between WSL and the hardware for me to trust it. Just use Rufus, which does the same thing reliably.
jp flag
I meant using dd on ubuntu to burn a windows 10 iso. Anyways, it was just a technical question, I was intersted in why it does not work
jp flag
Shouldn't the windows iso contain the FAT32 and etc?
Michael Hampton avatar
cz flag
@GuerlandoOCs I have no idea what Microsoft has done with the Windows 10 ISO images or how they are supposed to boot. And you also didn't ask about it. If I have to write one of those then I just use Microsoft's tools.
Michael Hampton avatar
cz flag
@GuerlandoOCs I just took a quick look. Microsoft's media are in the UDF format, a format that was once used for DVD-ROM media but most everyone else abandoned it. The BIOS can deal with UDF and you can `mount -o loop,ro -t udf ...` in Linux to look at its contents. The same applies though, this format has no disk partitions so should be written to the whole disk. I'm pretty sure something unusual has to be done to write it to something other than optical media, which is why `dd` wouldn't work.
jp flag
I guess this is why it does not work when I dd, it has no partitions and it should have a FAT32 one
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.