Go to main content

Managing File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

Mounting a File System

Mounting operation connects the file system subtree that is on a specific device to the file system tree. The transition between different file systems is transparent and is equal to navigating to another directory.

To mount a file system, use the mount command. For more information, see the mount(8) man page.

For information about mounting ZFS file systems, see Mounting ZFS File Systems in Managing ZFS File Systems in Oracle Solaris 11.4.

Mounting a Disk Based File System

Apart from the device specification, all the command arguments are similar to other file systems. For disk based file system, a path to block device specifies the device. The syntax for the mount command is as follows:

# mount [-F fs-type] [-o mount-options] /dev/dsk/device-name /directory-name
–F fs-type

The type of file system to be mounted. If the option is not set, mount assumes that it is a UFS file system.

–o mount-options

Some mount options are common to all types of file system. However, each file system provides a different list of mount options depending on its features. Some of the common options are rw and ro, which set the access to the file system to read and write, or read-only.

/dev/dsk/device-name

The path to the block device of a slice or partition containing the file system.

/directory-name

The directory where you want to mount the file system.

When a file system is specified in the virtual file system table /etc/vfstab, you can omit the device name or the mount point. The mount command refers to the /etc/vfstab file for missing information and mount options, and merges them with the arguments provided by the user.

Example 5  Mounting a UFS File System

The following example shows how to mount a UFS in slice 3 to the /export/park directory.

# mount -F ufs /dev/dsk/c0t0d0s3 /export/park

Mounting a PCFS File System

Oracle Solaris uses a special naming scheme to access DOS partitions where the PCFS file system is usually stored. The resource consists of a path to a block device of the whole disk and a logical drive specifier.

# mount -F pcfs /dev/dsk/device-name:logical-drive /mount-point
/dev/dsk/device-name

Specifies the device name of the whole disk. For example, /dev/dsk/c0t0d0p0 on an x86 system or /dev/dsk/c0t0d0s2 on a SPARC system.

logical-drive

Specifies either the DOS logical drive letter (C through Z) or a drive number (1 through 24). Drive C is equivalent to drive 1, and represents the primary DOS partition on the drive. All other letters or numbers represent DOS logical drives within the extended DOS partition.


Note -  You must use a colon to separate the device-name and logical-drive.
Example 6  Mounting a PCFS File System From a Primary Partition on x86 and SPARC Systems

The following example shows how to mount a logical drive in the primary DOS partition on the /pcfs/c directory on an x86 system.

# mount -F pcfs /dev/dsk/c0t0d0p0:c /pcfs/c

The following example shows how to mount a logical drive in the primary DOS partition on the /pcfs/c directory on a SPARC system.

# mount -F pcfs /dev/dsk/c0t0d0s2:c /pcfs/c
Example 7  Mounting a PCFS (DOS) File System From a Logical Partition on x86 and SPARC Systems

The following example shows how to read only mount the first logical drive in the extended DOS partition located on the /mnt directory on an x86 system.

# mount -F pcfs -o ro /dev/dsk/c0t0d0p0:2 /mnt

The following example shows how to read only mount the first logical drive in the extended DOS partition located on the /mnt directory on a SPARC system.

# mount -F pcfs -o ro /dev/dsk/c0t0d0s2:2 /mnt

Caution  -  On an x86 system, the DOS partitions are available as devices named c0t0d0p1 to c0t0d0p4 for primary partitions and c0t0d0p5 to c0t0d0p32 for logical partitions. Those can also be used to mount and access PCFS file system. Ensure to use notation either consistently or exclusively. Using the same file system twice can corrupt the file system.


Mounting a Network Based File System

For a network based file system, the resource specification consists of a server name and a path to a directory. This resource specification is also called a share. For more information about how to create a share over a specific network protocol see, Managing Network File Systems in Oracle Solaris 11.4 and Managing SMB File Sharing and Windows Interoperability in Oracle Solaris 11.4. You can also refer to your operating system documentation.

# mount -F (nfs|smbfs) [-o mount-options] server:/directory /mount-point

You can automate the network based file systems by using the automount command. For more information about the automounter, see Chapter 4, Administering Autofs in Managing Network File Systems in Oracle Solaris 11.4 and the automount(8) man page.

Example 8  Mounting an NFS File System

The following example shows how to mount the /export/packages directory on /mnt from the server, pluto.

# mount -F nfs pluto:/export/packages /mnt
Example 9  Mounting a CIFS or an SMB File System

The following example shows how to mount the /data/workspace directory on /mnt from the server, neptune.

# mount -F smbfs neptune:/data/workspace /mnt

Mounting a File System Image

You can specify a regular file containing a file system image instead of specifying a device.

# mount -F fs-type [-o mount-options] path-to-image-file /mount-point

Depending on the capability of the file system driver, an image is mounted as read-only, or read-write. For example, HSFS image can be mounted only for reading while PCFS image can be mounted for reading or writing.

Example 10  Mounting an Image of HSFS File System

The following example shows how to mount the HSFS image stored in /tank/build/image.iso on the /mnt file system.

# mount -F hsfs /tank/build/image.iso /mnt