summaryrefslogtreecommitdiff
path: root/usr/src/man/man4fs/tmpfs.4fs
blob: ee3bdfd777a3c22be38175447ab62e2780cdd78c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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.