Go to main content

Managing File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

The Virtual File System Table

Most file systems are mounted automatically by an SMF service at the system boot time. All file systems except for ZFS are mounted according to the /etc/vfstab file. The list of ZFS file systems to mount is taken from ZFS cache.

To add an entry for mounting a legacy or remote file system, the information you need to specify are as follows:

  • The device or the server where the file system resides

  • The file system mount point

  • File system type

  • Whether you want the file system to mount automatically when the system boots

  • Any mount options

The following vfstab example is from a system that has a ZFS root file system. In addition, this system is mounting a remote file system, /users/data, from the NFS server, neo.

# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd              -               /dev/fd         fd      -       no      -
/proc           -               /proc           proc    -       no      -
/dev/zvol/dsk/rpool/swap -      -               swap    -       no      -
/devices        -              /devices         devfs   -       no      -
sharefs         -              /etc/dfs/sharetabsharefs -       no      -
ctfs            -              /system/contract ctfs    -       no      -
objfs           -              /system/object   objfs   -       no      -
swap            -              /tmp             tmpfs   -       yes     -
neo:/users/data -              /data            nfs     -       yes     -

You can mount ZFS file systems from the vfstab file by using the legacy mount feature.

Field Descriptions for the /etc/vfstab File

An entry in the /etc/vfstab file has seven fields:

device to mount

Identifies one of the following resources:

  • Block device name for a local legacy UFS file system. For example, /dev/dsk/c8t1d0s7.

  • Resource name for a remote file system. For example, myserver:/export/home.

    After you add an entry for a remote system resource, ensure 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
  • Swap volume. For example, /dev/zvol/dsk/rpool/swap.

  • Directory for a virtual file system.

device to fsck

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. The raw device name that corresponds to the legacy UFS file system identified by the device to mount field.

mount point

Identifies where to mount the legacy or remote file system.

FS type

Identifies the type of file system.

fsck pass

The pass number indicates whether to check a legacy UFS file system. When the field contains a dash (-), the file system is not checked. In Oracle Solaris 11.4, the fsck pass value in the /etc/vfstab file is ignored during the boot process.

When this field is zero, legacy UFS file systems are not checked. When the field value is greater than zero, the UFS file system is 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, using the preen option, 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

Specifies whether the file system must be automatically mounted by mountall command when the system is booted. The option can be yes or no. 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 the vfstab(5) man page.


Note -  You must have an entry in each field in the /etc/vfstab file. If no value is supplied, the system boot might not be successful. Ensure that you add a dash (-) because white space cannot be used as a field value.

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

Displaying the Mounted File System

You can display the list of mounted file systems. There are several tools to display various information about all the mounted file systems. For example, the df command displays the capacity and free space on each file system.

For more information about the mounted file system, you can either check the output of the mount command or check the content of the /etc/mnttab file.

Using the Mounted File System Table

When you mount or unmount a file system, the /etc/mnttab file is updated with the list of currently mounted file systems. This file cannot be edited by any user including the administrator. The following example shows the /etc/mnttab file.

$ more /etc/mnttab
rpool/ROOT/zfsBE    /       zfs     dev=3390002     0
/devices        /devices        devfs   dev=8580000     1337114941
/dev    /dev    dev     dev=85c0000     1337114941
ctfs    /system/contract        ctfs    dev=8680001     1337114941
proc    /proc   proc    dev=8600000     1337114941
mnttab  /etc/mnttab     mntfs   dev=86c0001     1337114941
swap    /system/volatile        tmpfs   xattr,dev=8700001   1337114941
objfs   /system/object  objfs   dev=8740001     1337114941
sharefs /etc/dfs/sharetab       sharefs dev=8780001     1337114941
/usr/lib/libc/libc_hwcap2.so.1  /lib/libc.so.1  lofs dev=3390002  13371149
fd      /dev/fd fd      rw,dev=8880001  1337114969
rpool/ROOT/zfsBE/var        /var    zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=3390003        1337114969
swap    /tmp    tmpfs   xattr,dev=8700002       1337114969
rpool/VARSHARE  /var/share      zfs     rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime,dev=3390004        133711496

Obtaining the List of Mounted File Systems Using the mount Command

In addition to mounting file systems, the mount command displays the list of all the mounted file systems when resource and mount point are not specified. This list can be altered by using the –p option to obtain a format more suitable for processing by other programs or scripts.

The following example shows the list of mounted file systems using the mount command without any arguments.

# mount
/ on rpool/ROOT/zfsBE read/write/setuid/devices/rstchown/dev=45d0002 on Thu Jan  1 01:00:00 1970
/devices on /devices read/write/setuid/devices/rstchown/dev=8b00000 on Mon Jun 20 14:46:48 2016
/dev on /dev read/write/setuid/devices/rstchown/dev=8b40000 on Mon Jun 20 14:46:48 2016
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=8c40001 on Mon Jun 20 14:46:48 2016
/proc on proc read/write/setuid/devices/rstchown/dev=8b80000 on Mon Jun 20 14:46:48 2016
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=8c80001 on Mon Jun 20 14:46:48 2016
/system/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=8cc0001 on Mon Jun 20 14:46:48 2016
/system/object on objfs read/write/setuid/devices/rstchown/dev=8d00001 on Mon Jun 20 14:46:48 2016
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=8d40001 on Mon Jun 20 14:46:48 2016
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap2.so.1 read/write/setuid/devices/rstchown/dev=45d0002 on Mon Jun 20 14:47:03 2016
/dev/fd on fd read/write/setuid/devices/rstchown/dev=8e00001 on Mon Jun 20 14:47:04 2016
/var on rpool/ROOT/s114_14/var read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=45d0004 on Mon Jun 20 14:47:36 2016
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=8cc0002 on Mon Jun 20 14:47:36 2016
/var/share on rpool/VARSHARE read/write/nosetuid/devices/rstchown/nonbmand/noexec/noxattr/atime/dev=45d0005 on Mon Jun 20 14:47:37 2016
/export on rpool/export read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=45d0006 on Mon Jun 20 14:47:53 2016
/export/home on rpool/export/home read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=45d0007 on Mon Jun 20 14:47:54 2016
/export/home/jack on rpool/export/home/jack read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=45d0008 on Mon Jun 20 14:47:56 2016
/rpool on rpool read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=45d0009 on Mon Jun 20 14:47:56 2016
/mnt on /dev/dsk/c2t1d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=3400080 on Tue Jun 21 13:39:25 2016

The following example shows the output suitable for automated parsing. The format is the same as the /etc/vfstab file.

# mount -p 
rpool/ROOT/zfsBE - / zfs - no 
/devices - /devices devfs - no 
/dev - /dev dev - no 
ctfs - /system/contract ctfs - no 
proc - /proc proc - no 
mnttab - /etc/mnttab mntfs - no 
swap - /system/volatile tmpfs - no xattr
objfs - /system/object objfs - no 
sharefs - /etc/dfs/sharetab sharefs - no 
/usr/lib/libc/libc_hwcap2.so.1 - /lib/libc.so.1 lofs - no 
fd - /dev/fd fd - no rw
rpool/ROOT/zfsBE/var - /var zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
swap - /tmp tmpfs - no xattr
rpool/VARSHARE - /var/share zfs - no rw,devices,nosetuid,nonbmand,noexec,rstchown,noxattr,atime
rpool/export - /export zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/export/home - /export/home zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool/export/home/jack - /export/home/jack zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
rpool - /rpool zfs - no rw,devices,setuid,nonbmand,exec,rstchown,xattr,atime
/dev/dsk/c2t1d0s0 - /mnt ufs - no rw,intr,largefiles,logging,xattr,onerror=panic