Using USB flash as swap space.

Andrew Farris flyindragon1 at aol.com
Mon Aug 3 19:39:37 UTC 2009


On Mon, 2009-08-03 at 12:02 -0700, Ray Parrish wrote:
> Hello,
> 
> I recently read an article that states that using a USB flash drive as 
> swap space can help speed up a low memory system since the flash drive 
> is faster than a hard drive.
> 
> Could someone walk me through the list of commands needed to mount a 
> flash drive, and specify it as a swap space in Hardy?
> 

1. Install gparted (sudo apt-get install gparted). It will make
partitioning easier

2. Plug the flash drive in (probably someplace out of the way, since
it's going to become a permanent feature...and make sure its a USB 2.0
port, to get the full potential out of it)

3. Fire up gparted, select your flash drive from the dropdown in the top
right corner, right-click on the partition(s) listed in the bottom box,
and delete them all

4. right-click the newly empty space and say "Format To > linux-swap"

5. ...?

6. Profit! Or...swap-space...whatever.

> I would also like to know how to get it set up in fstab so it will 
> always work.
> 

Next, you need to find out the UUID of your new device... find out by
right-clicking on your new flash-drive swap partition(in gparted), go to
"Information", and copy the UUID listed there.

In order to get it to auto-work on boot, add the following line to
your /etc/fstab:

UUID=   none   swap   sw   0   0

where you paste the UUID you got earlier after the "=" in that line.
Then save, and next time you reboot with the flash drive in, it should
use it as swap.  To use the new swap space immediately use:
    swapon /dev/<your device ID>   i.e. swapon /dev/sdg1  (if your flash
drive was sdg1)

this page may be also be of some interest for further reading: 
https://help.ubuntu.com/community/SwapFaq 

best of luck!

-- 
Andrew
_____________________________
Registered Linux User: 473690
Registered Ubuntu User: 22747





More information about the ubuntu-users mailing list