• Linux
  • FreeBSD
  • Networking
  • Python
  • AWS
  • WebDev
  • About Us

How to create RAM disk in FreeBSD

Written by
FreeBSD Leave a Comment

RAM can be used as temporary storage in FreeBSD, offering much faster performance compared to traditional hard drives. However, since RAM is volatile memory, this storage won’t persist through a shutdown or a sudden power loss. In a production environment, you might need a temporary RAM disk to store temporary data without interrupting the actual drives. This is particularly useful in scenarios like FreeBSD-based routing equipment or firewalls.

Create the mount point :

mkdir /diskmnt

Mount ram disk to the mount point , you can specify the size of the disk , I used only 100 MB here .

/sbin/mdmfs -M -S -o async -s 100m md5 /diskmnt

You can vrify by :

df -h

To remove the disk:

umount /diskmnt

You need to release the RAM resource if you are not using it :

mdconfig -d -u 5

You can make the disk permanent by adding the entry in the fstab:

© Copyright 2020.TechieNix. All Rights Reserved.