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;
cat /proc/swaps
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
This is nothing like readyboost. For one, my Ubuntu installation doesn't swap out to disk because I have 4GB of RAM. For another, just adding more swap space is NOT going to give you added performance.
ReplyDeleteThis is exactly what ReadyBoost does. The reason it gives you added performance is because flash storage is faster for random reads than regular storage. If your RAM is exhausted you will get better performance from USB 2.0 swap space than regular harddrive swap.
ReplyDeletehow to you make it constant though? i have a swap already with priority -1
ReplyDelete