System Administration Guide: Resource Management and Network Services

Mounting File Systems

You can mount file systems in several ways. They 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, but many situations require a combination of all three methods. In addition to these three ways of mounting a file system, 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 15–2 Mounting File Systems Task Map

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

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.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 a NFS URL 

 Steps to allow access to a file system 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

How 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. Although you must follow this procedure for all local file systems, do not use it for remote file systems because it must be completed on every client.

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  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 should not have NFS vfstab entries because of a potential deadlock. The NFS service is started after the entries in /etc/vfstab are checked. As a result, if two servers that are mounting file systems from each other fail at the same time, each system could hang as the systems reboot.


Example-vfstab entry

You want a client computer 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

How to Mount a File System From the Command Line

Mounting a file system from the command line is often done 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.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  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 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, to prevent unexpected behavior.


Mounting With the Automounter

Autofs Administration Task Overview 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, all you need to do is 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.

How 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 –

Previous versions of the Solaris operating environment cannot use large files. Check that clients of the NFS server are running at minimum the 2.6 release if the clients need to access large files.


  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

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

    Here is an example of a command that you can run to locate large files:


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

    If large files are on the file system, you must remove or move them 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

How to Use Client-Side Failover

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  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  -o ro

    This syntax has been allowed by the automounter in earlier releases, but 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 V2 and V3 protocols can only be done with autofs. In autofs, the best subset of version 2 or version 3 servers is used.


How to Disable Mount Access for One Client

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  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 on 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

How to Mount an NFS File System Through a Firewall

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

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


    # mount -F nfs -o public 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 2.6 release, all file systems that are shared allow for public file handle access, so the public option is applied by default.


How to Mount an NFS File System Using an NFS URL

  1. Become superuser or assume an equivalent role.

    For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.

  2. 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 uses the standard NFS port number of 2049. 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.