Skip to content

Instantly share code, notes, and snippets.

@Yonkokilasi
Created May 20, 2017 06:17
Show Gist options
  • Save Yonkokilasi/0713f78caa3515ec84aee09ee92f4cca to your computer and use it in GitHub Desktop.
Save Yonkokilasi/0713f78caa3515ec84aee09ee92f4cca to your computer and use it in GitHub Desktop.
This is a step by step guide to turning your USB stick into a sort of RAM for your laptop. I would recommend buying a physical RAM chip but this can suffice for now
Grab a USB stick, make sure there’s nothing on it you need (as it will be deleted!), and follow these steps:
Plug it in. If it automounts, unmount it.
Type: sudo mkswap /dev/sdb1 (or whatever your device path is)
Then type: sudo swapon -p 32767 /dev/sdb1 (the 32767 makes it a higher priority and will thus be used before the hard drive swap drive)
To make sure everything went well, type:
$ cat /proc/swaps
If you need to take the stick out, type:
$ sudo swapoff /dev/sdb1
Since I’ll be leaving this in the back of my desktop, first I got the UUID of the drive by typing:
$ ls -l /dev/disk/by-uuid/
And then I added the following line to my /etc/fstab to have it automount as swap:
$ UUID=35e61737-7418-4a6a-9d00-9ee18efc6832 none swap sw,pri=32767 0 0
It’s obviously not as fast as physical RAM, but it’s a cheap and quick way to get a performance boost.
Check your system memory. Your swap should now be extended by the amount of free space on the device. (swapon -s will show you all available swap areas).
Source : https://10pm.ca/using-a-usb-flash-drive-as-ram-in-linux-mintubuntu/
Source : http://lifehacker.com/274911/speed-up-your-linux-box-with-a-thumb-drive
Warning: Long term use of the usb as RAM will kill it .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment