Wouldn’t it be awesome if we could extend our ram to some extent that can complete our tasks without any step-backs?
It’s was about yestarday, I was running over 4 different servers on my docker that lead to crash my linux system and made me think about extending ram.
It’s frustating when we sit here for a whole day work on different things and all of sudden your PC crashes.
Then I browsed for RAM for my PC, then realised that we can extend this storage upto 12GB of ram. With disappointment, I was looking into my system monitor and I saw something called “Swap Memory”, (It’s actually a virtual memory). For those of you who don’t know,
Virtual memory is actually your hard disk’s memory but reserved to use them as RAM incase there’s load in your system.
That made me think to “why don’t I extend this Virtual RAM(swap memory)?”
After running few commands, it’s working so well without any lag or slowdown in the system.
CAUTION: if we set this swap memory as priority, this may slow down your system because RAM is way too faster than Virtual RAM
here are the steps and commands for Ubuntu and can work on any Ubuntu:
1. Open your Terminal, and Type ‘swapon --show’
this shows about your current swap memory. Take a note of your swap name!
2. You need to turn off your swap file by : ‘sudo swapoff /swap.img’
the name can be different for systems. Look at your swap file name and replace them “sudo swapoff /<file name>
3. Then you need to allocate the space that you want to by ‘sudo fallocate -l 10G /swap.img’
don’t forget to change the size and image name to yours! ‘10G’ to (some-space)G
4. Then you need to wipe the old swap by ‘sudo mkswap /swap.img’
5. Now turn on your new swap file by ‘sudo swapon /swap.img’
6. After executing these commands, type ‘swapon --show’ to see your new swap memory status.
That's It! That's how you increase the swap memory in your ubuntu!





