Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Devices and File Systems
Previous Next

Creating a Temporary File System (TMPFS)

A temporary file system (TMPFS) uses local memory for file system reads and writes, which is typically much faster than reads and writes in a UFS file system. TMPFS file systems can improve system performance by saving the cost of reading and writing temporary files to a local disk or across the network. Files in TMPFS file systems do not survive across reboots or unmounts.

If you create multiple TMPFS file systems, be aware that they all use the same system resources. Files created under one TMPFS file system use up space available for any other TMPFS file system, unless you limit TMPFS sizes by using the -o size option of the mount command.

For more information, see the tmpfs(7FS).

How to Create and Mount a TMPFS File System

  1. Become superuser or assume an equivalent role.
  2. Create the directory that you want to mount as the TMPFS file system, if necessary.
    # mkdir /mount-point

    where mount-point is the directory on which the TMPFS file system is mounted.

  3. Mount the TMPFS file system.
    # mount -F tmpfs [-o size=number]  swap mount-point
    -o size=number

    Specifies the size limit of the TMPFS file system in Mbytes.

    mount-point

    Specifies the directory on which the TMPFS file system is mounted.

    To set up the system to automatically mount a TMPFS file system at boot time, see Example 18-3.

  4. Verify that the TMPFS file system has been created.
    # mount -v
Example 18-2 Creating and Mounting a TMPFS File System

The following example shows how to create, mount, and limit the size of the TMPFS file system, /export/reports, to 50 Mbytes.

# mkdir /export/reports
# chmod 777 /export/reports
# mount -F tmpfs -o size=50m swap /export/reports
# mount -v
Example 18-3 Mounting a TMPFS File System at Boot Time

You can set up the system to automatically mount a TMPFS file system at boot time by adding an /etc/vfstab entry. The following example shows an entry in the /etc/vfstab file that mounts /export/test as a TMPFS file system at boot time. Because the size=number option is not specified, the size of the TMPFS file system on /export/test is limited only by the available system resources.

swap - /export/test  tmpfs   -  yes  -

For more information on the /etc/vfstab file, see Field Descriptions for the /etc/vfstab File.

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire