33

Booting a Linux system off USB pendrives is one of my favorite things.

On a laptop we have the following advantages,

  • The hard disk drive can be shutdown and that reduces power consumption (hdparm)
  • The system heats less and the fans are triggered less frequently
  • The system can take more shocks (a bumpy backseat taxi ride)

With old workstation hardware,

  • Can be used for quick testing of the hardware platforms
  • Linux (Ubuntu these days) works quite well with most hardware
  • One downside: Many old motherboard BIOSes do not support a USB boot

I have preferred a USB "boot-stick" to a live CD in most cases.

Questions.

  1. What other advantages and problems have you seen or anticipate with a USB-booted Linux system?
  • What is your choice of Linux for this purpose?
  • Would you suggest ext4 or something more proven/stable for a Linux USB boot?
  • Do you often find USB drives getting corrupted?
  • Do you partition your USB drives?

Recent install guide reference, Ubuntu Karmic Koala Encrypted Flash Memory Installation (edited 2009-07-22).

This install guide is for installing Ubuntu 'Karmic Koala' in a USB flash memory stick with the LUKS encrypted ext4 file system by running the Ubuntu Karmic Koala 'Alternate CD'.

8 Answers 8

18

When booting off USB media, I would be careful of the following:

  1. Swap, unless you need it. Save the writes of the flash
  2. Keep the filesystem slim, and turn off SELinux/AppArmour unless you need it
  3. Tune the journaling and cache settings to get better performance

I have a USB key that I use to boot all my systems. It contains the kernel and bootloader with configurations for the machine. I also keep the encryption keys for my hard disk drives on it.

0
12

I've heard some people have concerns about write cycles with USB pendrives and most of the Linux filesystems, like ext3 which is set up to update the disk whenever a file is accessed. This can cause a lot of writing, specifically in the same area of the drive. Usually it is recommended to use the noatime option in order to fix this.

I created a USB drive Linux system for a team of robots - I used Debian which was selected because it was very easy to put it in a small space and I am familiar with it already. We've been running them for a while now and there has been no corruption so far. Even if there is corruption, as long as you have backups (we mirror to another drive of the same size periodically) you should be okay and it's not exactly expensive to replace.

I generally don't partition my USB drives, because I find it creates hassles. If I want a reasonable filesystem (with permissions, caps sensitivity, etc.) on a Windows-accessible drive I create a loop file to use.

2
  • Wow! Is that robots as in the moving things? or do you have some other interpretation involved here that I cannot catch.
    – nik
    Jul 16, 2009 at 18:06
  • 2
    They're real moving things. They are a larger version of these: distrob.cs.umn.edu/explorer.php
    – jamuraa
    Jul 17, 2009 at 17:50
6

I only have answers for the last three questions (I don't have professional experience with booting from flash drives).

Someone else mentioned that there are concerns about write cycles on flash drives. I've heard it be somewhere in the area of 100,000 writes and 500,000 writes. It's probably the latter. The problem with using ext4 or ext3 is that they're journaling filesystems. This means that the data is transferred to the storage device, stored there and then written to the proper place on the storage device. This way, if the full write is incomplete and the computer crashes, the storage device has a copy and can continue writing. This will reduce the lifespan of your flash drive, specifically, whatever part is being used as the journal. I would recommend using a non-journaling filesystem for this purpose, such as ext2.

I haven't had a USB drive get corrupted. The write limit I mentioned above was per memory unit. With that being said, they build in backup memory units to be used when one dies. On top of that, even the low end estimate I heard, 100,000 writes, will take a while to reach. If you wrote to one memory unit eight times per day every day, it would take over 30 years to kill a memory unit. With that being said, sometimes Live USB installs will use a portion of the USB stick as memory if the system doesn't have enough RAM or if it is unsure of how much RAM it will have access to later, although this is almost always just done with live CDs to simulate saving data such as web browser history. Since this is a Live USB, it can just save that data permanently. With all that being said, keep in mind that a memory unit isn't a single byte, but some number of bytes which is determined when the flash drive was designed.

I myself have had problems partitioning a USB drive, but it is possible.

Correction: In the second portion I refer to a process by which a flash drive uses itself for RAM and then refer to something similar for live CDs. For live CDs, they use what's called a RAM drive where they use the system's RAM as a virtual hard disk to "save" files such as browser history. What I described for flash drives may not actually exist. It may have been a small bit of confusion on my part where I was thinking of Windows Vista's ReadyBoost.

1
  • @indy, Thanks for your detailed reply. I will want to check if Jaunty Ubuntu (what I use) can be installed on ext2 nicely. Would like to add one more thing -- USB Wear Leveling usually keeps the writing uniform across the drive so one 'spot' on it does not get worn out faster than the rest of the drive, killing it faster.
    – nik
    Jul 24, 2009 at 15:40
4

I like Puppy Linux, though I haven't played around with it for a while. It's fast, even on underpowered machines. It also has (or had) built in easy network wizards, etc. to get online fast. I am not sure how easy it is to hack if you run into difficulties—I never delved that deeply into it.

2
  • There is also DSL, damnsmalllinux.org
    – nik
    Jul 16, 2009 at 18:04
  • Puppy is very useable, it even has a download/update option now. But Gb USB keys are cheap enough to just run a full ubuntu live image on. Jul 24, 2009 at 17:13
3

One downside I've come across is often if you boot Linux from a USB drive you carry with you, it's harder to get online on a PC that isn't yours. Especially if the PC is wireless, in my experience the owner will often have trouble remembering things like wireless keys.

I have a USB with Ubuntu on it which I use occasionally to fix broken machines and stuff like that, and this is the most common problem I have. I can't quite remember the detail of the command I want to do something, and I can't get online to check it out.

1
  • 1
    You are right about the wireless access point hurdle. And, I recently caught a bad memory stick with a quick memtest from a Ubuntu usb-boot.
    – nik
    Jul 15, 2009 at 10:06
1
  • What other advantages and problems have you seen or anticipate with USB booted Linux?

Disk access is slow. Very slow. And unreliable. The moment your key moves too much, you witness first hand the practical effects of a successful, immediate rm -rf /.

On the other hand, USB drives are pretty much the only way to really test the latest developments in GNOME. Gnome Shell runs horribly in a virtual machine, while Unity refuses to launch without 3D acceleration.

An USB install allows you to testrun a bleeding edge system directly on your hardware without littering your "main" install in the process.

  • What is your choice of Linux for this purpose?

It doesn't really matter. I have a USB key with Arch Linux (which does not run a graphical environment) and a USB key with Ubuntu 11.04 alpha with compiz-powered Unity. They both run reasonably well, although apt is much slower than pacman when it comes to applying updates.

  • Would you suggest ext4 or something more proven/stable for a linux usb-boot?

ext4 works well; ext3 would do also. I suggest against non journaled filesystems, however.

  • Do you often find USB drives getting corrupted?

I haven't yet, but I can't say I used them much.

  • Do you partition your USB drives?

I have partitioned one of the two to keep a small FAT32 partition for when I need to use my key to, uh, store data. It didn't cause any particular problem.

1
  • Your notes on performance (speed) with the USB install are on mark -- but, I suggest you try some ext2 installations (w/o journaling) and consider turning off some things (like SELinux/AppArmour as suggested in one of the other answers here). You don't need too much safety on a test system and you can always keep a full backup against corruptions.
    – nik
    Dec 19, 2010 at 4:16
1
  1. Advantages of USB bootable sticks: you can boot any number of systems off a single pen drive if you use e.g. grub4dos, including booting physical ISO files located on your flash stick - either mapped to RAM or directly from the disk (file should be in one contiguous block). Potential problems: booting from ISO files not supported for all distros; some distros would not even boot on exotic or non-typical hardware. With grub4dos you can also easily boot from floppy boot images which is also the way some bootable CD/DVD discs use. Another disadvantage is that reading multiple small files from USB flash drives might be painfully slow. With external USB HDD drives speed is much higher.

  2. Choice of Linux distros: PartedMagic, PuppyLinux, DamnSmallLinux, lubuntu, xubuntu, BartPE, Hiren's Boot CD, Windows installation files.

  3. File system: ext4 or other: FAT32 works the best if you want flexibility and multiple operating systems, e.g. both Linux- and Windows-based OS's on the same stick.

  4. USB getting corrupted: never had this happening; but mostly using boot USB sticks for rescue purposes and not as a regular environment.

1

Question 1: Mostly updating the kernel and stuff like that is harder...

Question 2. Any Linux system can be a decent live USB, but SliTaz is light, fast and is the only Linux distribution that could be remade into an hard drive installation, a live CD, a live DVD or a live USB easily while keeping all the settings added ... (old but decent, I always have my boot floppy, my boot CD and my live USB to help people and teach them some Linux love...

Question 3. I would use ext3 that is journalized for security and because it can be read in Windows if needed...

Question 4. I have not seen that issue if the USB key is removed correctly, but I seen it a lot when peoples remove it without the proper removal technique...

Question 5. Maybe to make it a multiboot USB key...

Important: If you can understand basic French, I would go directly to the Framakey Ubuntu-fr Remix USB key installation package that is the most advanced premade USB key for now, waiting to be translated if you want to help them it's really worth it. I use it a lot!

Maybe you could switch Ubuntu language easily to English...

Framakey ubuntu-fr remix:

Portable applications for Windows and Mac Ubuntu 9.04 (Jaunty Jackalope) persistent live USB shared profiles between applications virtualization stuff in option.

(Add Windows and Mac live USB to that and it's the paradise!)

1
  • Thanks for your notes. I have no trouble updating the Ubuntu (kernel included) on my USB flash. About Windows access, I expect that will be done soon and it does not really bother me much. Interestingly, I have found that a ext2 USB boot flash was unplugged multiple times without a persistent failure (it recovered). And, Je ne comprends pas français.
    – nik
    Sep 1, 2009 at 6:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .