Vous êtes sur la page 1sur 2

KNOW HOW Memory Stick Linux

Booting Linux from a USB Memory Stick

Linux on a Stick
Everyone knows you can boot Linux from a

live CD, but have you thought about putting

Linux on a compact and highly portable USB

memory stick? BY FABRIZIO CIACCHI

A
bootable “live” CD like Knoppix much more common. Part of our pur- ent from DSL, but it includes more
[1] or Kanotix [2] gives the user a pose is to create an inexpensive system, software (about 14 MB plus), and it
fully portable operating environ- so I will base this discussion on the stan- has already been refined and tested for
ment. You can carry your system with dard and very common 128 MB size. USB devices.
you and boot it from anywhere. However, the procedure I describe in this • Flonix [8]: Flonix is also based on
Your tools, your files, and your work- article can also be used to put a larger DSL, but it uses some different pro-
space will follow you wherever you go – Knoppix-based distribution on a larger grams (for instance, IceWM instead
even to another PC with a different USB memory stick. of Fluxbox). The Flonix project also
operating system. Live CDs are also used Assuming you want room to work and introduced a useful web install
by system administrators for trouble- store documents, it is a good idea to only process. Ultimately, Flonix was so
shooting computers that won’t boot use half of the available space (64 MB) successful that it become a commer-
normally. for the Linux system and related tools. cial project and is no longer available
What could be more portable than a Obviously, it would be very difficult to as a free version to download. But if
live Linux CD? What about a live Linux include useful but expansive tools such you search on Internet, you may find
USB memory stick? A tiny USB memory as OpenOffice or the Gimp. an older (free) Flonix image to use for
stick is even more portable, and often Luckily, several developers in the your memory stick.
more durable, than a CD, and writing to Linux community are already working • Puppy Linux [9]: Puppy Linux is a
USB memory is typically smoother and on the problem of how to put Linux in a young project that has some useful
faster than the business of “burning” very small space. The following distribu- features. First of all, it all loads in RAM
data to a CD. tions are possible candidates for USB: so it is very fast; you need at least 128
With some tricks and a bit of work, • Damn Small Linux [3]: The Damn MB of RAM. Puppy Linux is bootable
you can configure a Linux distribution to Small Linux (DSL) distro is based on from many types of devices (hard-
boot from a USB memory stick. All you Knoppix (and Debian [11] too), but the disk, CD, USB), and it contains very
need is a memory stick and a suitably author has reduced the size to only 50 thin and fast programs. (The size of
small Linux distribution. Of course, this MB by deleting some documentation the complete distribution is 50 MB.)
trick only works if the BIOS of the PC and radically optimizing nearly every You can start an X session with
you are booting supports USB boot. directory. Damn Small Linux can boot FVWM-95 Window Manager.
a graphical environment with a • SPB-Linux [10]: SPB-Linux is a modu-
Getting a Little Linux Fluxbox like Window Manager. lar distribution that is very small and
USB memory sticks come in different • RUNT [4]: RUNT (ResNet USB Net- very powerful. It cannot use X, but it is
sizes. Some hold as much as 1 GB, work Tester) is a distribution based on based on directFB with the Sawfish
which would pose few limitations to the Slackware [5] that can work on a 128 Window Manager. It contains pro-
size of the on board operating system, MB USB memory stick. The distribu- grams such as Firebird, Java, and
but smaller sticks are less expensive and tion can be booted using a boot floppy Mplayer. SPB-Linux is a good project
(available on the site) that works also that is well documented.
Fabrizio Ciacchi (http://fabrizio. for ZipSlack [6]. RUNT is used mainly For this example, I chose to install Damn
THE AUTHOR

ciacchi.it) is an italian student of in network environments and contains Small Linux (DSL) [3] because DSL is
a lot of networking tools. the most flexible of the distributions I
Computer Science at the University • Feather Linux [7]: The Feather Linux found. Flonix and Feather Linux are
of Pisa. He also works as a consultant distribution is based on Damn Small based on it, and its size is about 50 MB,
Linux (DSL) [3] and is also suitable for so it would work for an even smaller 64
and writes articles on Linux.
a 128 MB USB stick. It’s not so differ- MB memory stick if necessary.

44 February 2005 www.linux-magazine.com


Memory Stick Linux KNOW HOW

Installing on a Stick make a backup of all partitions (ie. sdal, # cd dsl_usb/


The first step is to back up all the data sda2, etc.), then delete them all. When all # mv boot/isolinux/* ./
that is currently on the memory stick. the partitions are deleted, follow the # rmdir boot -r
Insert your USB stick, open a terminal, instructions in fdisk to create a FAT16 pri- # mv isolinux.bin syslinux.bin
and write: mary partition and make it bootable. # mv isolinux.cfg syslinux.cfg
The next step is to download the ISO # cd ..
$ su image of Damn Small Linux [12]. The
Password: - insert Root U size of the image is about 50 MB, so the The last part is very simple; mount the
password and press ENTER - download might take a while depending USB memory stick, copy all the data to
# mkdir usb_pen on your Internet connection. When you it, and, after umount, use the syslinux
# mkdir usb_backup have downloaded the file, open a con- program to make it bootable.
# mount -t vfat /dev/sda1 U sole, use the su command to log in as
usb_pen root, and go to the directory with the dsl- # mkdir usb_pen
# cp -a usb_pen/* usb_backup 0.8.3.iso file. Then execute the following # mount -t vfat /dev/sda1 U
# umount usb_pen commands: usb_pen
# cp -a dsl_usb/* usb_pen
Now that all your data is safety stored, # mkdir dsl_temp # umount usb_pen
you need to format your memory stick to # mkdir dsl_usb # syslinux /dev/sda
reduce your chances of encountering a # mount -o loop dsl-0.8.3.iso U
problem during boot. To perform this dsl_temp Now reboot your computer, leaving the
operation, give the following command # cp -a dsl_temp/* dsl_usb memory stick inserted, modify the BIOS
as root (when the pen is inserted but not boot device, and let the system boot to
mounted): At this point you have copied the content DSL on the memory stick.
of the iso image into a new directory so As I mentioned, this process only
# fdisk /dev/sda you can work on it. If you try to copy works if your computer can boot from a
this data directly to the USB memory USB device. In addition, a USB device
When fdisk starts, press p to see the list of stick, it will not boot because we need to with a non-standard Master Boot Record
all the partitions on your media (generally fix the position and the naming of files. (MBR) may have problems supporting
one), then press d to delete the first parti- With the console opened, enter the fol- system boot under Linux. See “Common
tion. If you have more than one partition, lowing commands: Problems” for more information. ■

Common Problems INFO


The most common problems you may face some of the portability benefits described [1] Knoppix homepage:
when implementing this system are: earlier in this article.You’ll find a floppy http://www.knoppix.net
• a BIOS that does not support (or is not image that supports USB boot at the DSL [2] Kanotix homepage: http://kanotix.com
configured for) USB boot; site [13].When you have downloaded the file,
[3] Damn Small Linux:
you can create a floppy, by typing this com-
• a USB device with a non-standard boot http://www.damnsmalllinux.org
mand as root:
system, so that it won’t boot even if you [4] RUNT: http://www.ncsu.edu/project/runt
have set up everything correctly. # dd if=bootusb-0.8.img of=/U
[5] Slackware: http://www.slackware.com
dev/fd0 bs=1024 conv=sync ; U
First of all, you need to check in the BIOS [6] ZipSlack:
sync
(usually you can enter into it by pressing del http://www.slackware.com/zipslack
or F1) if the USB-keyboard and the USB- Then shut down your computer, insert the [7] Feather Linux:
legacy options are enabled; then, you need USB memory stick and the floppy, turn on http://featherlinux.berlios.de
to insert your USB memory stick and check the computer, and select the floppy as the
[8] Flonix: http://www.flonix.com
in the boot device sequence if there is an first boot device in the BIOS.
option for booting from USB. (Boot from Zip [9] Puppy Linux:
Another possible problem, which is indepen- http://www.goosee.com/puppy
USB is sometimes a good choice.) Then select dent of whether you are booting to a floppy
the USB device as the first boot peripheral. [10]SPB-Linux: http://spblinux.sourceforge.net
or directly to USB, is that some USB devices
A USB boot option may not be available on may not support the booting procedure.This [11] Debian homepage:
some computers, since support for USB boot problem can be caused by a non-standard http://www.debian.org
was introduced only in recent years.You can MBR for the USB device. For this article, I [12] DSL ISO image:
bypass this problem if you use a boot floppy used a 128 MB Iomega Mini Drive http://ftp.belnet.be/packages/
that loads the USB modules and searches for (www.iomega.com), which worked properly damnsmalllinux/current/dsl-0.8.3.iso
the Linux distribution on the USB media. Of with a good transfer speed, but some of the [13] DSL USB floppy boot image:
course, carrying around a boot floppy with devices I tested did not support this boot http://ftp.belnet.be/packages/
the Linux memory stick isn’t as appealing as process.To address this problem, SPB-Linux damnsmalllinux/current/bootusb-0.8.img
booting directly from the memory stick, but provides a program that implements an [14] Alternative boot sector:
if your computer doesn’t support USB boot, alternative boot sector on the USB device to http://home.tele2.ch/spblinux/spbsetup/
this alternative option may still provide support USB boot [14]. Linux/spb2_mbr.sec

www.linux-magazine.com February 2005 45

Vous aimerez peut-être aussi