With these simple directions you'll be able to use a USB pen prive as an additional swap. As a result, the pen drive will be used in the same way Windows Vista does through the ReadyBoost functionality.
1) Plug the pen drive in your usb slot, usually in front of your tower or side/back of your laptop.
2) Ubuntu should auto-mount the device (usually in /media/usbdisk*), umount the device (ie., sudo umount /media/usbdisk);
3) Find your usb device in your terminal by typing sudo df -h; in this example we will use /dev/sda1
4) sudo mkswap /dev/sda1 (assuming /dev/sda1 is the correct device for the connected usb device)
5) sudo swapon -p 32767 /dev/sda1
Ok now you are using the usb device for swap; when your ram is exhausted it will start using your usb device for ram
To verify that everything is working correctly do a;
This is the output I recieve on my Desktop;
/dev/sda5 partition 1646620 33952 -1
Just a note:
You will not recieve the same performance as ram, it all depends on the speed of your usb disk, you will notice a big difference in running games, development studio's, audio/video editing and memory hogs like firefox/openoffice.
To turn ReadyBoost for Ubuntu off in a terminal type:
sudo swapoff /dev/sda1