Generation of images for USB memory sticks
See DebianLive/FirstStepsUSB too.
Although some of the generic images are autobuilt and downloadable on the download server (look for the .img files on http://live.debian.net/), you may want to create your own. This is very easy, you just create them the same way as an ISO image (see DebianLive/Howto/ISO), except that you have to add an option to lh_config:
lh_config -b usb-hdd <options>
lh_build
e.g.
lh_config -b usb-hdd -p gnome-desktop -m http://127.0.0.1:3142/ftp.debian.org/debian/
lh_build
Where, in this example, -p is the desktop choice of the image ( more choices in /usr/share/live-helper/lists/ ) and -m is the local apt-cacher mirror to speed up rebuilding images.
When you have the img file, in order to copy it to your USB drive, follow these steps for Linux or for Windows.
Linux
For computers with Linux installed in the hard disk:
- If you don't know the device node of your usb drive, plug it in and identify it with the following (requires udev):
$ ls -la /dev/disk/by-id/usb-* lrwxrwxrwx 1 root root 9 2007-08-11 12:46 /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B720CB323C1 -> ../../sdc lrwxrwxrwx 1 root root 10 2007-08-11 12:46 /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B720CB323C1-part1 -> ../../sdc1
- If your system doesn't have /dev/disk/by-id/usb-* it probably doesn't use udev. In that case, look at /proc/partitions before and after plugging in the device to see which drive appears.
Note: even if you don't have SCSI drives in your system, many devices (e.g. SATA drives and USB drives) use the SCSI emulation layer. So while on a system with only PATA drives, your USB drive may be /dev/sda because it is the first one, don't count on it.
I'll refer to the USB drive (from the example above that's /dev/sdc) below as $USBDRV.
Copy the image file onto the USB drive. NOTE THAT THIS WIPES ITS CONTENTS!
dd if=debian-live-sid-i386-standard.img of=$USBDRV
Windows
Please note that after this step your USB flash drive will be unreadable by Windows.
On Windows 32 systems instead of dd use WinRaWrite (the easiest) or dd for Windows to copy the image file onto the USB drive. NOTE THAT THIS WIPES ITS CONTENTS!
Boot the live system
Now, ensure that your USB drive is plugged in and reboot your computer to use DebianLive.
Questions
The USB flash drive does not boot. Is an additional step required to make it bootable?
If you find that the USB drive is not bootable, you probably need to change the boot order in your system's BIOS. USB drives most often appear as an additional hard drive device *after* the internal drives in your system. Reorder the devices so that the USB drive comes first.
The FAQ has further details about how to boot from USB if the BIOS does not support USB booting. (see DebianLive/FAQ)
Options
- If desired, add a second partition on the USB drive for your data.
cfdisk $USBDRV
mkfs.ext3 ${USBDRV}2
If you bugger up the partition table on a USB stick, fdisk is a tool you might want to try to repair it.
Testing
- To test an image to ensure it is intact, you can mount it loopback as follows:
$ mkdir test $ sudo mount -o loop,offset=512 debian-live-40r0-rc1-i386-gnome-USB.img test $ ls test/ boot.txt f10.txt f3.txt f6.txt f9.txt md5sum.txt syslinux.bin casper f1.txt f4.txt f7.txt initrd.img memtest syslinux.cfg doc f2.txt f5.txt f8.txt ldlinux.sys splash.rle vmlinuz $ sudo umount test
The "offset=512" skips the master boot record.
Note: example given to find the offset to use:
$ sudo fdisk -ul binary.img
it returns you the start sector and the sector size:
[...] 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes [...]
the offset equals the start sector multiplied by the sector size:
e.g.: offset = 63 x 512 = 32256
Generally, the offset found can be:
- 512 (1 sector)
- 31232 (61 sectors)
- 32256 (63 sectors)
Testing with Qemu
You can boot the image with Qemu, without copying it to the USB key.
Note: This currently works for Qemu 0.8.x but not 0.9.x. Check your version by typing 'qemu' at the console.
qemu -hda *.img
Will boot the Debian Live image file from where it is on the hard drive.
More info
