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?
command linelinuxshellUbuntuusb
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?
Best Answer
It should be possible, yes.
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:
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 offile
, 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).
Say goodbye to any data on the pen drive.
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 ofmount
. You're looking for something likesdx
.sda
is probably your first hard drive - don't get confused, or you'll have to say goodbye to all the data on that.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
.dd if=lubuntu-12.10-alternate-i386.iso of=/dev/sdx bs=4k
. Replacingsdx
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).