There is an easy way to use Hard Disk as RAM in Windows machines.
Is there a way to use Hard Disk as RAM in Ubuntu ?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Note : Using Hard Disk as RAM can be slow. It is recommended to use External fast Devices like flash memory to use as SWAP space. On my computer that has RAM of 875 MB, when I disabled SWAP usage, computer became fast. It's recommended that you follow this answer only if you have a speedy good Hard Disk.
If your hard disk has free unallocated space, use this method.
If your system doesn't have gparted installed, install it using the command :
sudo apt-get install gparted
Open gparted by doing the command :
Choose the unallocated item in the list of partitions and click New button seen in top left corner :
Make the options like below except for the size (you can choose the amount of size using for swap) :
After choosing the options, click on Add button. It might take some time to create the new swap partition.
After finishing, right click on the new partition item and choose swapon. Now swap is enabled.
I found out an AskUbuntu answer of using USB sticks as RAM. I did the same trick on Hard Disk and it works !! This trick can be accomplished with the use of some small commands in Terminal.
So, Let's begin. Create a file of 512 MB (The 512 indicates the RAM memory to be added):
fallocate -l 512M ~/swapfile
The bolded number above shows the size of the file we're going to create. Examples :
256M - 256 MB
1G - 1 GB
Example of 1 GB :
The command will become :
fallocate -l 1G ~/swapfile
The command will create a file named
swapfile in your home directory of size 1 GB.
Now let's create the SWAP space on the file and enable the SWAP :
sudo mkswap ~/swapfile -f && sudo swapon -p 1000 ~/swapfile
Your RAM Memory is now increased. To check whether if it is increased, do the following command :
You will get a result like below :
As shown in the picture you can see the extra SWAP space. Mission Accomplished.