---
name: "tmpfs"
section: "4"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/tmpfs/4"
---

# tmpfs(4)

in-memory file system

## NAME

**tmpfs** – in-memory file system

## SYNOPSIS

To compile this driver into the kernel, place the following line in your kernel configuration file:

**options TMPFS**

Alternatively, to load the driver as a module at boot time, place the following line in [loader.conf(5)](/loader.conf/5.md):

```
tmpfs_load="YES"
```

## DESCRIPTION

The **tmpfs** driver implements an in-memory, or **tmpfs** file system. The filesystem stores both file metadata and data in main memory. This allows very fast and low latency accesses to the data. The data is volatile. An umount or system reboot invalidates it. These properties make the filesystem's mounts suitable for fast scratch storage, like */tmp*.

If the system becomes low on memory and swap is configured (see [swapon(8)](/swapon/8.md)), the system can transfer file data to swap space, freeing memory for other needs. Metadata, including the directory content, is never swapped out by the current implementation. Keep this in mind when planning the mount limits, especially when expecting to place many small files on a tmpfs mount.

When [mmap(2)](/mmap/2.md) is used on a file from a tmpfs mount, the swap VM object managing the file pages is used to implement mapping and avoid double-copying of the file data. This quirk causes process inspection tools, like [procstat(1)](/procstat/1.md), to report anonymous memory mappings instead of file mappings.

## OPTIONS

The following options are available when mounting **tmpfs** file systems:

- **easize**

  Set the maximum memory size used by extended attributes in bytes. The default is 16 megabytes.

- **export**

  Accept the **export** option for compatibility with [nfsv4(4)](/nfsv4/4.md). This option does nothing.

- **gid**

  Set the group ID of the root inode of the file system. The default is the mount point's GID.

- **inodes**

  Set the maximum number of nodes available to the file system. If not specified, the file system chooses a reasonable maximum based on the file system size, which can be limited with the **size** option.

- **maxfilesize**

  Set the maximum file size in bytes. The default is the maximum possible value.

- **mode**

  Set the mode (in octal notation) of the root inode of the file system. The default is the mount point's mode.

- **nomtime**

  Disable the tracking of mtime updates caused by writes to the shared mapped areas backed by **tmpfs** files. This option removes periodic scans, which downgrade read-write-mapped pages to read-only to note the writes.

- **nonc**

  Do not use namecache to resolve names to files for the created mount. This saves memory, but currently might impair scalability for highly used mounts on large machines.

- **nosymfollow**

  Do not follow [symlink(7)](/symlink/7.md)'s on the mounted file system.

- **pgread**

  Enable pgcache read for the mount.

- **size**

  Set the total file system size in bytes, unless suffixed with one of k, m, g, t, or p, which denote byte, kilobyte, megabyte, gigabyte, terabyte and petabyte respectively. If zero (the default) or a value larger than SIZE\_MAX - PAGE\_SIZE is given, the available amount of memory (including main memory and swap space) will be used.

- **uid**

  Set the user ID of the root inode of the file system. The default is the mount point's UID.

- **union**

  Refer to [mount(8)](/mount/8.md).

## SYSCTL VARIABLES

The following [sysctl(8)](/sysctl/8.md) variables are available:

- *vfs.tmpfs.memory\_percent*

  The percentage of memory plus swap space available at kernel file system initialization that can be used by a file system with a size of 0. When this amount of space in use is reached, new files cannot be created and files cannot be extended. The default is 95%. Changing this value also changes *vfs.tmpfs.memory\_reserved*.

- *vfs.tmpfs.memory\_reserved*

  The currently-reserved amount of memory plus swap space based on the memory percentage. The minimum is compiled into the system, and defaults to 4 MB.

## EXAMPLES

Mount a **tmpfs** memory file system:

```
mount -t tmpfs tmpfs /tmp
```

Configure a **tmpfs** mount via [fstab(5)](/fstab/5.md):

```
tmpfs /tmp tmpfs rw 0 0
```

## SEE ALSO

[procstat(1)](/procstat/1.md), [mmap(2)](/mmap/2.md), [nmount(2)](/nmount/2.md), [unmount(2)](/unmount/2.md), [fstab(5)](/fstab/5.md), [mdmfs(8)](/mdmfs/8.md), [mount(8)](/mount/8.md), [swapinfo(8)](/swapinfo/8.md), [swapon(8)](/swapon/8.md)

## HISTORY

The **tmpfs** driver first appeared in FreeBSD 7.0.

## AUTHORS

The **tmpfs** kernel implementation was written by Julio M. Merino Vidal ⟨*jmmv@NetBSD.org*⟩ as a Google Summer of Code project.

Rohit Jalan and others ported it from NetBSD to FreeBSD.

This manual page was written by Xin LI ⟨*delphij@FreeBSD.org*⟩.
