RSS

Readyboost for Linux - a quick how to on getting more speed from a USB flash drive

Thu, Jul 24, 2008

Linux, Ubuntu, howto

Talk about it in our Forums

Readyboost for Linux - a quick how to on getting more speed from a USB flash drive

Readyboost for Vista is a feature added to the OS where you can encourage your limping Vista install to jog a bit faster by essentially using a smallish USB drive as disk cache.  There’s also some Vista Voodoo with Superfetch going on there.

While Ubuntu (the distro that I use) and other distros don’t really use Superfetch, you can still get an advantage using the disk cache functionality - particularly if you’re running on a system that doesn’t have a ton of RAM available. This tutorial is written with Ubuntu in mind but can be easily modified to use with just about any distro.  And yes, there’s some command line stuff.  No, it’s not as guified as Vista.

<br />First, stick the USB drive into an open USB slot. Make sure it’s a drive that you don’t mind overwriting.

Ubuntu should mount this automagically in /media/disk.  You’ll probably also get a nifty icon on your desktop.

To unmount this  - open up a terminal session (Applications-> Accessories-> Terminal) and type

mount

Now look to see where your USB drive is mounted.  In Ubuntuland it’s usually under /media/disk or /media/usbdisk.  On my system it’s mounted like this:

/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)

The easy way to tell if this is the correct disk is to run the mount command before you stick it in your USB slot and then after.  The newest mount - well that’s the one you want.

To unmount this, type:

sudo umount /dev/sdb1

Of course, change the /dev/sdb1 bit to reflect what’s on your system.

Now, we’re going to create a swap file on the unmounted USB drive.  In my case I’ll type:

sudo mkswap /dev/sdb1

Again, change the /dev/sdb1 bit to what you say when you ran the ‘mount’ command earlier.

Now that I’ve filled this drive with a swap partition, it’s time to turn it on and give it high priority.

sudo swapon -p 32767 /dev/sdb1

That turns the swap partition on, with a priority (-p) of 32767.  Why 32767?  Well that’s the highest priority available.  Here’s the documentation if you’re interested.

You can double check that you did everything correctly by checking the /proc/swaps file:

cat /proc/swaps

My output is as follows:

Filename                Type        Size    Used    Priority
/dev/sda5                               partition    3229024    0    -1
/dev/sdb1                               partition    1981928    0    32767

You can see I have about 2GB of swap space allocated on /dev/sdb1

This won’t give you a huge speed boost on higher memory machines but if you’re using a laptop with only 512 megs of RAM you should see a noticable difference.

Technorati Tags: , , , , , , , ,

Click the icon, share the link:
  • Digg
  • del.icio.us
  • MisterWong
  • Furl
  • Reddit
  • Technorati
  • BlinkList
  • feedmelinks
  • PopCurrent
  • Blogosphere News
  • Facebook
  • Fark
  • Mixx
  • Slashdot
, , , , , , , ,

This post was written by:

arsgeek - who has written 1975 posts on ArsGeek.


Contact the author

4 Comments For This Post

  1. John Says:

    Hey! This was a really kickArs tutorial! I plugged an old Gigstick into an older 256 Meg trashable laptop and saw an impressive improvement. Thank you.

  2. arsgeek Says:

    USB Flash drives. Is there nothing they can’t do?

    Glad the article helped.

    Ben

  3. Prasinos Says:

    Your article is misleading. You are confusing disk caching with swap. Readyboost is (or tries to be) an intelligent disk cache (for files that are frequently accessed). Swap has to do with memory management (making programs believe that they have more memory available).
    Linux already does good caching of disk data in memory (you can see that by running “free”). You may see some speed improvement by using a swap file on a usb stick, but it is much better to add some ram (especially if your system uses swap often).

  4. aendruk Says:

    Prasinos is right.

    On a somewhat related note, curious readers may be interested in readahead: http://www.google.com/search?q=ubuntu+readahead

Leave a Reply