System Administration Guide: Network Services

Mounting File Systems

You can mount file systems in several ways. File systems can be mounted automatically when the system is booted, on demand from the command line, or through the automounter. The automounter provides many advantages to mounting at boot time or mounting from the command line. However, many situations require a combination of all three methods. Additionally, several ways of enabling or disabling processes exist, depending on the options you use when mounting the file system. See the following table for a complete list of the tasks that are associated with file-system mounting.

Table 5–2 Task Map for Mounting File Systems

Task 

Description 

For Instructions 

Mount a file system at boot time 

Steps so that a file system is mounted whenever a system is rebooted. 

How to Mount a File System at Boot Time.

Mount a file system by using a command 

Steps to mount a file system when a system is running. This procedure is useful when testing. 

How to Mount a File System From the Command Line.

Mount with the automounter 

Steps to access a file system on demand without using the command line. 

Mounting With the Automounter.

Mount a file system with mirrormounts 

Solaris Express, Developer Edition 1/08 release only: Steps to mount one or more file systems using mirrormounts 

Using Mirrormounts After Mounting a File System

Mount all file systems with mirrormounts 

Solaris Express, Developer Edition 1/08 release only: Steps to mount all of the file systems from one server. 

How to Mount All File Systems from a Server

Prevent large files 

Steps to prevent large files from being created on a file system. 

How to Disable Large Files on an NFS Server.

Start client-side failover 

Steps to enable the automatic switchover to a working file system if a server fails. 

How to Use Client-Side Failover.

Disable mount access for a client 

Steps to disable the ability of one client to access a remote file system. 


Note –

The procedure shows you how to use the sharemgr command. The example that follows the procedure uses the share and shareall commands to complete the same task.


How to Disable Mount Access for One Client.

Provide access to a file system through a firewall 

Steps to allow access to a file system through a firewall by using the WebNFS protocol. 

How to Mount an NFS File System Through a Firewall.

Mount a file system by using an NFS URL 

Steps to allow access to a file system by using an NFS URL. This process allows for file-system access without using the MOUNT protocol. 

How to Mount an NFS File System Using an NFS URL.

ProcedureHow to Mount a File System at Boot Time

If you want to mount file systems at boot time instead of using autofs maps, follow this procedure. This procedure must be completed on every client that should have access to remote file systems.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add an entry for the file system to /etc/vfstab.

    Entries in the /etc/vfstab file have the following syntax:

    special  fsckdev  mountp  fstype  fsckpass  mount-at-boot  mntopts

    See the vfstab(4) man page for more information.


    Caution – Caution –

    NFS servers that also have NFS client vfstab entries must always specify the bg option to avoid a system hang during reboot. For more information, see mount Options for NFS File Systems.



Example 5–4 Entry in the Client's vfstab File

You want a client machine to mount the /var/mail directory from the server wasp. You want the file system to be mounted as /var/mail on the client and you want the client to have read-write access. Add the following entry to the client's vfstab file.


wasp:/var/mail - /var/mail nfs - yes rw

ProcedureHow to Mount a File System From the Command Line

Mounting a file system from the command line is often performed to test a new mount point. This type of mount allows for temporary access to a file system that is not available through the automounter.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Mount the file system.

    Type the following command:


    # mount -F nfs -o ro bee:/export/share/local /mnt
    

    In this instance, the /export/share/local file system from the server bee is mounted on read-only /mnt on the local system. Mounting from the command line allows for temporary viewing of the file system. You can unmount the file system with umount or by rebooting the local host.


    Caution – Caution –

    Starting with the Solaris 2.6 release, all versions of the mount command do not warn about invalid options. The command silently ignores any options that cannot be interpreted. To prevent unexpected behavior, ensure that you verify all of the options that were used.



Example 5–5 Using Mirrormounts After Mounting a File System

The Solaris Express, Developer Edition 1/08 release includes the mirrormount facility. This new mounting technology can be used from any NFSv4 client accessing a second file system from an NFSv4 server. Once the first file system is mounted from the server using either the mount command or the automounter, then any file systems that are added to that mount point may be accessed. All you have to do is try to access the file system. The mirrormount occurs automatically. For more information, see How Mirrormounts Work.


Mounting With the Automounter

Task Overview for Autofs Administration includes the specific instructions for establishing and supporting mounts with the automounter. Without any changes to the generic system, clients should be able to access remote file systems through the /net mount point. To mount the /export/share/local file system from the previous example, type the following:


% cd /net/bee/export/share/local

Because the automounter allows all users to mount file systems, root access is not required. The automounter also provides for automatic unmounting of file systems, so you do not need to unmount file systems after you are finished.

See Using Mirrormounts After Mounting a File System for information about how to mount additional file systems on a client running the Solaris Express, Developer Edition 1/08 release.

ProcedureHow to Mount All File Systems from a Server

The Solaris Express, Developer Edition 1/08 release includes the mirrormount facility, which allows a client to access all available file systems shared using NFS from a server, once one mount from that server has succeeded. For more information, see How Mirrormounts Work.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Mount the root of the exported namespace of the server.

    This command mirrors the file system hierarchy from the server on the client. In this case, a /mnt/export/share/local directory structure is created.


    # mount bee:/ /mnt
    
  3. Access a file system.

    This command or any other command which accesses the file system causes the file system to be mounted.


    # cd /mnt/export/share/local
    

ProcedureHow to Disable Large Files on an NFS Server

For servers that are supporting clients that cannot handle a file over 2 GBytes, you might need to disable the ability to create large files.


Note –

Versions prior to the 2.6 release of the Solaris release cannot use large files. If the clients need to access large files, check that the clients of the NFS server are running, at minimum, the 2.6 release.


  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Check that no large files exist on the file system.

    For example:


    # cd /export/home1
    # find . -xdev -size +2000000 -exec ls -l {} \;
    

    If large files are on the file system, you must remove or move these files to another file system.

  3. Unmount the file system.


    # umount /export/home1
    
  4. Reset the file system state if the file system has been mounted by using largefiles.

    fsck resets the file system state if no large files exist on the file system:


    # fsck /export/home1
    
  5. Mount the file system by using nolargefiles.


    # mount -F ufs -o nolargefiles /export/home1
    

    You can mount from the command line, but to make the option more permanent, add an entry that resembles the following into /etc/vfstab:


    /dev/dsk/c0t3d0s1 /dev/rdsk/c0t3d0s1 /export/home1  ufs  2  yes  nolargefiles

ProcedureHow to Use Client-Side Failover

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. On the NFS client, mount the file system by using the ro option.

    You can mount from the command line, through the automounter, or by adding an entry to /etc/vfstab that resembles the following:


    bee,wasp:/export/share/local  -  /usr/local  nfs  -  no  ro

    This syntax has been allowed by the automounter. However, the failover was not available while file systems were mounted, only when a server was being selected.


    Note –

    Servers that are running different versions of the NFS protocol cannot be mixed by using a command line or in a vfstab entry. Mixing servers that support NFS version 2, version 3, or version 4 protocols can only be performed with autofs. In autofs, the best subset of version 2, version 3, or version 4 servers is used.


ProcedureHow to Disable Mount Access for One Client

Starting with the Solaris Express, Developer Edition 2/07 release, you can do the following:


Note –

When you use sharemgr, you do not need to use the share, shareall, and unshare commands. Also, you do not need to edit the /etc/dfs/dfstab file.


The following procedure uses the sharemgr utility. If you prefer to use the share and shareall utilities, see the example that follows this procedure.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Disable mount access for one client.

    For example:


    # sharemgr set ro=-rose:eng my-group
    -rose:eng

    The access-list that allows mount access to all clients in the eng netgroup except the host, rose

    my-group

    The share group


Example 5–6 How to Use the share and shareall Commands to Disable Mount Access for One Client

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add an entry in /etc/dfs/dfstab.

    The first example allows mount access to all clients in the eng netgroup except the host that is named rose. The second example allows mount access to all clients in the eng.example.com DNS domain except for rose.


    share -F nfs -o ro=-rose:eng /export/share/man
    share -F nfs -o ro=-rose:.eng.example.com /export/share/man

    For additional information about access lists, see Setting Access Lists With the share Command. For a description of /etc/dfs/dfstab, see dfstab(4).

  3. Share the file system.

    The NFS server does not use changes to /etc/dfs/dfstab until the file systems are shared again or until the server is rebooted.


    # shareall

ProcedureHow to Mount an NFS File System Through a Firewall

To access file systems through a firewall, use the following procedure.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Manually mount the file system by using a command such as the following:


    # mount -F nfs bee:/export/share/local /mnt
    

    In this example, the file system /export/share/local is mounted on the local client by using the public file handle. An NFS URL can be used instead of the standard path name. If the public file handle is not supported by the server bee, the mount operation fails.


    Note –

    This procedure requires that the file system on the NFS server be shared by using the public option. Additionally, any firewalls between the client and the server must allow TCP connections on port 2049. Starting with the Solaris 2.6 release, all file systems that are shared allow for public file handle access, so the public option is applied by default.


ProcedureHow to Mount an NFS File System Using an NFS URL

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. (Optional) If you are using NFS version 2 or version 3, manually mount the file system by using a command such as the following:


    # mount -F nfs nfs://bee:3000/export/share/local /mnt
    

    In this example, the /export/share/local file system is being mounted from the server bee by using NFS port number 3000. The port number is not required and by default the standard NFS port number of 2049 is used. You can choose to include the public option with an NFS URL. Without the public option, the MOUNT protocol is used if the public file handle is not supported by the server. The public option forces the use of the public file handle, and the mount fails if the public file handle is not supported.

  3. (Optional) If you are using NFS version 4, manually mount the file system by using a command such as the following:


    # mount -F nfs -o vers=4 nfs://bee:3000/export/share/local /mnt