Ubuntu – Using ‘dd’ command to create bootable USB stick

bootlive-usbsystem-installationusb

Why ISO images of some flavours of Ubuntu can be put on USB stick by dd command and boot successfully, while others flavours don't? Moreover it looks like it is dependant of particular USB stick too. I tried with standard Ubuntu:

$ sudo dd if=./ubuntu.iso of=/dev/sdd bs=8129

And it works like charm, I mean: boot and installs or run live Ubuntu. But when I use another USB stick prepared the same way, it fails to boot with Operating system not found BIOS error.

When I try the Ubuntu GNOME, then it simply does not boot with the same error as in previous example, regardless of which one USB stick I use.

I know, that there is Startup Disk Creator application in Ubuntu, but I have been convinced, that it is only a GUI facade for simple dd command, and I can always use dd to create bootable USB stick, at least for Linux. Am I wrong?

Best Answer

If you run Startup Disk Creator, you'll notice that it does three (four) things:

  1. Format the drive
  2. Copy over the data from the ISO to the drive
  3. (Add an extra casper1 file for persistence, if selected. dd does not give you persistence.)
  4. Install a bootloader

It is not a GUI for dd (there are GUIs for dd, but SDC is not one of those). You can think of it as doing equivalent of Arch Linux's or Gentoo's manual methods. You should be able to create a bootable USB using most (reasonably popular) distros' installation ISOs at present. This was not true about three or four years ago, when I looked at Arch. It was only 2010 that all Arch ISOs gained this feature (where you could write it directly to a USB drive) - from 2008 to 2010 they had special USB images.

Further, if you dd a drive directly, that drive is effectively read-only until you format it or use the remaining space somehow. A SCD-created disk is still usable as a USB drive, even though the contents are are not accessible from the live environment easily. So if you dd a 1GB ISO to a 8 or 16 GB USB drive, you're effectively abandoning the remaining space unless extra steps are taken.


1Typically, most live images use a SquashFS file for the root partition. SquashFS is read-only, so for persistence, a casper-rw file is created in /casper. I am not sure of the origins of casper. From what I understand, when booted with the boot=casper option, the kernel overlays the casper file (creating one if none exists) on top of the squashfs, so that it gains write capability. casper doesn't have to be a file, it can also be a partition.