Using an IMG instead of an ISO to put Debian on a USB Flash drive
Now that I have a laptop that boots from USB, I've been using IMG images instead of ISOs when I can to test new Linux and BSD systems because they're so easy to deal with.
I built an IMG of Debian Sid in IMG form with the custom-build portion of the better-then-ever Debian Live site. They're in the usb-hdd/ directory when you're on the site looking for images to download.
Putting the IMG on a USB Flash driver is easy using the dd command in Unix/Linux. I got the easy instructions from the Debian Live manual, but it's just easy to turn to that most helpful of Linux distros, Arch, for easier-to-digest instructions. (I've gotten so much help from the Arch Linux community over the last couple of years — I can't thank them enough. From forums to wikis, they've pulled me out of countless jams in Ubuntu, Debian and Fedora.)
Arch's wiki has the user running the dd operation in his/her own shell. But in Fedora 13 I needed a root shell (or I could have used sudo).
First figure out where your USB Flash drive is in the /dev hierarchy. I generally do this by running the command dmesg and looking for the output that corresponds to my flash drive.
$ dmesg
This is the relevant output:
[ 6.728884] scsi 2:0:0:0: Direct-Access A-DATA USB Flash Drive 0.00 PQ: 0 ANSI: 2 [ 6.729496] sd 2:0:0:0: Attached scsi generic sg2 type 0 [ 6.732117] sd 2:0:0:0: [sdb] 15771759 512-byte logical blocks: (8.07 GB/7.52 GiB) [ 6.732623] sd 2:0:0:0: [sdb] Write Protect is off [ 6.732627] sd 2:0:0:0: [sdb] Mode Sense: 00 00 00 00 [ 6.732630] sd 2:0:0:0: [sdb] Assuming drive cache: write through [ 6.735373] sd 2:0:0:0: [sdb] Assuming drive cache: write through [ 6.735416] sdb: sdb1 [ 7.105693] sd 2:0:0:0: [sdb] Assuming drive cache: write through [ 7.105736] sd 2:0:0:0: [sdb] Attached SCSI removable disk
So my flash drive is at /dev/sdb
I've already downloaded my .img file from either Debian or whatever project happens to be offering their distributions/projects in that format.
In Fedora, as I said above, I need rootly privileges to do this. In your system you may be able to do this as a user. In this example I'm using the IMG file from a daily build of Debian Squeeze as the .img file and my particular flash drive as the target. In your case use the name of your .img and location in /dev of your flash drive:
# dd if=debian-live-squeeze-amd64-gnome-desktop.img of=/dev/sdb
In this case dd is copying a lot of bits, so it will take awhile for the job to complete.
Once it does you can reboot your machine and boot from your newly created bootable USB Flash drive running, in this case, Debian Squeeze.
It's a great way to test out new releases (or daily builds, or anything in this format) without needing to burn a CD/DVD or use an app such as unetbootin or Fedora's liveusb-creator to put an image on a USB drive. You just go straight from downloading an .img file to copying it to the drive and then booting from it. Every Unix/Linux system has dd, and it's nice to put it to good use.





Thank you. This is very interesting. You have tickled my curiosity. I have never try IMG, but I must be more adventurous.
As for the dd command, it is indeed very powerful.
I'm using a Dell Inspiron 11z with Linux, although I could only buy it with Windows 7 (which quickly went by the wayside). Since it does not have a CD/DVD reader, and because I am often on the move, I have been using the dd command to copy, using an external reader, movies bought on DVD. There are always two or three things to watch on the hard drive.
It’s great.
You have to love Unix, where everything is a file, and free software, where all the tools are just what they should be, and Google for indexing it all. An ISO is simply an image specifically formatted for a CDROM. You can mount the files and modify them the same way you can mount an image file or a CDROM.
A nifty trick is to make an image of your working computer. You do this by booting off a CD or USB key then using dd to copy the working system drive to another USB key or a file on an external hard drive. There are whole distros for doing this but dd is the essential tool and any distro will do if you have the time for the whole copy. This trick is particularly useful for netbooks, which have small drives. Once you have your image, you can mount it or boot it to make the changes to files like needed to make it run. A surprising amount of hardware will run off an image made this way and it is always nice to have a backup.
Thanks for the article, I keep meaning to look into Debian Live.