Contained WithinFind More DocumentationFeatured Support Resources | Descargar este libro en PDF (1386 KB)
Chapter 34 Managing File Systems (Overview)This is a list of the overview information in this chapter. What's New in File Systems?This section describes new file system features. The /var/run File SystemA new TMPFS-mounted file system, /var/run, is the repository for temporary system files that are not needed across system reboots in this Solaris release and future releases. The /tmp directory continues to be repository for non-system temporary files. Because /var/run is mounted as a memory-based file system rather than a disk-based file system, updates to this directory do not cause unnecessary disk traffic that would interfere with systems running power management software. The /var/run directory requires no administration. You may notice that it is not unmounted with the umount -a or the umountall command. For security reasons, /var/run is owned by root. Mount Table Changes (/etc/mnttab)In previous Solaris releases, /etc/mnttab was a text-based file that stored information about mounted file systems. The downside of being a file was that it could get out of sync with the actual state of mounted file systems. Now the /etc/mnttab file is a MNTFS file system that provides read-only information directly from the kernel about mounted file systems for the local system. Note the following mnttab behavior changes:
No administration is required for the /etc/mnttab mount table. See mnttab(4) for more information. Using the Universal Disk Format (UDF) File SystemThe UDF file system, the industry-standard format for storing information on the optical media technology called DVD (Digital Versatile Disc or Digital Video Disc), is included in this Solaris release. The UDF file system is provided as dynamically loadable, 32-bit and 64-bit modules, with system administration utilities for creating, mounting, and checking the file system on both SPARC and IA platforms. The Solaris UDF file system works with supported ATAPI and SCSI DVD drives, CD-ROM devices, and disk and diskette drives. In addition, the Solaris UDF file system is fully compliant with the UDF 1.50 specification. The UDF file system support is provided in the following new packages:
UDF Features and BenefitsIn this Solaris release, the UDF file system provides the following features:
The following features are not included in this UDF file system release:
Hardware and Software RequirementsThe UDF file system requires the following:
UDF Compatibility IssuesThis first Solaris UDF file system implementation provides:
How to Connect a DVD-ROM Device
How to Access Files on a DVD-ROM Device
How to Display UDF File System ParametersDisplay UDF file system parameters by using the mkfs command. How to Create a UDF File SystemCreate a UDF file system by using the mkfs command.
See mkfs_udfs(1M) for more information. How to Identify the UDF File System TypeIdentify the UDF file system type by using the fstyp command.
How to Check a UDF File SystemCheck the integrity of a UDF file system by using the fsck command. See fsck_udfs(1M) for more information. How to Mount a UDF File SystemMount a UDF file system.
See mount_udfs(1M) for more information. How to Unmount a UDF File SystemUnmount a UDF file system. How to Label a Device with a UDF File System and Volume NameCreate a file system and volume name for a UDF file system.
See labelit_udfs(1M) for more information. Overview of File SystemsA file system is a structure of directories used to organize and store files. The term file system is used to describe:
Usually, you can tell from context which meaning is intended. The Solaris operating environment uses the virtual file system (VFS) architecture, which provides a standard interface for different file system types. The VFS architecture enables the kernel to handle basic operations, such as reading, writing, and listing files; and makes it easier to add new file systems. Administering file systems is one of your most important system administration tasks. Read this chapter for file system background and planning information. Refer to other chapters in the System Administration Guide for instructions about the following tasks:
Types of File SystemsThe Solaris operating environment supports three types of file systems:
To identify the type for a particular file system, see "Determining a File System's Type". Disk-Based File SystemsDisk-based file systems are stored on physical media such as hard disks, CD-ROMs, and diskettes. Disk-based file systems can be written in different formats. The available formats are:
Each type of disk-based file system is customarily associated with a particular media device:
These associations are not, however, restrictive. For example, CD-ROMs and diskettes can have UFS file systems created on them. Network-Based File SystemsNetwork-based file systems can be accessed over the network. Typically, network-based file systems reside on one system, typically a server, and are accessed by other systems across the network. NFSTM is the only available network-based or distributed computing file system. With NFS, you can administer distributed resources (files or directories) by exporting them from a server and mounting them on individual clients. See "The NFS Environment" for more information. Virtual File SystemsVirtual file systems are memory-based file systems that provide access to special kernel information and facilities. Most virtual file systems do not use file system disk space. However, the Cache File System (CacheFS) uses a file system on the disk to contain the cache, and some virtual file systems, such as the Temporary File System (TMPFS), use the swap space on a disk. The Cache File SystemThe Cache File System (CacheFSTM) can be used 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 Chapter 37, The Cache File System (Tasks) for detailed information on setting up and administering CacheFS File Systems. The Temporary File SystemThe Temporary File System (TMPFS) uses local memory for file system reads and writes, which is typically much faster than a UFS file system. Using TMPFS 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, and the operating system generates a lot of disk or network activity while manipulating these files. Using TMPFS to hold these temporary files can significantly speed up their creation, manipulation, and deletion. Files in TMPFS file systems are not permanent. They are deleted when the file system is unmounted and when the system is shut down or rebooted. TMPFS is the default file system type for the /tmp directory in the Solaris operating environment. You can copy or move files into or out of the /tmp directory, just as you would in a UFS file system. The TMPFS file system uses swap space as a temporary backing store. If a system with a TMPFS file system does not have adequate swap space, two problems can occur:
See Chapter 35, Creating File Systems (Tasks) for information about creating TMPFS file systems. See Chapter 38, Configuring Additional Swap Space (Tasks) for information about increasing swap space. The Loopback File SystemThe Loopback File System (LOFS) lets you create a new virtual file system, so you can access files by using an alternative path name. For example, you can create a loopback mount of root (/) on /tmp/newroot, which will make the entire file system hierarchy look like it is duplicated under /tmp/newroot, including any file systems mounted from NFS servers. All files will be accessible either with a path name starting from root (/), or with a path name starting from /tmp/newroot. See Chapter 35, Creating File Systems (Tasks) for information on how to create LOFS file systems. The Process File SystemThe Process File System (PROCFS) resides in memory. It contains a list of active processes, by process number, in the /proc directory. Information in the /proc directory is used by commands like ps. Debuggers and other development tools can also access the address space of the processes by using file system calls. Do not delete the files in the /proc directory. Deleting processes from the /proc directory will not kill them. 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 system administration. Additional Virtual File SystemsThese additional types of virtual file systems are listed for your information. They do not require administration.
File System Administration CommandsMost file system administration commands have both a generic and a file system-specific component. You should use the generic commands whenever possible, which call the file system-specific component. The table below lists the generic file system administrative commands, which are located in the /usr/sbin directory. Table 34-1 Generic File System Administrative Commands
How the File System Commands Determine the File System TypeThe generic file system commands determine the file system type by following this sequence:
Manual Pages for Generic and Specific CommandsBoth the generic and specific commands have manual pages in the man Pages(1M): System Administration Commands. The specific manual page is a continuation of the generic manual page. To look at a specific manual page, append an underscore and the file system type abbreviation to the generic command name. For example, to see the specific manual page for mounting a UFS file system, type man mount_ufs. The Default Solaris File SystemsThe Solaris file system is hierarchical, starting with the root directory (/) and continuing downwards through a number of directories. The Solaris installation process enables you to install a default set of directories and uses a set of conventions to group similar types of files together. The table below provides a summary of the default Solaris file systems, and shows the type of each file system. The root (/) and /usr file systems are both needed to run a system. Some of the most basic commands from the /usr file system (like mount) are included in the root (/) file system so that they are available when the system boots or is in single-user mode and /usr is not mounted. See Chapter 40, UFS File System Reference for more detailed information on the default directories for the root (/) and /usr file systems. Table 34-2 The Default Solaris File Systems
Swap SpaceThe Solaris operating environment uses some disk slices for temporary storage rather than for file systems. These slices are called swap slices, or swap space. Swap space is used as virtual memory storage areas when the system does not have enough physical memory to handle current processes. Since many applications rely on swap space, it is important to know how to plan for, monitor, and add more swap space when needed. For an overview about swap space and instructions for adding swap space, see Chapter 38, Configuring Additional Swap Space (Tasks). The UFS File SystemUFS is the default disk-based file system in Solaris operating environment. Most of the time, when you administer a disk-based file system, you will be administering UFS file systems. UFS provides the following features:
See Chapter 40, UFS File System Reference for detailed information about the UFS file system. Parts of a UFS File SystemWhen you create a UFS file system, the disk slice is divided into cylinder groups, which are made up of one or more consecutive disk cylinders. The cylinder groups are then further divided into addressable blocks to control and organize the structure of the files within the cylinder group. Each type of block has a specific function in the file system. See "The Structure of UFS File System Cylinder Groups" for more detailed information about each type of block. If you want to customize a file system using arguments with the newfs command or the mkfs command, see Chapter 40, UFS File System Reference for information about altering these parameters. UFS LoggingUFS logging is the process of storing transactions (changes that make up a complete UFS operation) in a log before the transactions are applied to the UFS file system. Once a transaction is stored, the transaction can be applied to the file system later. At reboot, the system discards incomplete transactions, but applies the transactions for completed operations. The file system remains consistent because only completed transactions are ever applied. This is true even when a system crashes, which normally interrupts system calls and introduces inconsistencies into a UFS file system. UFS logging provides two advantages. It prevents file systems from becoming inconsistent, therefore eliminating the need to run fsck. And, because fsck can be bypassed, UFS logging reduces the time required to reboot a system if it crashes, or after an unclean halt (see "What fsck Checks and Tries to Repair" for details on unclean halts). UFS logging can significantly reduce the boot time on systems that have large file systems, which usually take a long time to read and verify with fsck. The log created by UFS logging is continually flushed as it fills up. The log is totally flushed when the file system is unmounted or as a result of the lockfs -f command. UFS logging is not enabled by default. To enable UFS logging, you must specify the -o logging option with the mount command in the /etc/vfstab file or when mounting the file system. The log is allocated from free blocks on the file system, and it is sized approximately 1 Mbyte per 1 Gbyte of file system, up to a maximum of 64 Mbytes. Logging can be enabled on any UFS, including the root (/) file system. Also, the fsdb command has been updated with new debugging commands to support UFS logging. Planning UFS File SystemsWhen laying out file systems, you need to consider possible conflicting demands. Here are some suggestions:
See Chapter 35, Creating File Systems (Tasks) for information on default file system parameters as well as procedures for creating new UFS file systems. Mounting and Unmounting File SystemsBefore you can access the files on a file system, you need to mount the file system. Mounting a file system attaches that file system to a directory (mount point) and makes it available to the system. The root (/) file system is always mounted. Any other file system can be connected or disconnected from the root (/) file system. When you mount a file system, any files or directories in the underlying mount point directory are unavailable as long as the file system is mounted. These files are not permanently affected by the mounting process, and they become available again when the file system is unmounted. However, mount directories are typically empty, because you usually do not want to obscure existing files. For example, the figure below shows a local file system, starting with a root (/) file system and subdirectories sbin, etc, and opt. Figure 34-1 Sample root (/) File System
Now, say you wanted to access a local file system from the /opt file system that contains a set of unbundled products. First, you must create a directory to use as a mount point for the file system you want to mount, for example, /opt/unbundled. Once the mount point is created, you can mount the file system (by using the mount command), which makes all of the files and directories in /opt/unbundled available, as shown in the figure below. See Chapter 36, Mounting and Unmounting File Systems (Tasks) for detailed instructions on how to perform these tasks. Figure 34-2 Mounting a File System
The Mounted File System TableWhenever you mount or unmount a file system, the /etc/mnttab (mount table) file is modified with the list of currently mounted file systems. You can display the contents of this file with the cat or more commands, but you cannot edit it. Here is an example of an /etc/mnttab file:
The Virtual File System TableIt would be a very time-consuming and error-prone task to manually mount file systems every time you wanted to access them. To fix this, the virtual file system table (the /etc/vstab file) was created to maintain a list of file systems and how to mount them. The /etc/vfstab file provides two important features: you can specify file systems to automatically mount when the system boots, and you can mount file systems by using only the mount point name, because the /etc/vfstab file contains the mapping between the mount point and the actual device slice name. A default /etc/vfstab file is created when you install a system depending on the selections you make when installing system software; however, you can edit the /etc/vfstab file on a system whenever you want. To add an entry, the main information you need to specify is the device where the file system resides, the name of the mount point, the type of the file system, whether you want it to mount automatically when the system boots (by using the mountall command), and any mount options. The following is an example of an /etc/vfstab file. Comment lines begin with #. This example shows an /etc/vfstab file for a system with two disks (c0t0d0 and c0t3d0).
In the above example, the last entry specifies that a UFS file system on the /dev/dsk/c0t3d0s7 slice will be automatically mounted on the /test mount point when the system boots. Note that, for root (/) and /usr, the mount at boot field value is specified as no, because these file systems are mounted by the kernel as part of the boot sequence before the mountall command is run. See Chapter 36, Mounting and Unmounting File Systems (Tasks) for descriptions of each of the /etc/vfstab fields and information on how to edit and use the file. The NFS EnvironmentNFS is a distributed file system service that can be used to share resources (files or directories) from one system, typically a server, with other systems across the network. For example, you might want to share third-party applications or source files with users on other systems. NFS makes the actual physical location of the resource irrelevant to the user. Instead of placing copies of commonly used files on every system, NFS allows you to place one copy on one system's disk and let all other systems access it across the network. Under NFS, remote files are virtually indistinguishable from local ones. A system becomes an NFS server if it has resources to share over the network. A server keeps a list of currently shared resources and their access restrictions (such as read/write or read-only). When you share a resource, you make it available for mounting by remote systems. You can share a resource in these ways:
See Chapter 36, Mounting and Unmounting File Systems (Tasks) for information on how to share resources. See System Administration Guide, Volume 3 for a complete description of NFS. AutoFSYou can mount NFS file system resources by using a client-side service called automounting (or AutoFS), which enables a system to automatically mount and unmount NFS resources whenever you access them. The resource remains mounted as long as you remain in the directory and are using a file. If the resource is not accessed for a certain period of time, it is automatically unmounted. AutoFS provides the following features:
The AutoFS service is initialized by automount, which is run automatically when a system is booted. The automount daemon, automountd, runs continuously and is responsible for the mounting and unmounting of the NFS file systems on an as-needed basis. By default, the Solaris operating environment automounts /home. AutoFS works with file systems specified in the name service. This information can be maintained in NIS, NIS+, or local /etc files. With AutoFS, you can specify multiple servers to provide the same file system. This way, if one of the servers is down, AutoFS can try to mount from another machine. You can specify which servers are preferred for each resource in the maps by assigning each server a weighting factor. See System Administration Guide, Volume 3 for complete information on how to set up and administer AutoFS. The Cache File System (CacheFS)If you want to improve the performance and scalability of an NFS or CD-ROM file system, you should use the Cache File System (CacheFS). CacheFS is a general purpose file system caching mechanism that improves NFS server performance and scalability by reducing server and network load. Designed as a layered file system, CacheFS provides the ability to cache one file system on another. In an NFS environment, CacheFS increases the client per server ratio, reduces server and network loads, and improves performance for clients on slow links, such as Point-to-Point Protocol (PPP). You can also combine CacheFS with the AutoFS service to help boost performance and scalability. See Chapter 37, The Cache File System (Tasks) for detailed information about CacheFS. Deciding How to Mount File SystemsThe table below provides guidelines on mounting file systems based on how you use them. Table 34-3 Determining How to Mount File Systems
You can mount a CD-ROM containing a file system by simply inserting it into the drive (Volume Management will automatically mount it). You can mount a diskette containing a file system by inserting it into the drive and running the volcheck command. See Chapter 14, Guidelines for Using CDs and Diskettes (Overview) for more information. Determining a File System's TypeYou can determine a file system's type by using the following: How to Determine a File System's TypeThis procedure works whether the file system is mounted or not. Determine a file system's type by using the grep command.
Information for the mount point is displayed. Note - If you have the raw device name of a disk slice, you can use the fstyp(1M) command to determine a file system's type (if the disk slice contains a file system). Example--Determining a File System's TypeThe following example uses the /etc/vfstab to determine the type of the /export file system.
The following example uses the /etc/mnttab file to determine the file system type of the currently mounted diskette (mounted by volume management).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||