System Administration Guide, Volume I

Mounting File Systems Using the /etc/vfstab File

/etc/vfstab Field Descriptions

An entry in the /etc/vfstab file has seven fields, which are described in Table 28-4.

Table 28-4 /etc/vfstab Field Descriptions

Field Name 

Description 

device to mount

  • 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 the NFS Administration Guide.

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

  • The /proc directory and proc file system type.

device to fsck

The raw (character) device name that corresponds to the file system identified by the device to mount field (for example, /dev/rdsk/c0t0d0s0). This determines the raw interface that is used by fsck. Use a dash (-) when there is no applicable device, such as for a read-only file system or a remote file system.

mount point

The default mount point directory (for example, /usr).

 

FS type

The type of file system identified by the device to mount field.

fsck pass

The pass number used by fsck 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; non-UFS file systems are checked. When the field contains a value greater than zero, the file system is checked.  

When the field contains a value of 1, the file system is checked sequentially. When fsck is run on multiple UFS file systems that have fsck pass values greater than one and the preen option (-o p) is used, fsck automatcially checks the file systems on different disks in parallel to maximize efficiency. Otherwise, the value of the pass number does not have any effect.

The fsck pass field does not explicitly specify the order in which file systems are checked.

mount at boot

Set to yes or no for whether the file system should be automatically mounted by mountall when the system is booted. Note that this field has nothing to do with AutoFS.

mount options

A list of comma-separated options (with no spaces) that are used in mounting the file system. Use a dash (-) to show no options. See Table 28-3 for a list of commonly used mount options.


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 (-).


How to Add an Entry to the /etc/vfstab File

  1. Become superuser.

    Also, there must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  2. Edit the /etc/vfstab file and add an entry.


    Note -

    Since the root (/) file system is mounted read-only by the kernel during the boot process, only the remount option (and options that can be used in conjunction with remount) affect the root (/) entry in the /etc/vfstab file.


    See Table 28-4 for detailed information about the /etc/vfstab field entries. Make sure that you:

    • Separate each field with white space (a space or a tab).

    • Enter a dash (-) if a field has no contents.

  3. Save the changes.

Examples--Adding an Entry to the /etc/vfstab File

The following example mounts the disk slice /dev/dsk/c0t3d0s7 as a UFS file system attached to the mount point directory /files1 with the default mount options (read/write). It specifies the raw character device /dev/rdsk/c0t3d0s7 as the device to fsck. The fsck pass value of 2 means that the file system will be checked, but not sequentially.


#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
#
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /files1  ufs      2      yes       -
/                   -                /tmp/newroot lofs -      yes       -                   

The following example mounts the directory /export/man from the system pluto as an NFS file system on mount point /usr/man. It does not specify a device to fsck or a fsck pass because it's an NFS file system. In this example, mount options are ro (read-only) and soft. For greater reliability, specify the hard mount option for read/write NFS file systems.


#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
pluto:/export/man   -                /usr/man nfs      -      yes       ro,soft

The following example mounts the root (/) file system on a loopback mount point named /tmp/newroot. It specifies yes for mount at boot, no device to fsck, and no fsck pass number. LOFS file systems must always be mounted after the file systems used to make up the LOFS file system.


#device           device             mount    FS       fsck   mount    mount
#to mount         to fsck            point    type     pass   at boot  options
#
/                   -                /tmp/newroot lofs -      yes       -                   

How to Mount Multiple File Systems Listed in the /etc/vfstab File

  1. Become superuser.

    Also, there must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  2. Mount the file systems listed in the /etc/vfstab file.


    # mountall [-l | -r] [-F fstype]

    If no options are specified, all file systems listed in the /etc/vfstab file with yes in the mount at boot field are mounted.

    -l

    Mounts all the local file systems listed in the /etc/vfstab file with yes in the mount at boot field.

    -r

    Mounts all the remote file systems listed in the /etc/vfstab file with yes in the mount at boot field.

    -F fstype

    Mounts all file systems of the specified type listed in the /etc/vfstab file with yes in the mount at boot field.

    All the file systems with a device to fsck entry are checked and fixed, if necessary, before mounting.

Examples--Mounting Multiple File Systems Listed in the /etc/vfstab File

The following example shows the messages displayed if file systems are already mounted when you use the mountall command.


# mountall
mount: /tmp already mounted
nfs mount: mount: /usr/openwin: Device busy
nfs mount: mount: /usr/man: Device busy

The following example mounts all the local systems listed in the /etc/vfstab file.


# mountall -l
# mount
/ on /dev/dsk/c0t3d0s0 read/write/setuid/largefiles on ...
/usr on /dev/dsk/c0t3d0s6 read/write/setuid/largefiles on ...
/proc on /proc read/write/setuid on Wed May 27 09:11:50 1998
/dev/fd on fd read/write/setuid on Wed May 27 09:11:50 1998
/tmp on swap read/write on Wed May 27 09:11:50 1998

The following example mounts all the remote file systems listed in the /etc/vfstab file.


# mountall -r
# mount
/ on /dev/dsk/c0t3d0s0 read/write/setuid/largefiles on ...
/usr on /dev/dsk/c0t3d0s6 read/write/setuid/largefiles on ...
/proc on /proc read/write/setuid on Mon Jun  8 10:28:31 1998
/dev/fd on fd read/write/setuid on Mon Jun  8 10:28:31 1998
/tmp on swap read/write on Mon Jun  8 10:28:31 1998
/nfs/mars.dist on mars:/usr/dist intr/remote on ...
/nfs/mars.mail on mars:/var/mail intr/noac/remote on ...

How to Mount a File System Listed in the /etc/vfstab File

  1. Become superuser.

    Also, there must be a mount point on the local system to mount a file system. A mount point is a directory to which the mounted file system is attached.

  2. Mount a file system listed in the /etc/vfstab file.


    # mount mount-point
    

    mount-point

    Specifies an entry in the mount point or device to mount field in the /etc/vfstab file. It is usually easier to specify the mount point.

Example--Mounting a File System Listed in the /etc/vfstab File

The following example mounts the /usr/openwin file system listed in the /etc/vfstab file.


# mount /usr/openwin