Mounting and Unmounting File Systems (Tasks)
This chapter describes how to mount and unmount file systems.
This is a list of the step-by-step instructions in this chapter.
"How to Mount a UFS File System Without Large Files (mount Command)"
"IA: How to Mount a PCFS (DOS) File System From a Hard Disk (mount Command)"
Overview of Mounting File Systems
After you create a file system, you need to make it available to the system so you can use it. You make a file system available by mounting it, which attaches the file system to the system directory tree at the specified mount point. The root (/) file system is always mounted.
The following table provides guidelines on mounting file systems based on how you use them.
Mount Type Needed | Suggested Mount Method |
---|---|
Local or remote file systems that need to be mounted infrequently | The mount command that you enter manually from the command line. |
Local file systems that need to be mounted frequently | The /etc/vfstab file, which mounts the file system automatically when the system is booted in multi-user state. |
Remote file systems that need to be mounted frequently, such as home directories |
To enhance performance, you can also cache the remote file systems by using the CacheFS file system. |
You can mount media that contains a file system by inserting the media into the drive and running the volcheck command if necessary. For more information on mounting removable media, see Chapter 17, Managing Removable Media (Overview).
Commands for Mounting and Unmounting File Systems
The following table lists the commands in the /usr/sbin directory that you use to mount and unmount file systems.
Table 39-1 Commands for Mounting and Unmounting File Systems
Command | Man Page | Description |
---|---|---|
mount | mount(1M) | Mounts file systems and remote resources. |
mountall | mountall(1M) | Mounts all file systems that are specified in the /etc/vfstab file. The mountall command runs automatically when the system enters multiuser mode. |
umount | mount(1M) | Unmounts file systems and remote resources. |
umountall | mountall(1M) | Unmounts all file systems that are specified in the /etc/vfstab file. |
The mount and mountall commands will not mount a read/write file system that has known inconsistencies. If you receive an error message from the mount or mountall command, you might need to check the file system. See Chapter 42, Checking UFS File System Consistency (Tasks) for information on how to check the file system.
The umount and umountall commands will not unmount a file system that is busy. A file system is considered busy if one of the following is true:
A user is accessing a file or directory in the file system.
If a program has a file open in that file system.
If the file system is shared.
Commonly Used Mount Options
The following table describes the commonly used options that you can specify with the mount -o option. If you specify multiple options, separate them with commas (no spaces). For example, -o ro,nosuid.
For a complete list of mount options for each file system type, refer to the specific mount man pages (for example, mount_ufs(1M)).
Table 39-2 Commonly Used -o Mount Options
Field Descriptions for the /etc/vfstab File
An entry in the /etc/vfstab file has seven fields, which are described in the following table.
Table 39-3 Field Descriptions for the /etc/vfstab File
Field Name | Description |
---|---|
device to mount | This field identifies one of the following:
|
device to fsck | The raw (character) device name that corresponds to the UFS file system identified by the device to mount field (for example, /dev/rdsk/c0t0d0s0). This field determines the raw interface that is used by the fsck command. Use a dash (-) when there is no applicable device, such as for a read-only file system or a remote file system. |
mount point | Identifies where to mount the file system (for example, /usr).
|
FS type | Identifies the type of file system. |
fsck pass | The pass number used by the fsck command to decide whether to check a file system. When the field contains a dash (-), the file system is not checked. When the field contains a zero, UFS file systems are not checked but non-UFS file systems are checked. When the field contains a value greater than zero, the file system is always checked. All file systems with a value of 1 in this field are checked one at a time in the order they appear in the vfstab file. When the fsck command is run on multiple UFS file systems that have fsck pass values greater than one and the preen option (-o p) is used, the fsck command automatically checks the file systems on different disks in parallel to maximize efficiency. Otherwise, the value of the pass number does not have any effect. |
mount at boot | Set to yes or no for whether the file system should be automatically mounted by the mountall command when the system is booted. Note that this field has nothing to do with AutoFS. The root (/), /usr and /var file systems are not mounted from the vfstab file initially. This field should always be set to no for these file systems and for virtual file systems such as /proc and /dev/fd. |
mount options | A list of comma-separated options (with no spaces) that are used for mounting the file system. Use a dash (-) to indicate no options. For a list of commonly used mount options, see Table 39-2. |
Note - You must have an entry in each field in the /etc/vfstab file. If there is no value for the field, be sure to enter a dash (-). Otherwise, the system might not boot successfully. Similarly, white space should not be used in a field value.