by Max Spevack
Fresh, free, and featherweight: the all-new Fedora 8 on a USB key.
I am writing this article on a Windows laptop borrowed from a friend. But fear not, dear reader, for I have not abandoned my free software principles. For while the hard disk of this laptop contains the Windows operating system, I have used a USB key as the boot device, and the laptop is currently running Fedora 8, codenamed “Werewolf.”
When I am finished, I can unplug the USB key, power off the machine, and hand the laptop back to its owner. I’ll have my entire distro in my pocket, and when the laptop’s rightful owner powers it back on, the computer will behave as always.
The following walkthrough will enable you to run Fedora 8 from a USB key.
In order to complete this walkthrough, you need:
- a computer with Fedora 7 or Fedora 8 installed on it.
- root access on that computer.
- basic command-line knowledge.
1. Acquire a USB key
The basic desktop version of Fedora 8 will fit on a 1 GB USB key. The “developer” version of Fedora 8 will require a 2 GB USB key. Pretty much any brand of USB key should work. I use the PNY Attache ones — they work well and can be found for a relatively cheap price.
2. Acquire a Live image
The Fedora Project releases both live and installable images of the Fedora distribution. In order to run off of a USB key, you need one of the live images — this means that the entire distribution is loaded into the computer’s memory and runs without touching the hard disk at all.
3. Install livecd-tools
On your current Fedora machine, install the livecd-tools package, either via the graphical
add/remove software application or by using yum directly on the command line. Note that this step requires you to have root access!
su -c 'yum install livecd-tools'
4. Figure out where your USB key is mounted
Plug in your USB key and the system should automatically mount it for you. All you need to do is make a note of the device name that was chosen when you plugged the USB key in. To do so, open up a terminal and run the following command:
df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 35G 6.8G 26G 21% / /dev/sda1 99M 19M 76M 20% /boot tmpfs 501M 12K 501M 1% /dev/shm /dev/sdb1 2.0G 0 2.0G 0% /media/disk
In this case, the bottom line is the one that is important–you’ll want to find the line that is correct for your system, and remember the first part. /dev/sdb1 will be used for the rest of this article. You should use whatever result is displayed for your machine.
5. Copy the image onto the USB key
Now you have everything you need — the livecd-tools package is installed, the image that you want to use has been built or downloaded, and your USB key is plugged into the computer. All that is left to do is run one more command: livecd-iso-to-disk. The command’s name is pretty self-explanatory. The first argument is path to the live image, and the second command is the location of the USB key, which you discovered in the previous step. Note that this command requires root access!
su -c 'livecd-iso-to-disk /path/to/Fedora-8-Live-i686.iso /dev/sdb1' Verifying image... Fedora-8-Live-i686.iso: 17d675e98a44754d41ba0d93f485ffa3 Fragment sums: 7dba468e8adf87c776ae4a15a871426ba74dba1187adb2a6807c1e124a34 Fragment count: 20 Percent complete: 100.0% Fragment[20/20] -> OK 100.0 The media check is complete, the result is: PASS. It is OK to use this media. Copying live image to USB stick Updating boot config file Installing boot loader USB stick set up as live image!
Reboot your computer, and when the BIOS starts up, make sure you tell it to boot off of the USB key and not the hard disk. Usually the screen will flash a message that says something like “press F12 to bring up boot device list”. On some machines, you have to press the DEL key instead.
That’s it. Wait for the machine to finish booting and at the login screen click on “Fedora Live” and you are automatically logged in (or just wait 60 seconds for the automatic login to trigger).
The USB key that you have just configured only contains the operating system. It does not store any of your personal data on it. I recommend that you carry around a second USB key for saving data. Most laptops have more than one USB slot, so it is easy to plug them both in. Boot off of the first key, and then before you shut down the computer, save all of the stuff you worked on to the second key.
About the author: Max Spevack does stuff at Red Hat.