Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
39.  Mounting and Unmounting File Systems (Tasks) Mounting File Systems How to Mount a UFS File System (mount Command)  Previous   Contents   Next 
   
 

Example--Mounting a UFS File System (mount Command)

The following example shows how to mount /dev/dsk/c0t3d0s7 on the /files1 directory.

# mount /dev/dsk/c0t3d0s7 /files1

Example--Mounting a UFS File System With Logging Enabled (mount Command)

UFS logging eliminates file system inconsistency, which can significantly reduce the time of system reboots. The following example shows how to mount /dev/dsk/c0t3d0s7 on the /files1 directory with logging enabled.

# mount -o logging /dev/dsk/c0t3d0s7 /files1

How to Mount a UFS File System Without Large Files (mount Command)

When you mount a file system, the largefiles option is selected by default, which enables you to create files larger than 2 Gbytes. Once a file system contains large files, you cannot remount the file system with the nolargefiles option or mount it on a system that is running Solaris 2.6 or compatible versions, until you remove any large files and run the fsck command to reset the state to nolargefiles.

This procedure assumes that the file system is in the /etc/vfstab file.

  1. Become superuser or assume an equivalent role.

  2. 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.

  3. Make sure there are no large files in the file system.

    # cd /mount-point
    # find . -xdev -size +20000000 -exec ls -l {} \;

    /mount-point identifies the mount point of the file system you want to check for large files.

  4. Remove or move any large files in this file system to another file system, if necessary.

  5. Unmount the file system.

    # umount /mount-point
  6. Reset the file system state.

    # fsck /mount-point
  7. Remount the file system with the nolargefiles option.

    # mount -o nolargefiles /mount-point

Example--Mounting a File System Without Large Files (mount Command)

The following example shows how to check the /datab file system and remount it with the nolargefiles option.

# cd /datab
# find . -xdev -size +20000000 -exec ls -l {} \;
# umount /datab 
# fsck /datab
# mount -o nolargefiles /datab

How to Mount an NFS File System (mount Command)

  1. Become superuser or assume an equivalent role.

  2. 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.

  3. Make sure the resource (file or directory) is available from a server.

    To mount an NFS file system, the resource must be made available on the server by using the share command. For information on how to share resources, see "About the NFS Service" in System Administration Guide: Resource Management and Network Services.

  4. Mount the NFS file system.

    # mount -F nfs [-o mount-options] server:/directory /mount-point

    -o mount-options

    Specifies mount options that you can use to mount an NFS file system. See Table 39-2 for the list of commonly used mount options or mount_nfs(1M) for a complete list of options.

    server:/directory

    Specifies the server's host name that contains the shared resource, and the path to the file or directory to mount.

    /mount-point

    Specifies the directory on which to mount the file system.

Example--Mounting an NFS File System (mount Command)

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

# mount -F nfs pluto:/export/packages /mnt

IA: How to Mount a PCFS (DOS) File System From a Hard Disk (mount Command)

Use the following procedure to mount a PCFS (DOS) file system from a hard disk.

  1. Become superuser or assume an equivalent role.

  2. 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.

  3. Mount the PCFS file system.

    # mount -F pcfs [-o rw | ro] /dev/dsk/device-name:logical-drive /mount-point

    -o rw | ro

    Specifies that you can mount a PCFS file system read/write (rw) or read-only (ro). If you do not specify this option, the default is rw.

    /dev/dsk/device-name

    Specifies the device name of the whole disk (for example, /dev/dsk/c0t0d0p0).

    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 slice on the drive. All other letters or numbers represent DOS logical drives within the Extended DOS slice.

    /mount-point

    Specifies the directory on which to mount the file system.

    Note that the device-name and logical-drive must be separated by a colon.

IA: Examples--Mounting a PCFS (DOS) File System From a Hard Disk (mount Command)

The following example shows how to mount the logical drive in the primary DOS slice on the /pcfs/c directory.

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

The following example shows how to mount the first logical drive in the extended DOS slice read-only on /mnt.

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

Unmounting File Systems

The unmounting of a file system removes it from the file system mount point, and deletes the entry from the /etc/mnttab file. Some file system administration tasks cannot be performed on mounted file systems. You should unmount a file system when the following occurs:

  • The file system is no longer needed or has been replaced by a file system that contains more current software.

  • You need to check and repair the file system by using the fsck command. For more information about the fsck command, see Chapter 42, Checking UFS File System Consistency (Tasks).

    It is a good idea to unmount a file system before doing a complete backup. For more information about doing backups, see Chapter 46, Backing Up Files and File Systems (Tasks).


    Note - File systems are automatically unmounted as part of the system shutdown procedure.


You can use the umount -f option to forcibly unmount a file system that is busy in an emergency situation. This practice is not recommended under normal circumstances because the unmounting of a file system with open files could cause a loss of data. This option is only available for UFS and NFS file systems.

Prerequisites for Unmounting File Systems

The prerequisites for unmounting file systems include the following:

  • You must be superuser or assume an equivalent role.

  • A file system must be available for unmounting. You cannot unmount a file system that is busy. A file system is considered busy if a user is accessing a directory in the file system, if a program has a file open in that file system, or if it is being shared. You can make a file system available for unmounting by doing the following:

    • Changing to a directory in a different file system.

    • Logging out of the system.

    • Using the fuser command to list all processes that are accessing the file system and to stop them if necessary. For more details, see "How to Stop All Processes Accessing a File System".

      Notify users if you need to unmount a file system that they are using.

    • Unsharing the file system. For information about unsharing a file system, see unshare(1M).

 
 
 
  Previous   Contents   Next