[sf-lug] making USB/SD/HD/MBR bootable (e.g. Debian)

Michael Paoli Michael.Paoli at cal.berkeley.edu
Sat Aug 9 20:42:47 PDT 2008


Here's example of how to make a bootable Debian USB stick to install
Debian (or for diagnostic/repair purposes, etc.).  It's about this
simple (once one's found the information, anyway ... which isn't too
hard - at least for Debian).  Similar techniques can be used for other
boot devices (e.g. hard drive, SD).  One can use a bootable ISO image
of one's choosing.

In this example:
I used the Debian "netinst" ISO.
/dev/sdd is a USB flash stick (512 MiB or slightly larger)
I created the image in a file, then wrote that file to flash.
The block size picked when writing flash was used to write flash at
least a bit more efficiently - similar likely applies to other media.
The name used when saving the ISO image was explicitly set to be within
8.3 format for use on FAT(/vfat) filesystem.
Also, in this example, the target device wasn't partitioned.

This session data was captured when I created the actual USB stick image
which was subsequently used to build the base system on the new
SF-LUG(/BALUG) Silicon Mechanics system ("vicki")[1]
For brevity, I've removed from the example below, the steps where I
verified the images (cryptographic signatures and md5sums and the like),
and the reporting of dd to stderr about data read/written.
To make it a bit more readable, I also folded some lines a bit more, as
if I'd actually entered them that way and caught the output that way.
Some mail software bits might introduce some additional folding (e.g. on
the long URLs).

$ wget -q -O - \
> http://http.us.debian.org/debian/dists/etch/main/installer-i386/current/images
/hd-media/boot.img.gz |
> gzip -d > usbstick.img
$ mkdir mnt
$ sudo mount -t vfat -o loop,uid=`id -u`,gid=`id -g` \
> `pwd -P`/usbstick.img `pwd -P`/mnt
$ cd mnt
$ wget -N -q --output-document netinst.iso \
>
http://debian.cites.uiuc.edu/pub/debian-cd/4.0_r3/i386/iso-cd/debian-40r3-i386-netinst.iso
$ cd ..
$ sudo umount mnt
$ sudo dd bs=1048576 if=usbstick.img of=/dev/sdd
$ 

references/footnotes:

Though oriented for Debian, lots of information on preparing bootable
USB or similar device (e.g. hard drive, SD, etc.):
http://www.debian.org/releases/stable/i386/ch04s04.html.en
Chapter 4. Obtaining System Installation Media
section 4.4.1. "Copying the files - the easy way"

4.0_r3 was most current Debian "stable" release at the time, 40r4a (or
4.0r4a) is presently the most current Debian "stable" release.

1. vicki - we quickly picked a name that would be a bit more memorable
and perhaps have a bit more personality than something like lugbox or
lugbox2.  Not sure of the precise origins of the name - perhaps early
Doctor Who companion:
http://en.wikipedia.org/wiki/Vicki
8:04-8:12 http://www.youtube.com/watch?v=-u5VzxmaP4Y

http://linuxmafia.com/pipermail/sf-lug/2008q2/004787.html

http://linuxmafia.com/pipermail/sf-lug/2008q3/005061.html




More information about the sf-lug mailing list