summaryrefslogtreecommitdiff
path: root/usr/src/man/man4fs/tmpfs.4fs
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man4fs/tmpfs.4fs')
-rw-r--r--usr/src/man/man4fs/tmpfs.4fs190
1 files changed, 190 insertions, 0 deletions
diff --git a/usr/src/man/man4fs/tmpfs.4fs b/usr/src/man/man4fs/tmpfs.4fs
new file mode 100644
index 0000000000..ee3bdfd777
--- /dev/null
+++ b/usr/src/man/man4fs/tmpfs.4fs
@@ -0,0 +1,190 @@
+.\"
+.\" Copyright (c) 1990, Sun Microsystems, Inc.
+.\" Copyright 2021 Oxide Computer Company
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.Dd October 9, 1990
+.Dt TMPFS 4FS
+.Os
+.Sh NAME
+.Nm tmpfs
+.Nd memory based file system
+.Sh SYNOPSIS
+.In sys/mount.h
+.Fo mount
+.Fa "const char *special"
+.Fa "const char *directory"
+.Fa IMS_DATA
+.Fa \(dqtmpfs\(dq
+.Fa NULL
+.Fa 0
+.Fc
+.Sh DESCRIPTION
+.Nm
+is a memory based file system which uses kernel resources relating to the VM
+system and page cache as a file system.
+Once mounted, a
+.Nm
+file system provides standard file operations and semantics.
+.Nm
+is so named because files and directories are not preserved across
+reboot or unmounts, all files residing on a
+.Nm
+file system that is unmounted will be lost.
+.Pp
+.Nm
+file systems can be mounted with the command:
+.Bd -literal -offset indent
+mount -F tmpfs swap directory
+.Ed
+.Pp
+Alternatively, to mount a
+.Nm
+file system on
+.Pa /tmp
+at multi-user startup time
+.Pq maximizing possible performance improvements ,
+add the following line to
+.Pa /etc/vfstab :
+.Bd -literal -offset indent
+swap \(mi/tmp tmpfs \(mi yes \(mi
+.Ed
+.Pp
+.Nm
+is designed as a performance enhancement which is achieved by caching the writes
+to files residing on a
+.Nm
+file system.
+Performance improvements are most noticeable when a large number of short lived
+files are written and accessed on a
+.Nm
+file system.
+Large compilations with
+.Nm
+mounted on
+.Pa /tmp
+are a good example of this.
+.Pp
+Users of
+.Nm
+should be aware of some constraints involved in mounting a
+.Nm
+file system.
+The resources used by
+.Nm
+are the same as those used when commands are executed
+.Pq for example, swap space allocation .
+This means that large sized
+.Nm
+files can affect the amount of space left over for programs to execute.
+Likewise, programs requiring large amounts of memory use up the space available
+to
+.Nm
+Users running into this constraint
+.Po
+for example, running out of space on
+.Nm
+.Pc
+can allocate more swap space by using the
+.Xr swap 8
+command.
+.Pp
+Another constraint is that the number of files available in a
+.Nm
+file system is calculated based on the physical memory of the machine and not
+the size of the swap device/partition.
+If you have too many files,
+.Nm
+will print a warning message and you will be unable to create new files.
+You cannot increase this limit by adding swap space.
+.Pp
+Normal file system writes are scheduled to be written to a permanent storage
+medium along with all control information associated with the file
+.Pq for example, modification time, file permissions .
+.Nm
+control information resides only in memory and never needs to be written to
+permanent storage.
+File data remains in core until memory demands are sufficient to cause pages
+associated with
+.Nm
+to be reused at which time they are copied out to swap.
+.Pp
+An additional mount option can be specified to control the size of an individual
+.Nm
+file system.
+See
+.Xr mount_tmpfs 8
+for more details.
+.Sh DIAGNOSTICS
+If
+.Nm
+runs out of space, one of the following messages will display in the console.
+.Bl -tag -width Ds
+.It "directory: File system full, swap space limit exceeded"
+This message appears because a page could not be allocated while writing to a
+file.
+This can occur if
+.Nm
+is attempting to write more than it is allowed, or if currently executing
+programs are using a lot of memory.
+To make more space available, remove unnecessary files, exit from some programs,
+or allocate more swap space using
+.Xr swap 8 .
+.It "directory: File system full, memory allocation failed"
+.Nm
+ran out of physical memory while attempting to create a new file or
+directory.
+Remove unnecessary files or directories or install more physical memory.
+.El
+.Sh SEE ALSO
+.Xr mmap 2 ,
+.Xr mount 2 ,
+.Xr umount 2 ,
+.Xr vfstab 5 ,
+.Xr df 8 ,
+.Xr mount 8 ,
+.Xr mount_tmpfs 8 ,
+.Xr swap 8
+.Sh WARNINGS
+Files and directories on a
+.Nm
+file system are not preserved across reboots or unmounts.
+Command scripts or programs which count on this will not work as expected.
+.Sh NOTES
+Compilers do not necessarily use
+/tmp
+to write intermediate files therefore missing some significant performance
+benefits.
+This can be remedied by setting the environment variable
+.Ev TMPDIR to
+.Pa /tmp .
+Compilers use
+the value in this environment variable as the name of the directory to store
+intermediate files.
+.Pp
+.Sy swap
+to a
+.Nm
+file is not supported.
+.Pp
+.Xr df 8
+output is of limited accuracy since a
+.Nm
+file system size
+is not static and the space available to
+.Nm
+is dependent on the swap space demands of the entire system.