System Administration Guide, Volume I

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. Any other file system can be connected or disconnected from the root (/) file system.

Table 28-1 provides guidelines on mounting file systems based on how you use them.

Table 28-1 Determining How to Mount File Systems

If You Need to Mount ... 

Then You Should Use ... 

Local or remote file systems infrequently 

The mount command entered manually from the command line.

Local file systems frequently 

The /etc/vfstab file, which will mount the file system automatically when the system is booted in multi-user state.

Remote file systems frequently, such as home directories 

  • The /etc/vfstab file, which will automatically mount the file system when the system is booted in multi-user state.

  • AutoFS, which will automatically mount or unmount the file system when you change into (mount) or out of (unmount) the directory.

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

You can mount a CD-ROM containing a file system by simply inserting it into the drive (Volume Management will automatically mount it). You can mount a diskette containing a file system by inserting it into the drive and running the volcheck(1) command. See Chapter 11, Guidelines for Using CDs and Diskettes (Overview) for more information.

Commands Used to Mount and Unmount File Systems

Table 28-2 lists the commands in the /usr/sbin directory that you use to mount and unmount file systems.

Table 28-2 Commands for Mounting and Unmounting File Systems

Command 

Description 

mount(1M)

Mounts file systems and remote resources. 

mountall(1M)

Mounts all file systems specified in the /etc/vfstab file. The mountall command is run automatically when entering multiuser run states.

umount(1M)

Unmounts file systems and remote resources. 

umountall(1M)

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

The mount commands will not mount a read/write file system that has inconsistencies. If you receive an error message from the mount or mountall command, you may need to check the file system. See Chapter 31, Checking File System Integrity for information on how to check the file system.

The umount commands will not unmount a file system that is busy. A file system is considered busy if a user is in a directory in the file system, or if a program has a file open in that file system.

Commonly Used Mount Options

Table 28-3 describes the commonly used mount options that you can specify with the -o option of the mount command. 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 command man pages (for example, mount_ufs(1M)).

Table 28-3 Commonly Used -o Mount Options

Option 

File System 

Description 

bg | fg

NFS 

If the first attempt fails, retries in the background (bg) or in the foreground (fg). The default is fg.

f

UFS 

Fakes an entry in /etc/mnttab, but doesn't really mount any file systems.

hard | soft

NFS 

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

intr | nointr

NFS 

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

largefiles | nolargefiles

UFS 

Enables you to create file systems containing files larger than 2 Gbytes. The largefiles option means that a filesystem mounted with this option may contain files larger than 2 Gbytes, but it is not a requirement. The default is largefiles.

logging | nologging

UFS 

Enables logging for the file system. UFS logging is the process of storing transactions (changes that make up a complete UFS operation) into a log before the transactions are applied to the UFS file system. Because the file system can never become inconsistent, fsck can be bypassed, which reduces the time to reboot a system if it crashes, or after an unclean halt.

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

m

CacheFS, NFS, PCFS, S5FS, UFS 

Mounts the file system without making an entry in /etc/mnttab.

noatime

UFS 

Ignores access time updates on files, except when they coincide with updates to the ctime or mtime. 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

NFS, S5FS, UFS 

Remounts a read-only file system as read-write (using the rw option). This option can be used only in conjunction with the f, logging | nologging, and m options. This option works only on currently mounted read-only file systems.

retry=n

NFS 

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

ro | rw

CacheFS, NFS, PCFS, UFS, S5FS 

Specifies read/write or read-only. If you do not specify this option, the default is read/write. 

suid | nosuid

CacheFS, HSFS, NFS, S5FS, UFS 

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

How to Determine Which File Systems Are Mounted

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


$ mount -v

-v

Displays the list of mounted file systems in verbose mode. 

Example--Determining Which File Systems Are Mounted


$ 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
/export on /dev/dsk/c0t3d0s3 setuid/read/write/largefiles on ...
/export/home on /dev/dsk/c0t3d0s7 setuid/read/write/largefiles on ...
/export/swap on /dev/dsk/c0t3d0s4 setuid/read/write/largefiles on ...
/opt on /dev/dsk/c0t3d0s5 setuid/read/write/largefiles on ...
/tmp on swap read/write on Mon Jun 8 10:28:31 1998
$