Create a ram disk in Linux

Sometimes a ram disk can be useful to lower file access latency. This script will create a 120 Mb ram disk in a Linux environment.

dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
mke2fs -q -m0 /dev/ram0
mount /dev/ram0 /mnt/ramdisk







It should be noted though that ram disks are highly dependent on continous power supply. If power is lost and the server shuts down then all files on the ram disk are gone.

Tags: