Managing File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014

Mounting and Unmounting Oracle Solaris File Systems

ZFS file systems are mounted and unmounted automatically. You can make a legacy UFS 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 legacy UFS file systems that need to be mounted frequently. Local ZFS file systems are automatically mounted by an SMF service.
The /etc/vfstab file, which mounts the file system automatically when the system is booted in multi user state.
Remote legacy UFS 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.

For more information on mounting removable media, see Chapter 14, Managing Removable Media, in Managing Devices in Oracle Solaris 11.2 .

You can determine which file systems are already mounted by using the mount command:

$ mount [ -v ]

The –v displays the list of mounted file systems in verbose mode.

Example 2-6  Determining Which File Systems Are Mounted

This example shows how to use the mount command to display information about the file systems that are currently mounted.

$ mount
/ on rpool/ROOT/zfsBE read/write/setuid/devices/rstchown/dev=3390002 on Tue ...
/devices on /devices read/write/setuid/devices/rstchown/dev=8580000 on Tue May 15 ...
/dev on /dev read/write/setuid/devices/rstchown/dev=85c0000 on Tue May 15 14:49:01 2012
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=8680001 on Tue May 15 ...
/proc on proc read/write/setuid/devices/rstchown/dev=8600000 on Tue May 15 14:49:01 2012
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=86c0001 on Tue May 15 14:49:01 ...
/system/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=8700001 on Tue May 15 ...
/system/object on objfs read/write/setuid/devices/rstchown/dev=8740001 on Tue May 15 ...
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=8780001 on Tue May 15 ...
/lib/ on /usr/lib/libc/ read/write/setuid/devices/rstchown/dev ...
/dev/fd on fd read/write/setuid/devices/rstchown/dev=8880001 on Tue May 15 14:49:29 2012
/var on rpool/ROOT/zfsBE/var read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/ ...
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=8700002 on Tue May 15 14:49:29 2012
/var/share on rpool/VARSHARE read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/ ...
/home/rimmer on pluto:/export/home/rimmer remote/read/write/setuid/xattr/...

This example shows how to use the zfs mount command to display information about ZFS file systems that are currently mounted.

$ zfs mount
rpool/ROOT/zfsBE                /
rpool/ROOT/zfsBE                /var
rpool/VARSHARE                  /var/share
tank/home                       /tank/home

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 2-1  Field Descriptions for the /etc/vfstab File
Field Name
device to mount
This field identifies one of the following:
  • The block device name for a local legacy UFS file system (for example, /dev/dsk/c8t1d0s7).

  • The resource name for a remote file system (for example, myserver:/export/home).

    After you add an entry for a remote system resource, be sure that the following service is enabled.

    # svcs -a | grep nfs/client
    disabled       May_14   svc:/network/nfs/client:default
    # svcadm enable svc:/network/nfs/client:default

    For more information about NFS, see Managing Network File Systems in Oracle Solaris 11.2 .

  • The swap volume (for example, /dev/zvol/dsk/rpool/swap).

  • A directory for a virtual file system.

device to fsck
The raw (character) device name that corresponds to the legacy UFS file system identified by the device to mount field (for example, /dev/rdsk/c8t1d0s7). 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 legacy or remote file system (for example, /data).
FS type
Identifies the type of file system.
fsck pass
The pass number used by the fsck command to decide whether to check a legacy UFS 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, legacy UFS file systems are not checked. When the field contains a value greater than zero, the UFS file system is always checked.
All legacy UFS 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. This field should always be set to no 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 more information, see vfstab(4).

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.

Prerequisites for Unmounting Oracle Solaris File Systems

The prerequisites for unmounting file systems include the following:

  • You must be an administrator.

  • You cannot unmount a file system that is busy. A file system is considered busy if a user is accessing a directory in the file system, if a program has a file open in that file system, or if the file system is being shared.

    You can make a file system available for unmounting by doing the following:

    • Changing to a directory in a different file system.

    • Logging out of the system.

    • Using the fuser command to list all processes that are accessing the file system and to stop them, if necessary. For more details, see How to Stop All Processes That Are Accessing a File System.

      Notify users if you need to unmount a file system that they are using.

    • Unsharing the file system.

      • For example:

        # zfs set share.nfs=off tank/fs1
      • Use the legacy unshare method. For information, see unshare (1M) .

To verify that you unmounted a file system or a number of file systems, examine the output from the mount command:

$ mount | grep unmounted-file-system