tmpFS

tmpfs is a temporary filesystem that resides in memory and/or swap partition(s). 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.

Usage

Create a tmpfs: mount -t tmpfs -o [OPTIONS] tmpfs [MOUNT_POINT]

Resize a tmpfs: mount -t tmpfs -o remount,size=<NEW_SIZE> tmpfs [MOUNT_POINT]

Options

OptionDescription
size=bytesSpecify an upper limit on the size of the filesystem. Size is given in bytes, rounded up to entire pages. A k, m, or g suffix can be used for Ki, Mi, or Gi. Use % to specify a percentage of physical RAM. Default: 50%. Set to 0 to remove the limit.
nr_blocks=blocksSimilar to size, but in blocks of PAGE_CACHE_SIZE. Accepts k, m, or g suffixes, but not %.
nr_inodes=inodesSets the maximum number of inodes. Default is half the number of physical RAM pages or the number of lowmem RAM pages (whichever is smaller). Use k, m, or g suffixes, but % is not supported. Set to 0 to remove the limit.
noswapDisables swap. Remounts must respect the original settings. By default, swap is enabled.
mode=modeSets the initial permissions of the root directory.
gid=gidSets the initial group ID of the root directory.
uid=uidSets the initial user ID of the root directory.
huge=huge_optionSets the huge table memory allocation policy for all files (if CONFIG_TRANSPARENT_HUGEPAGE is enabled). Options: never (default), always, within_size, advise, deny, or force.
mpol=mpol_optionSets NUMA memory allocation policy (if CONFIG_NUMA is enabled). Options: default, prefer:node, bind:nodelist, interleave, interleave:nodelist, or local. Example: mpol=bind:0-3,5,7,9-15.