Skip to content

Ramdisk

How to create a Ramdisk in Linux using Tmpfs

First see the free memory we can use

Bash
$> free --giga

Next create a mount point under the directory /mnt

Bash
$> sudo mkdir /mnt/tmp

Now create the ramdisk using the mount command.

Bash
# Make a ramdisk using tmpfs or ramfs on a 2GB Ram/Swap on the mount point /mnt/tmp
$> mount -t tmpfs -o size=2g tmpfs /mnt/tmp

Unmount Ramdisk

Bash
$> umount /mnt/tmp