1*bbf21555SRichard Lowe.\" 2*bbf21555SRichard Lowe.\" Copyright (c) 1990, Sun Microsystems, Inc. 3*bbf21555SRichard Lowe.\" Copyright 2021 Oxide Computer Company 4*bbf21555SRichard Lowe.\" 5*bbf21555SRichard Lowe.\" The contents of this file are subject to the terms of the 6*bbf21555SRichard Lowe.\" Common Development and Distribution License (the "License"). 7*bbf21555SRichard Lowe.\" You may not use this file except in compliance with the License. 8*bbf21555SRichard Lowe.\" 9*bbf21555SRichard Lowe.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*bbf21555SRichard Lowe.\" or http://www.opensolaris.org/os/licensing. 11*bbf21555SRichard Lowe.\" See the License for the specific language governing permissions 12*bbf21555SRichard Lowe.\" and limitations under the License. 13*bbf21555SRichard Lowe.\" 14*bbf21555SRichard Lowe.\" When distributing Covered Code, include this CDDL HEADER in each 15*bbf21555SRichard Lowe.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*bbf21555SRichard Lowe.\" If applicable, add the following below this CDDL HEADER, with the 17*bbf21555SRichard Lowe.\" fields enclosed by brackets "[]" replaced with your own identifying 18*bbf21555SRichard Lowe.\" information: Portions Copyright [yyyy] [name of copyright owner] 19*bbf21555SRichard Lowe.\" 20*bbf21555SRichard Lowe.Dd October 9, 1990 21*bbf21555SRichard Lowe.Dt TMPFS 4FS 22*bbf21555SRichard Lowe.Os 23*bbf21555SRichard Lowe.Sh NAME 24*bbf21555SRichard Lowe.Nm tmpfs 25*bbf21555SRichard Lowe.Nd memory based file system 26*bbf21555SRichard Lowe.Sh SYNOPSIS 27*bbf21555SRichard Lowe.In sys/mount.h 28*bbf21555SRichard Lowe.Fo mount 29*bbf21555SRichard Lowe.Fa "const char *special" 30*bbf21555SRichard Lowe.Fa "const char *directory" 31*bbf21555SRichard Lowe.Fa IMS_DATA 32*bbf21555SRichard Lowe.Fa \(dqtmpfs\(dq 33*bbf21555SRichard Lowe.Fa NULL 34*bbf21555SRichard Lowe.Fa 0 35*bbf21555SRichard Lowe.Fc 36*bbf21555SRichard Lowe.Sh DESCRIPTION 37*bbf21555SRichard Lowe.Nm 38*bbf21555SRichard Loweis a memory based file system which uses kernel resources relating to the VM 39*bbf21555SRichard Lowesystem and page cache as a file system. 40*bbf21555SRichard LoweOnce mounted, a 41*bbf21555SRichard Lowe.Nm 42*bbf21555SRichard Lowefile system provides standard file operations and semantics. 43*bbf21555SRichard Lowe.Nm 44*bbf21555SRichard Loweis so named because files and directories are not preserved across 45*bbf21555SRichard Lowereboot or unmounts, all files residing on a 46*bbf21555SRichard Lowe.Nm 47*bbf21555SRichard Lowefile system that is unmounted will be lost. 48*bbf21555SRichard Lowe.Pp 49*bbf21555SRichard Lowe.Nm 50*bbf21555SRichard Lowefile systems can be mounted with the command: 51*bbf21555SRichard Lowe.Bd -literal -offset indent 52*bbf21555SRichard Lowemount -F tmpfs swap directory 53*bbf21555SRichard Lowe.Ed 54*bbf21555SRichard Lowe.Pp 55*bbf21555SRichard LoweAlternatively, to mount a 56*bbf21555SRichard Lowe.Nm 57*bbf21555SRichard Lowefile system on 58*bbf21555SRichard Lowe.Pa /tmp 59*bbf21555SRichard Loweat multi-user startup time 60*bbf21555SRichard Lowe.Pq maximizing possible performance improvements , 61*bbf21555SRichard Loweadd the following line to 62*bbf21555SRichard Lowe.Pa /etc/vfstab : 63*bbf21555SRichard Lowe.Bd -literal -offset indent 64*bbf21555SRichard Loweswap \(mi/tmp tmpfs \(mi yes \(mi 65*bbf21555SRichard Lowe.Ed 66*bbf21555SRichard Lowe.Pp 67*bbf21555SRichard Lowe.Nm 68*bbf21555SRichard Loweis designed as a performance enhancement which is achieved by caching the writes 69*bbf21555SRichard Loweto files residing on a 70*bbf21555SRichard Lowe.Nm 71*bbf21555SRichard Lowefile system. 72*bbf21555SRichard LowePerformance improvements are most noticeable when a large number of short lived 73*bbf21555SRichard Lowefiles are written and accessed on a 74*bbf21555SRichard Lowe.Nm 75*bbf21555SRichard Lowefile system. 76*bbf21555SRichard LoweLarge compilations with 77*bbf21555SRichard Lowe.Nm 78*bbf21555SRichard Lowemounted on 79*bbf21555SRichard Lowe.Pa /tmp 80*bbf21555SRichard Loweare a good example of this. 81*bbf21555SRichard Lowe.Pp 82*bbf21555SRichard LoweUsers of 83*bbf21555SRichard Lowe.Nm 84*bbf21555SRichard Loweshould be aware of some constraints involved in mounting a 85*bbf21555SRichard Lowe.Nm 86*bbf21555SRichard Lowefile system. 87*bbf21555SRichard LoweThe resources used by 88*bbf21555SRichard Lowe.Nm 89*bbf21555SRichard Loweare the same as those used when commands are executed 90*bbf21555SRichard Lowe.Pq for example, swap space allocation . 91*bbf21555SRichard LoweThis means that large sized 92*bbf21555SRichard Lowe.Nm 93*bbf21555SRichard Lowefiles can affect the amount of space left over for programs to execute. 94*bbf21555SRichard LoweLikewise, programs requiring large amounts of memory use up the space available 95*bbf21555SRichard Loweto 96*bbf21555SRichard Lowe.Nm 97*bbf21555SRichard LoweUsers running into this constraint 98*bbf21555SRichard Lowe.Po 99*bbf21555SRichard Lowefor example, running out of space on 100*bbf21555SRichard Lowe.Nm 101*bbf21555SRichard Lowe.Pc 102*bbf21555SRichard Lowecan allocate more swap space by using the 103*bbf21555SRichard Lowe.Xr swap 8 104*bbf21555SRichard Lowecommand. 105*bbf21555SRichard Lowe.Pp 106*bbf21555SRichard LoweAnother constraint is that the number of files available in a 107*bbf21555SRichard Lowe.Nm 108*bbf21555SRichard Lowefile system is calculated based on the physical memory of the machine and not 109*bbf21555SRichard Lowethe size of the swap device/partition. 110*bbf21555SRichard LoweIf you have too many files, 111*bbf21555SRichard Lowe.Nm 112*bbf21555SRichard Lowewill print a warning message and you will be unable to create new files. 113*bbf21555SRichard LoweYou cannot increase this limit by adding swap space. 114*bbf21555SRichard Lowe.Pp 115*bbf21555SRichard LoweNormal file system writes are scheduled to be written to a permanent storage 116*bbf21555SRichard Lowemedium along with all control information associated with the file 117*bbf21555SRichard Lowe.Pq for example, modification time, file permissions . 118*bbf21555SRichard Lowe.Nm 119*bbf21555SRichard Lowecontrol information resides only in memory and never needs to be written to 120*bbf21555SRichard Lowepermanent storage. 121*bbf21555SRichard LoweFile data remains in core until memory demands are sufficient to cause pages 122*bbf21555SRichard Loweassociated with 123*bbf21555SRichard Lowe.Nm 124*bbf21555SRichard Loweto be reused at which time they are copied out to swap. 125*bbf21555SRichard Lowe.Pp 126*bbf21555SRichard LoweAn additional mount option can be specified to control the size of an individual 127*bbf21555SRichard Lowe.Nm 128*bbf21555SRichard Lowefile system. 129*bbf21555SRichard LoweSee 130*bbf21555SRichard Lowe.Xr mount_tmpfs 8 131*bbf21555SRichard Lowefor more details. 132*bbf21555SRichard Lowe.Sh DIAGNOSTICS 133*bbf21555SRichard LoweIf 134*bbf21555SRichard Lowe.Nm 135*bbf21555SRichard Loweruns out of space, one of the following messages will display in the console. 136*bbf21555SRichard Lowe.Bl -tag -width Ds 137*bbf21555SRichard Lowe.It "directory: File system full, swap space limit exceeded" 138*bbf21555SRichard LoweThis message appears because a page could not be allocated while writing to a 139*bbf21555SRichard Lowefile. 140*bbf21555SRichard LoweThis can occur if 141*bbf21555SRichard Lowe.Nm 142*bbf21555SRichard Loweis attempting to write more than it is allowed, or if currently executing 143*bbf21555SRichard Loweprograms are using a lot of memory. 144*bbf21555SRichard LoweTo make more space available, remove unnecessary files, exit from some programs, 145*bbf21555SRichard Loweor allocate more swap space using 146*bbf21555SRichard Lowe.Xr swap 8 . 147*bbf21555SRichard Lowe.It "directory: File system full, memory allocation failed" 148*bbf21555SRichard Lowe.Nm 149*bbf21555SRichard Loweran out of physical memory while attempting to create a new file or 150*bbf21555SRichard Lowedirectory. 151*bbf21555SRichard LoweRemove unnecessary files or directories or install more physical memory. 152*bbf21555SRichard Lowe.El 153*bbf21555SRichard Lowe.Sh SEE ALSO 154*bbf21555SRichard Lowe.Xr mmap 2 , 155*bbf21555SRichard Lowe.Xr mount 2 , 156*bbf21555SRichard Lowe.Xr umount 2 , 157*bbf21555SRichard Lowe.Xr vfstab 5 , 158*bbf21555SRichard Lowe.Xr df 8 , 159*bbf21555SRichard Lowe.Xr mount 8 , 160*bbf21555SRichard Lowe.Xr mount_tmpfs 8 , 161*bbf21555SRichard Lowe.Xr swap 8 162*bbf21555SRichard Lowe.Sh WARNINGS 163*bbf21555SRichard LoweFiles and directories on a 164*bbf21555SRichard Lowe.Nm 165*bbf21555SRichard Lowefile system are not preserved across reboots or unmounts. 166*bbf21555SRichard LoweCommand scripts or programs which count on this will not work as expected. 167*bbf21555SRichard Lowe.Sh NOTES 168*bbf21555SRichard LoweCompilers do not necessarily use 169*bbf21555SRichard Lowe/tmp 170*bbf21555SRichard Loweto write intermediate files therefore missing some significant performance 171*bbf21555SRichard Lowebenefits. 172*bbf21555SRichard LoweThis can be remedied by setting the environment variable 173*bbf21555SRichard Lowe.Ev TMPDIR to 174*bbf21555SRichard Lowe.Pa /tmp . 175*bbf21555SRichard LoweCompilers use 176*bbf21555SRichard Lowethe value in this environment variable as the name of the directory to store 177*bbf21555SRichard Loweintermediate files. 178*bbf21555SRichard Lowe.Pp 179*bbf21555SRichard Lowe.Sy swap 180*bbf21555SRichard Loweto a 181*bbf21555SRichard Lowe.Nm 182*bbf21555SRichard Lowefile is not supported. 183*bbf21555SRichard Lowe.Pp 184*bbf21555SRichard Lowe.Xr df 8 185*bbf21555SRichard Loweoutput is of limited accuracy since a 186*bbf21555SRichard Lowe.Nm 187*bbf21555SRichard Lowefile system size 188*bbf21555SRichard Loweis not static and the space available to 189*bbf21555SRichard Lowe.Nm 190*bbf21555SRichard Loweis dependent on the swap space demands of the entire system. 191