A RAM disk or RAM drive is a block of system memory that the operating system is treating as if it were a hard drive. It is sometimes called a “virtual RAM drive” or “software RAM drive” to distinguish it from a “hardware RAM drive” witch uses separate hardware containing RAM, i.e. solid-state drives.
There are several benefits to using RAM Disks over normal Hard Drives, the first being the performance increases that RAM Disks have. Hard Drives are probably the slowest memory we use in our computers, however the memory is some of the fastest memory we have, therefore ram disks are considerably faster than normal Hard Drives. The other major benefit is security, normal hard drives use non-volatile storage disks, the problem with this is that its possible to find out what information was on the disk even if its been deleted. However RAM is volatile memory witch means that it needs power to store data, as soon as this power goes (when you turn off your computer) all data irreversibly erased from the memory thus stopping anyone reading the data using forensics technics.
So why would we want to use RAM Disks, as we mentioned before RAM Disks are extremely fast so they are vary good for high throughput applications or when we need to create data at extremely high speed (i.e. Real Time Systems), however there is on downside to this, we don’t normally have a lot of memory in our computers, often 4GB is all we have and after our everyday tasks are running we don’t have much memory left for storage.
So if we cant store a lot of data in RAM Disks what are they good for, well they are best used for their security advantages. When we unencrypt a file we don’t want it going onto the hard drive, this is because someone may be able to read the file using hard drive forensics techniques, therefore if we decrypt a file onto a ram disk then restart the computer it will be impossible for anyone else to read the information contained in that file. The same is also true when encrypting files, if we want to create a message and encrypt it, its best done on a ram disk as we can delete the plain text file when we are done then restart the computer, destroying the message in its unencrypted from.
Now I’m sure you want to know how to do this, well if you using Ubuntu (8+) then you should already have a ram disk mounted, Ubuntu calls it tmpfs and its usually mounted on /dev/shm, call you need to is use this folder and you’ll receive all the benefits of the ram disk, to find the size of this partition type:
df -h /dev/shm
Most other Linux distros will create some small ram disks by default although they are currently un-active so not using any of your ram, to see them type:
ls -l /dev/ram*
This should show a list of all the RAM Disk mount points, now to find the size of these disks:
dmesg | grep RAMDISK
I know its small but your system has to save memory for other things like running every program you currently have open, anyway if your only encrypting messages their should be loads of space. Now you’ll need to format one of the ram disks:
mke2fs -m 0 /dev/ram0
Now Create a folder then mount the ramdisk to it
mkdir /mnt/ramdisk mount /dev/ram0 /mnt/ramdisk
now you can use /mnt/ramdisk as your ram disk.
If your computer is running low on memory you may be using swap memory, which uses the Hard Drive, if you want to be sure that your unencrypted file does not touch the hard drive you can turn the swap off, to do this type:
Please leave any Comments or Questions.