Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Possible duplicate . Please take a look at How do I place a bootable ISO on a USB drive? & make pendrive bootable via command line Ubuntu –  Ye Lin Aung Feb 17 '13 at 15:24
add comment

2 Answers

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. And/or you could mount it with the GUI, then have a look at the output of mount. (Remember to unmount it again before you write the image to it). 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. 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 8 disk though).

share|improve this answer
    
Actually, the ISO 9660 means that it follows the International Organization for Standardization's 9660 spec (Compact Disk File System). –  Ross Aiken Feb 21 '13 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. –  Udara S.S Liyanage Mar 22 '13 at 18:17
add comment

From the excellent Arch Linux wiki:

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

Link to ArchWiki

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.