1

Can I make a bootable pen drive from a ISO using the Linux command line without installing any extra software?

If yes, what are the commands?

1

3 Answers 3

2

It should be possible, yes.

  1. Obtain an "hybrid ISO", which is simultaneously a valid image for a non-CD drive. This will be the case for any recently produced bootable linux ISO.

    Here's how to verify this before you try:

    $ file -k lubuntu-12.10-alternate-i386.iso
    lubuntu-12.10-alternate-i386.iso: # ISO 9660 CD-ROM filesystem data 'Lubuntu 12.10 i386              ' (bootable)\012- x86 boot sector; partition 1: ID=0x17, active, starthead 2, startsector 64, 1319448 sectors, code offset 0xed
    

    The ISO bit tells you it's an ISO :). The x86 boot sector bit tells you that it's potentially bootable as a non-CD disk as well. (It seems to have come out all on one line for some reason). You need the -k option of file, or it'll stop after finding the ISO bit and won't tell you about the x86 boot sector.

    (You could do also do this on a partial download of, I guess, the first 4MB of the file. In case your bandwidth is an issue).

  2. Say goodbye to any data on the pen drive.

  3. Carefully identify the device node for the pen drive. Try plugging it in, and see what dmesg|tail calls it. If you have a GUI you could use that to mount it, and then have a look at the output of mount. You're looking for something like sdx. sda is probably your first hard drive - don't get confused, or you'll have to say goodbye to all the data on that.

  4. Now make sure you haven't mounted an existing filesystem on the pen drive. A modern GUI like GNOME may have mounted it when you inserted it. Look at the output of mount again and act accordingly e.g. umount /dev/sdx1.

  5. dd if=lubuntu-12.10-alternate-i386.iso of=/dev/sdx bs=4k. Replacing sdx with the device name determined in step 3 :).

Some people try to make it go faster with e.g. bs=1M. Personally I prefer to let the kernel sort that out. bs=4k is a sensible minimum though; it's usually faster than the default 512 bytes, and rarely slower.

Note that the latest upstream version of the gnome-disks GUI should have a "restore disk image" feature equivalent to the above dd command. This would probably be my recommendation going forward. It should show usb drives with a nice friendly icon, and it should avoid any chance of overwriting a hard drive containing mounted filesystem(s). (You'd still need to avoid your not-mounted Windows disk though).

3
  • Actually, the ISO 9660 means that it follows the International Organization for Standardization's 9660 spec (Compact Disk File System).
    – Ross Aiken
    Feb 21, 2013 at 16:50
  • @sourcejedi the output of the 4th step is 'dd if=debian-6.0.5-amd64-CD-1.iso of=/dev/sd12 1323008+0 records in 1323008+0 records out 677380096 bytes (677 MB) copied, 0.859432 s, 788 MB/s' 'code' But the USB is empty. Mar 22, 2013 at 18:17
  • Sorry @UdaraS.SLiyanage, you just created a 700MB file called sd12 in the /dev directory. You don't have a device node called sd12. As I said you want something that looks like sda, i.e. there shouldn't be any numbers in it.
    – sourcejedi
    Feb 4, 2015 at 17:25
0

How to Create Bootable USB/Pen Drive In Kali Linux http://linux-all-over.blogspot.in/2014/09/how-to-create-bootable-usb-on-linux.html

-1

From the excellent Arch Linux wiki:

dd bs=4M if=/path/to/.iso of=/dev/sdX

Link to ArchWiki

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .