tmpfs is a temporary filesystem that resides in memory and/or your swap partition(s), depending on how much you fill it up. Mounting directories as tmpfs can be an effective way of speeding up accesses to their files, or to ensure that their contents are automatically cleared upon reboot.

By default, a tmpfs partition has its maximum size set to half your total RAM, but this can be customized. Note that the actual memory/swap consumption depends on how much you fill it up, as tmpfs partitions do not consume any memory until it is actually needed.
To explicitly set a maximum size, in this example to override the default /tmp mount, use the size mount option:

tmpfs /tmp tmpfs nodev,nosuid,size=4G 0 0

The tmpfs can also be temporarily resized without the need to reboot:

root# mount -o remount,size=6G,noatime /tmp

To find a filesystem at /proc/mounts of /tmp use findmnt which will list all mounted filesytems or search for a filesystem. The findmnt command is able to search in /etc/fstab, /etc/fstab.d, /etc/mtab or /proc/self/mountinfo. If device or mountpoint is not given, all filesystems are shown.

root# findmnt --target /tmp
/tmp tmpfs tmpfs rw,nosuid,nodev,relatime

Leave a Reply

Your email address will not be published. Required fields are marked *