System Administration Guide: Devices and File Systems
Previous Next

Overview of Mounting File Systems

After you create a file system, you need to make it available to the system so that 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 type 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,, such as home directories, that need to be mounted frequently

  • The /etc/vfstab file, which automatically mounts the file system when the system is booted in multiuser state.

  • AutoFS, which automatically mounts the file system when you access it or unmounts the file system when you change to another directory.

To enhance performance, you can also cache the remote file systems by using the CacheFS file system.

You can mount removable 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 1, 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 19-1 Commands for Mounting and Unmounting File Systems

Command

Description

Man Page

mount

Mounts file systems and remote resources.

mount(1M)

mountall

Mounts all file systems that are specified in the /etc/vfstab file. The mountall command runs automatically when the system enters multiuser mode.

mountall(1M)

umount

Unmounts file systems and remote resources.

mount(1M)

umountall

Unmounts all file systems that are specified in the /etc/vfstab file.

mountall(1M)

Keep the following key points in mind when using the mount and mountall commands:

  • The mount and mountall commands cannot 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 22, Checking UFS File System Consistency (Tasks) for information on how to check the file system.

  • The umount and umountall commands do 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.

    • A program has a file open in that file system.

    • The file system is shared.

  • You can use the remount option when remounting from read-only access to read-write access only. You cannot remount from read-write access to read-only access.

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 page (for example, mount_ufs(1M)).

Table 19-2 Commonly Used -o Mount Options

mount Option

File System

Description

bg | fg

NFS

If the first mount attempt fails, retries another mount in the background (bg) or in the foreground (fg). This option is safe for non critical vfstab entries. The default is fg.

hard | soft

NFS

Specifies the procedure if the server does not respond. The soft option indicates that an error is returned. The hard option indicates that the retry request is continued until the server responds. The default is hard.

intr | nointr

NFS

Specifies whether keyboard interrupts are delivered to a hung process while waiting for a response on a hard-mounted file system. The default is intr (interrupts allowed).

largefiles | nolargefiles

UFS

Enables you to create files larger than 2 Gbytes. The largefiles option means that a file system mounted with this option might contain files larger than 2 Gbytes. If the nolargefiles option is specified, the file system cannot be mounted on a system that is running Solaris 2.6 or compatible versions. The default is largefiles.

logging | nologging

UFS

Enables or disables logging for the file system. UFS logging is the process of storing transactions (changes that comprise a complete UFS operation) into a log before the transactions are applied to the UFS file system. Logging helps prevent UFS file systems from becoming inconsistent, which means fsck can be bypassed. Bypassing fsck reduces the time to reboot a system if it crashes, or after a system is shut down uncleanly.

The log is allocated from free blocks on the file system, and is sized at about 1 Mbyte per 1 Gbyte of file system, up to a maximum of 64 Mbytes. The default is logging.

atime | noatime

UFS

Suppresses access time updates on files, except when they coincide with updates to the time of the last file status change or the time of the last file modification. For more information, see stat(2). This option reduces disk activity on file systems where access times are unimportant (for example, a Usenet news spool). The default is normal access time (atime) recording.

remount

All

Changes the mount options associated with an already-mounted file system. This option can generally be used with any option except ro. However, what can be changed with this option depends on the file system type.

retry=n

NFS

Retries the mount operation when it fails. n is the number of times to retry.

ro | rw

CacheFS, NFS, PCFS, UFS, HSFS

Specifies read/write (rw) or read-only (ro). If you do not specify this option, the default is rw. The default option for HSFS is ro.

suid | nosuid

CacheFS, HSFS, NFS, UFS

Allows or disallows setuid execution. The default is to allow setuid execution.

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 19-3 Field Descriptions for the /etc/vfstab File

Field Name

Description

device to mount

This field identifies one of the following:

  • The block device name for a local UFS file system (for example, /dev/dsk/c0t0d0s0).

  • The resource name for a remote file system (for example, myserver:/export/home). For more information about NFS, see System Administration Guide: IP Services.

  • The block device name of the slice on which to swap (for example, /dev/dsk/c0t3d0s1).

  • A directory for a virtual file system.

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. Currently, the fsck pass value in the /etc/vfstab file is ignored during the boot process.

When the field contains a zero, UFS file systems are not checked. However, 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 1 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 19-2.


Note - You must have an entry in each field in the /etc/vfstab file. If there is no value for a field, be sure to specify a dash (-). Otherwise, the system might not boot successfully. Similarly, white space should not be used as a field value.


Previous Next