Use dd for creating Bootable USB stick from any Disk image
First of all, please please please, make sure you check and double check the command before executing it.
This command is highly dangerous (be careful) and may delete all your files.
hehe, scared you right away. Don't worry, nothing will happen if you don't make a mistake, and I gues you won't because I'll explain the whole command to you. Creating a bootable media from linux has always been painful. and It is even more tough if you wish to create a bootable Windows media. But as linux is so amazing, it has some built in command to do these thing very easily. so let's start.
The command we will be using is dd
. yes as simple as that! what dd does is hilarious. It copies disk to disk while keeping most of the disk information including the boot record. That's the trick. We use the ISO File as one disk and the removable media as another one.
we start by finding out the device file of the removable media. plug in your removable media (pendrive, flash drive) and copy all the necessary files which are in it :p
removable media drives are usually mounted under the folder /media
so if we run this command in the terminal:
df | grep media
it will output the disk drives that are mounted under media. My output is this:
/dev/sdc1 7800332 1816380 5983952 24% /media/anam/anam8_ubunt
I have only one devices mounted that is 7800332(~8GB) and it has a label anam8_ubunt
. the line specifies that the device is '/dev/sdc' and the number "1" indicates the first partition. We don't need to think about that, we just need the /dev/sdc
part.
now navigate to the folder in terminal where you have kept the ISO file . for example, if you have kept the file in your home folder, navigate there by typing cd ~
and now, read carefully
Important thing about dd
the syntax dd
has a wide variety of use, the simple dd command consists of two arguments, the input device file, and the output device file. so the syntax looks something like this : dd if=path_to_the_source of=path_to_the_destination
if stands for input file and of stands for output file. and if you make mistake, you may wipe your hard disk.
now, for my work, the input file would be the ISO File and the output file would be the USB Device(/dev/sdc in my case).
I assume I have an ISO file named ubuntu-12.10-desktop-i386.iso
so, my command would be :
dd if=ubuntu-12.10-desktop-i386.iso of=/dev/sdc
The command will take a while and won't output anything on the terminal. Don't be disappointed. after the command has been finished, Unplug and plug in your USB device, and you'll see that the files have been copied successfully.
Now you can boot from this media.
Recovery:
Your removable media may shrink in size (8gb or bigger media may turn into 700MB). Don't get afraid. after you have finished installation from the media, use a tool like gparted to delete the 700MB (or disk size) partition from your removable media and reformat it with its full size.