8

How can I create a bootable USB stick from an iso image?

I thought dd should do the work, but so far I were unsuccesful.

This is what I've tried:

  1. umount /dev/sdx
  2. deleted every partition on sdx with Gparted
  3. dd if=/path/to/iso/some_file.iso of=/dev/sdx bs=1024K

The file is a bootable BIOS update utility, but since my laptop does not have a CD/DVD drive I want to deploy this image on a USB stick.

However, when I have a look at sdx in Gparted, it tells me that it's size is 0 and no partitions have been created, although dd claims it has written 26MB to /dev/sdx.

I also tried to create a FAT32 partition (full size) with Gparted and then let dd copy onto this partition: dd if=/path/to/iso/some_file.iso of=/dev/sdx1. Did not work either.

The USB Stick is ok, I can write and exchange data between my laptop and computer with it. (Actually it is the same USB stick that I used to install Manjaro on my laptop before)

What am I doing wrong?

daniel451
  • 1,017
  • 6
  • 13
  • 26

3 Answers3

10

Using gparted remove the existing partitions from your usb, and fix the msdos partition table (by going to the device menu and selecting "create partition Table"). Then, create a new partition fat32 by right clicking on the unallocated space and selecting new, making a primary FAT32 partition.

Next step create your bootable usb:

dd if=/path_to_iso_without_space.iso of=/dev/sdx
sync

You can add the bs=4M option to make it faster:

dd bs=4M if=/path_to_iso.iso of=/dev/sdx

Example: if your device is sdb1 you should type sdb

dd if=/path_to_iso_without_space.iso of=/dev/sdb
Jonathan Komar
  • 5,974
  • 7
  • 33
  • 52
GAD3R
  • 63,407
  • 31
  • 131
  • 192
  • So the partition table should be `msdos` by default? – daniel451 Apr 21 '16 at 20:16
  • Plus: is `sync` really needed? if so, why doing it in two steps? wouldn't `dd if=/path_to_iso_without_space.iso of=/dev/sdx && sync` be better? – daniel451 Apr 21 '16 at 20:18
  • 1
    of cource `&& sync` is better and you need to fix the Invalid MSDOS partition tables first. – GAD3R Apr 21 '16 at 20:24
  • Ok, so just for clarification: the partition table should be `msdos`, a `fat32` partition (primary & full size) should be created on the usb stick and it should be unmounted before using `dd`? – daniel451 Apr 21 '16 at 20:34
  • It is not mounted – GAD3R Apr 21 '16 at 20:38
  • I think you need to make the partition as bootable ( setting the bootable flag) after coping it with dd ... – Francesco Jan 14 '18 at 09:23
  • what is the point of creating a partition with Gparted if the we used dd ? isn't dd going to override all partition on the disk ? – Francesco Jan 14 '18 at 09:42
  • This answer can be improved by explaining why adding `bs=4M` will make it faster. – Elijah Lynn Nov 18 '18 at 01:45
3

If it is a archlinux bootable iso, you don't have to do anything special. Just

dd if=somefile.iso of=/dev/sdx

where sdx is the block device like /dev/sda and not a partition like /dev/sda1.

This is possible as the iso already contains all that is needed. If you set some partition table, it will simply has no effect, as it will be overriden by dd, as anything else on the target device.

Edit: You sure have to unmout any partition on that device, as they will be overriden as described before.

Edit2: The same applies to the manjaro image, according to their wiki.

bvolkmer
  • 409
  • 1
  • 3
  • 9
3

If you don't know your USB device block file (such as /dev/sdb) and if you want to make sure you're not writing over one of your sata system drives, you can use the more secure bootiso utility.

You can give your USB device name explicitly (will fail if it is not connected through USB):

bootiso -d /dev/sdb /path_to_iso_without_space.iso

Or let him find it for you:

bootiso /path_to_iso_without_space.iso

See it in action: