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 ?

  • 1
    The canonical way to do this is to simple add a partition of swap type. You can use gparted or other methods to do that. I think that is the reason your answer has been downvoted.
    – alfC
    Mar 20, 2014 at 7:34

1 Answer 1


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.

By Making Partition

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 :

sudo gparted

Choose the unallocated item in the list of partitions and click New button seen in top left corner : gparted new partition dialog

Make the options like below except for the size (you can choose the amount of size using for swap) : enter image description here

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.

By Making SWAP File

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 :

free -m

You will get a result like below : free -m

As shown in the picture you can see the extra SWAP space. Mission Accomplished.

Source :- http://subinsb.com/how-to-use-hard-disk-as-ram-in-ubuntu-linux

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.