8.7 Mounting Directories on TMPFS
TMPFS is a virtual memory-based
filesystem that can grow and shrink according to its content.
Although its content is not saved across reboots, it is quite useful
for storing temporary files. Hence, instead of mounting all the
directories from a single filesystem, you can choose to mount
directories that do not require permanent storage, such as
/tmp, on TMPFS. Because content stored on TMPFS
is not saved across reboots, however, essential directories such as
/usr, /etc, or
/bin cannot be stored on TMPFS. To use TMPFS,
enable the "Virtual memory file system support
(former shm fs)" item in the "File
systems" submenu in the kernel configuration
menu.
With kernel support for TMPFS enabled, you can mount a 4 MB TMPFS
filesystem on /tmp, for example:
# mount -t tmpfs none /tmp -o size=4m
Alternatively, you can add a line in your
/etc/fstab file and modify your
/etc/init.d/rcS file to mount TMPFS at boot
time. If you do not provide a size limit, the filesystem will grow
according to its content.
In contrast with most other mount commands,
TMPFS does not require a device or file to be mounted, hence the use
of none as the device. The name of the device for
TMPFS is actually ignored by mount, and
replacing none by any other name would have no
effect on the command.
If you would like more information
regarding TMPFS, take a look at part three of the IBM developerWorks
filesystem series mentioned earlier, Using the virtual
memory (VM) filesystem and bind mounts.
|