Archives

Categories

USB Flash Storage

For some years I have had my Internet gateway/firewall system in a cupboard in my bedroom. While I don’t mind some computer noise (I’ve slept near a server for most of the last 22 years) it’s good to have it as quiet as possible so getting rid of the hard drive is desirable.

I considered buying an IDE flash drive, but I’d like to continue my trend of not paying for hardware so I chose to use some USB flash devices that HP was giving away at a seminar (thanks HP – as an aside the P3 system is an old Compaq Desktop system). So I’ve got one 4G USB device for root and one for Squid.

For the past few months I’ve had /var/spool/squid be a USB flash device. I considered using RAID-0 for that filesystem because the computer is a P3 and only has USB 1.2 and thus a maximum theoretical transfer rate of 1.5MB/s and a maximum real-world rate of about 1MB/s. But my ADSL connection doesn’t seem able to sustain much more than 1MB/s and Squid doesn’t write data synchronously so in all my tests the USB speed hasn’t affected HTTP performance.

One issue that has delayed my move to all USB is the difficulty of booting as the P3 system in question doesn’t support booting from USB. I considered creating a boot CD that loads the kernel from the USB device, but that seemed a little painful and also relies on the CD-ROM drive working – which isn’t a great idea for a system that runs 24*7 in a dusty cupboard. I ended up using GRUB on the IDE hard drive to load the kernel and initrd and then mount a USB device as root, this seems to work and the command “hdparm -S6 /dev/sda” in /etc/rc.local makes the hard drive go to sleep once the system is booted.

The only technical parts of the process were putting in the UUIDs of the filesystems in /etc/fstab (because I can’t be sure which USB device will be found first) and creating a new initramfs with modules for USB storage listed in /etc/initramfs-tools/modules so that a USB device could be the root filesystem.

The firewall system is now a bit quieter and based on my last tests of hard drive power use will probably dissipate about 5-7W less heat. The next thing to do is wait and see if it keeps running or falls over. ;)

Update

I gave up on this 10 weeks later after 2 of the USB flash devices died.

9 comments to USB Flash Storage

  • Dontbo Therme

    For booting old trash via contemporary means, you could try PLOP from http://plop.at
    Works for me, even with PCI-USB-Cards.

  • ssam

    have you tried using a compact flash card. they are electrically compatible with IDE, so you just need a cheap pin converter.

  • etbe

    Dontbo: Thanks for the reference, the PLOP boot loader has some nice features. But as an IDE disk seems like the best boot device for the system it seems that the current system that I have implemented is as good as it gets.

    ssam: I haven’t tried that. I don’t own any CF cards that are big enough and don’t plan to buy them. I have used embedded systems that have motherboard sockets for CF cards which make them look like IDE disks and they work reasonably well. The only CF problem I’ve had is some CF cards larger than 2G capacity won’t work on the embedded motherboards I’m using. Fortunately that project only really needs 2G of storage.

  • Santiago Garcia

    What filesystem are you using for the flash drives? have you thought on using jffs?

  • etbe

    JFFS is designed for low level access to flash storage which involves control over erase blocks. It doesn’t work on anything that resembles a regular storage device (IE a USB or CF device). Regular filesystems such as Ext4 (which I am using in this case) don’t work on low level flash access such as is provided on the iPaQ and other systems that use JFFS.

    So you never have a choice of whether to use JFFS(2) or not, you are either forced to use it or unable to use it.

  • Santiago Garcia

    So… jffs needs something like the mtd devices and you cannot use it on a sda, is that it?

    I’ve been using jffs2 on routers for years and I hadn’t realised of this difference till now.
    In fact, I’ve always been wondering why people wasn’t using it more, now I know why :-)

  • rjc

    @Santiago:

    That makes two of us.

  • Craig Sanders

    FYI, you can get a SATA2 Patriot Torqx2 32GB 2.5″ SSD for $60 from MSY. 64GB is $15 more. They support TRIM, so work well with ext4 or xfs and a weekly or monthly ‘fstrim /’ cron job.

    32GB seems to be the smallest SSD size available.

    I’ve been booting my main system off a 128GB Torqx2 for nearly a year now with no dramas – the entire OS including /var are on the SSD (bulk data storage is on my ZFS pools). That includes /var/log, /tmp, /var/spool/squid, and regular debian sid dist-upgrades.

    $60 for an SSD is a lot more than the cheap (or free) 1GB and 4GB USB sticks you’re using, but they are designed to be used 24/7. cheap USB sticks aren’t.

    If your old Compaq P3 doesn’t have a SATA interface, PCI or PCI-e cards are cheaply available or fairly easily scrounged for free.

  • etbe

    Craig: AFAIK no-one ever made a P3 system with SATA support. The early P4 systems all had only IDE, SATA was supported in some of the later Celerons (around 2.4GHz) and later P4 systems.

    Getting a SATA PCI card for a P3 system would be impractical as P4 systems are free and I’ve got a bunch of 2.4GHz Celeron systems with SATA support lying around. So that would really drive replacing the entire system with something that uses a lot more power thus removing one of the benefits from using flash storage.

    However that price is quite appealing. I might consider doing that for some reasonably new workstations which have SATA on the motherboard to reduce the noise.