Create a ramdisk under Debian / Linux
For those with too much memory or special application purposes, creating a ramdisk under Linux might be worthwhile. The creation of a ramdisk under debian can be accomplished via tmpfs.
For this, however, a new folder must first be created on the filesystem:
mkdir /ramdisk/
To create a 16GB ramdisk under the path “/ramdisk/”, the following command must be executed:
mount -t tmpfs -o size=16G ramdisk /ramdisk
To delete the ramdisk again, the following command can be used:
umount /ramdisk/
The write speed can be tested with this command:
dd if=/dev/zero of=/ramdisk/zero bs=4k count=100000
and read speed with:
dd if=/ramdisk/zero of=/dev/null bs=4k count=100000
To set up the ramdisk automatically at boot time you must
vi /etc/fstab
be executed and the following line added:
ramdisk /ramdisk tmpfs defaults,size=16G,x-gvfs-show 0 0
Don’t be surprised that the memory is still shown as free. This is because the RAM will not decrease until you have actually moved data to the ramdisk.