9

Possible Duplicate:
Create USB installer from the command line?

With curiosity I have on terminal, I came to this step. How can I create Live USB from terminal? Is there any tool i got to do that ?

I am using Ubuntu 12.04 .

Raja G
  • 102,391
  • 106
  • 255
  • 328

2 Answers2

16

You can use the famous (and also dangerous) Linux tool dd for this job. But take note that it will completely erase all the contents of USB drive. Also note that you can't get the facility of persistence storage with the Live USB, which means every boot to the Live System will be new.

Using dd

First take note of the device number of your USB drive with the command sudo blkid. Most probably, it will be /dev/sdb or /dev/sdc. Almost all of the time, it cannot be /dev/sda.

Then open a terminal with the Ctrl+Alt+T shortcut and use this command (I'm assuming your USB drive is /dev/sdb).

sudo dd if=/path-to-the-iso-file/filename.iso of=/dev/sdb

The command will run for some time. When you see the prompt $ in your terminal, you're done.

Using cat

You can also use the cat command. Open a terminal and enter the command like below:

sudo cat /path-to-ubuntu-iso/iso-filename.iso > /dev/sdb; sync

Replace the /dev/sdb with your system-specific USB drive number.

Please note that you need to specify the output device as /dev/sdb or /dev/sdc, not /dev/sdb1, /dev/sdc1, etc.

Update for the updated question

Not all distros can be made bootable using the dd method. One such example is OpenSUSE DVD (not the live one). So it is not possible to use dd to make a bootable iso for every Linux distro, but the dd method should work for all live distros.

Anwar
  • 76,649
2

Yes it can be done with mtools (various) If you have a look at this page, there's instructions for downloading the isotostick.sh script that uses mtools (you need to also install mtools).

A look through that script will give you an idea of what is involved.

fabricator4
  • 8,375
  • 1
    hi i have managed to get maximum but now getting this error ./isotostick.sh: line 103: /lib/udev/vol_id: No such file or directory – Raja G Oct 08 '12 at 16:30
  • It should work for most debian distros I think. Apart from that, maybe have a look at Multisystem and how it does things - mostly using grub to boot various iso files direcly by loop mounting them. It's a useful technique when you want to boot different distros off one USB stick and lends itself to a fair bit of hacking around. The downside is that some distros do things quite differently in this regard. – fabricator4 Oct 08 '12 at 16:32
  • hi i managed to get what i have mentioned for previous two comments . but stopped at this error . – Raja G Oct 08 '12 at 16:37
  • Yep, vol_id disappeared round about 9.04. It appears to be checking that the partion type is VFAT. You should be able to skip all the fluff and go straight to the nuts and bolts, but if you really want to re-write the script you should be able to pull the information out of /proc/self/mounts – fabricator4 Oct 08 '12 at 16:47