us ua ua


Using tmpfs on the FreeBSD ZFS Operating System

Tmpfs was implemented in NetBSD version 4.0, September 10, 2005. Tmpfs was ported from NetBSD to FreeBSD from version 7.0.
Tmpfs mounts the file system into RAM. Since upon restarting the computer all data in tmpfs will be lost tmpfs is used to store temporary files in RAM. Due to which the speed of applications increases. After all, RAM is faster than a hard drive.

To use tmpfs on the FreeBSD operating system installed on ZFS, do the following:
In the file /boot/loader.conf add:


Add the following line to the /etc/fstab file:

tmpfs / tmp tmpfs rw, mode=1777, size=1024M 0 0

We indicate the size depending on the amount of installed RAM.
Mode=1777 access rights, recording is allowed to all users.

To use tmpfs without rebooting, load the tmpfs module with the command:

kldload tmpfs

Next, mount the file system into RAM using the command:

mount -t tmpfs -o rw, mode=1777, size=1024M tmpfs / tmp

In order for tmpfs to work even after rebooting, you need to destroy the /tmp file system in zpool with the following command:

zfs destroy zroot /tmp

If the command produces an error, then:

zfs destroy -f zroot/tmp