Creating A Ram Disk

Ram disks can be quick a neat quick file system. If you have enough ram you can place several files in a ram disk and have very fast write and read access to them. This is especially useful for something such as website files or database files.

One downside is that if the system crashes or reboots during use any contents within the ram disk will be gone.


For this example I will be using a ram disk of 50MB...use your own discretion...the more ram you have available the bigger you can make it


In a terminal enter the following:


sudo mkfs -q /dev/ram1 51200 ...1MB is 1024 bytes....1024x50=51200
sudo mkdir -p /ramcache
sudo mount /dev/ram1 /ramcache
df -H | grep ramcache


You should see that the ram disk is mounted and showing 50MB space available


You can now create copy or move files like you would any file system


To remove the ramdisk simply sudo umount /ramcache


If you unmount and did not reboot you can remount the ramdisk and your files will still be there. However even if you unmount it the kernel will not use the ram taken up by the ramdisk. You have to reboot to get back 100% of your ram