Previous Table of Contents Next


Virtual File Systems

Virtual file systems (previously called pseudo file systems) are virtual or memory-based file systems that provide access to special kernel information and facilities. Most virtual file systems do not use file system disk space. Some pseudo file systems, such as the temporary file system, may, however, use the swap space on a physical disk. Cache file systems use a file system on the disk to contain the cache.

The Cache File System

You can use the Cache File System (CacheFS) to improve performance of remote file systems or slow devices such as CD-ROM drives. When a file system is cached, the data read from the remote file system or CD-ROM is stored in a cache on the local system. See “Creating Cache File Systems” for more information.

The Temporary File System (TMPFS)

The TMPFS file system, uses local memory for disk reads and writes. Access to files in a TMPFS file system is typically much faster than access to files in a UFS file system. Files in the TMPFS file system are not permanent. They are deleted when the file system is unmounted and when the system is shut down or rebooted.

The default file system type for the /tmp directory in the SunOS 5.x system software is TMPFS. You can copy or move files into or out of the /tmp directory, just as you would in a ufs /tmp file system.

UsingTMPFS file systems can improve system performance by saving the cost of reading and writing temporary files to a local disk or across the network. For example, temporary files are created when you compile a program. The operating system generates a lot of disk or network input and output activity while manipulating these files. Using TMPFS file systems to hold these temporary files may significantly speed up their creation, manipulation, and deletion.

The TMPFS file system uses swap space as a temporary storage area. If a system with a TMPFS file system does not have adequate swap space, two problems can occur:

  The TMPFS file system can run out of space, just as a regular file system can fill up.
  Because TMPFS allocates swap space to save file data (if necessary), some programs may not be able to execute because there is not enough swap space.

See Chapter 9, “Administering Systems,” for information about increasing swap space.

The Loopback File System (LOFS)

The LOFS file system lets you create a new virtual file system. You can access files using an alternative path name. For example, you can create a loopback mount of /onto/tmp/newroot. The entire file system hierarchy looks like it is duplicated under /tmp/newroot, including any file systems that were mounted from NFS servers. All files are accessible either with a path name starting from / or with a path name starting from /tmp/newroot until a different file system is mounted in /tmp/newroot or any of its subdirectories.

The Process File System (PROCFS)

The PROCFS file system resides in memory. It contains a list of active processes, by number, in the /proc directory. Information in the /proc directory is used by commands such as ps. Debuggers and other development tools can also access the address space of the processes using file system calls. This example shows a partial listing of the contents of the /proc directory:

castle% ls -l /proc
total 116
dr-x--x--x   5 root     root         736 Sep 15 09:00 0
dr-x--x--x   5 root     root         736 Sep 15 09:00 1
dr-x--x--x   5 root     root         736 Sep 15 09:01 103
dr-x--x--x   5 root     root         736 Sep 15 09:01 113
dr-x--x--x   5 root     root         736 Sep 15 09:01 115
dr-x--x--x   5 root     root         736 Sep 15 09:01 140
dr-x--x--x   5 root     root         736 Sep 15 09:01 145
(Some processes removed from this example)
dr-x--x--x   5 winsor   staff        736 Sep 15 11:13 545
dr-x--x--x   5 winsor   staff        736 Sep 15 11:46 645
dr-x--x--x   5 winsor   staff        736 Sep 15 12:52 679
dr-x--x--x   5 root     root         736 Sep 15 13:03 717
dr-x--x--x   5 winsor   staff        736 Sep 15 13:15 806
dr-x--x--x   5 winsor   staff        736 Sep 15 13:22 808
dr-x--x--x   5 winsor   staff        736 Sep 15 15:49 876
castle%
oak% ls -l /proc
total 144944
-rw-------   1 root     root           Ø Dec 19 15:45 ØØØØØ
-rw-------   1 root     root      1966Ø8 Dec 19 15:45 ØØØØ1
-rw-------   1 root     root           Ø Dec 19 15:45 ØØØØ2
-rw-------   1 root     root     1Ø28Ø96 Dec 19 15:46 ØØØ73
-rw-------   1 root     root     1445888 Dec 19 15:46 ØØØ91
-rw-------   1 root     root     1142784 Dec 19 15:46 ØØØ93
-rw-------   1 root     root     1142784 Dec 19 15:46 ØØØ95
(Some processes removed from this example)
-rw-------   1 ignatz   staff    157696Ø Dec 19 15:5Ø ØØ226
-rw-------   1 ignatz   staff     192512 Dec 19 15:51 ØØ236
-rw-------   1 ignatz   staff    126976Ø Dec 19 15:52 ØØ24Ø
-rw-------   1 ignatz   staff    6Ø9Ø752 Dec 19 15:52 ØØ241
-rw-------   1 ignatz   staff     188416 Dec 19 15:52 ØØ247
-rw-------   1 ignatz   staff    274432Ø Dec 19 15:52 ØØ256
castle%


CAUTION! Do not delete the files in the /proc directory. Deleting processes from the /proc directory is not the recommended way to kill them. See Chapter 1 for information on how to kill a process. Remember, /proc files do not use disk space, so there is little reason to delete files from this directory. The /proc directory does not require any system administration.


Previous Table of Contents Next