Mounting File Systems
The following sections describe how to mount a file system by adding an entry in the /etc/vfstab file or by using the mount command from the command line.
How to Determine Which File Systems Are Mounted
You can determine which file systems are already 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
This example shows how to use the mount command to display information about the file systems that are currently mounted.
$ mount / on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror= ... /usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/onerror= ... /proc on /proc read/write/setuid/dev=4300000 on Fri Nov 30 11:25:13 2001 /etc/mnttab on mnttab read/write/setuid/dev=43c0000 on Fri Nov 30 11:25:13 ... /dev/fd on fd read/write/setuid/dev=4400000 on Fri Nov 30 11:25:17 2001 /var/run on swap read/write/setuid/xattr/dev=1 on Fri Nov 30 11:25:20 2001 /tmp on swap read/write/setuid/xattr/dev=2 on Fri Nov 30 11:25:24 2001 /export on /dev/dsk/c0t0d0s4 read/write/setuid/intr/largefiles/xattr/ ... /export/home on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/ ... $ |
How to Add an Entry to the /etc/vfstab File
Become superuser or assume an equivalent role.
Create a mount point for the file system to be mounted, if necessary.
# mkdir /mount-point
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.
Edit the /etc/vfstab file and add an entry. Make sure that you do the following:
Separate each field with white space (a space or a tab).
Enter a dash (-) if a field has no contents.
Save the changes.
For detailed information about the /etc/vfstab field entries, see Table 39-3.
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.
Examples--Adding an Entry to the /etc/vfstab File
The following example shows how to mount the disk slice /dev/dsk/c0t3d0s7 as a UFS file system to the mount point directory /files1. The raw character device /dev/rdsk/c0t3d0s7 is specified 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 - |
The following example shows how to mount the /export/man directory from the system pluto as an NFS file system on mount point /usr/man. A device to fsck nor a fsck pass is specified because it's an NFS file system. In this example, mount options are ro (read-only) and soft.
#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 shows how to mount the root (/) file system on a loopback mount point, /tmp/newroot. LOFS file systems must always be mounted after the file systems that are in 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 a File System (/etc/vfstab File)
Become superuser or assume an equivalent role.
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 (/etc/vfstab File)
The following example shows how to mount the /usr/dist file system that is listed in the /etc/vfstab file.
# mount /usr/dist |
Examples--Mounting All File Systems (/etc/vfstab File)
The following example shows the messages that are displayed if file systems are already mounted when you use the mountall command.
# mountall /dev/rdsk/c0t0d0s7 already mounted mount: /tmp already mounted mount: /dev/dsk/c0t0d0s7 is already mounted, /export/home is busy, or the allowable number of mount points has been exceeded |
All the file systems with a device to fsck entry are checked and fixed, if necessary, before they are mounted.
The following example shows how to mount all the local systems that are listed in the /etc/vfstab file.
# mountall -l # mount / on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror= ... /usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/ ... /proc on /proc read/write/setuid/dev=38c0000 on Tue Oct 30 15:45:32 2001 /etc/mnttab on mnttab read/write/setuid/dev=3980000 on Tue Oct 30 ... /dev/fd on fd read/write/setuid/dev=39c0000 on Tue Oct 30 15:45:36 2001 /var/run on swap read/write/setuid/xattr/dev=1 on Tue Oct 30 15:45:39 ... /tmp on swap read/write/setuid/xattr/dev=2 on Tue Oct 30 16:05:57 2001 /datab on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/xattr/ ... |
The following example shows how to mount all of the remote file systems that are listed in the /etc/vfstab file.
# mountall -r # mount / on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/xattr/onerror= ... /usr on /dev/dsk/c0t0d0s6 read/write/setuid/intr/largefiles/xattr/onerror= ... /proc on /proc read/write/setuid/dev=38c0000 on Tue Oct 30 15:45:32 2001 /etc/mnttab on mnttab read/write/setuid/dev=3980000 on Tue Oct 30 ... /dev/fd on fd read/write/setuid/dev=39c0000 on Tue Oct 30 15:45:36 2001 /var/run on swap read/write/setuid/xattr/dev=1 on Tue Oct 30 15:45:39 2001 /tmp on swap read/write/setuid/xattr/dev=2 on Tue Oct 30 16:05:57 2001 /datab on /dev/dsk/c0t0d0s7 read/write/setuid/intr/largefiles/xattr/ ... /home/rimmer on pluto:/export/home/rimmer remote/read/write/setuid/xattr ... |
How to Mount a UFS File System (mount Command)
Become superuser or assume an equivalent role.
Create a mount point for the file system to be mounted, if necessary.
# mkdir /mount-point
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.
Mount the UFS file system.
# mount [-o mount-options] /dev/dsk/device-name /mount-point
-o mount-options
Specifies mount options that you can use to mount a UFS file system. For a list of options, see Table 39-2 or mount_ufs(1M).
/dev/dsk/device-name
Specifies the disk device name for the slice that contains the file system (for example, /dev/dsk/c0t3d0s7). To get slice information for a disk, see "How to Display Disk Slice Information".
/mount-point
Specifies the directory on which to mount the file system.