How to use USB Flash Drive as a RAM ? | ANONYMOUS TIM3

Virtual RAM or Virtual Memory is an inbuilt functionality of your Windows machine.








BUT WHAT ABOUT Linux ???


Alright, So it's not exactly RAM, but rather swap space. Simply put, when the OS runs out of physical RAM it uses the 'swap space, which is like RAM but on a hard drive. And because it's on a hard drive, it's really really slow.


SO LET'S DO IT 

Grab a USB stick, make sure there's nothing on it you need (as it will be deleted!), and follow these steps. 

1. Plug it in. If it automounts, unmount it.

2. Type:

sudo mkswap /dev/sdb1 (or whatever your device path is)

3. 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)



1. To make sure everything went well, type: 
cat /proc/swaps

2. If you need to take the stick out, type:

sudo swapoff /dev/sdb (or whatever your device path is) Automount as swap

1. First get the UUID of the drive by typing:

Is -/dev/disk/by-uuid/

2. Add following line to my /etc/fstab to
have it automount as swap:

UUID="id" none swap sw,pri=32767 0 0

NOTE: It's obviously not as fast as physical RAM, but it's a cheap and quick way to get a performance boost.


If you regarding any problem with this topic please send me messages on my social media link.


FOLLOW ME:   YouTube | Facebook | Instagram

Post a Comment

0 Comments