[ Team LiB ] |
Making File Systems AvailableWhen you have created a file system, you need to make it available; you do this by mounting it. A mounted file system is attached to the system directory tree at the specified mount point and becomes available to the system. The root file system is always mounted. Any other file system can be connected or disconnected from the root file system. You can mount a local file system in the following ways.
File systems on disk slices must always be mounted on the server system and shared (exported) before other systems can access them. See "Sharing Files from a Server" on page 207 for information about sharing file systems. When file systems are shared from a server, a client can mount them as NFS file systems in any of the following three ways.
Understanding Mounting and UnmountingFile systems can be attached to the hierarchy of directories available on a system. This process is called mounting. To manually mount a file system, you need the following things.
As a general rule, local disk slices should always be included in the /etc/vfstab file. Any software from servers, such as CDE, OpenWindows, or manual pages, and home directories from a server can either be included in the /etc/vfstab file or be automounted, depending on the policy at your site. When you mount a file system, any files or directories that might be present in the mount point directory are unavailable as long as the file system is mounted. These files are not permanently affected by the mounting process and become available again when the file system is unmounted. However, mount directories typically are empty because you usually do not want to obscure existing files. Using Mount and Unmount File System CommandsTable 48 lists the commands in the /usr/sbin directory that you use to mount and unmount file systems.
The mount command does not mount a read/write file system that has inconsistencies. If you receive an error message from the mount or mountall command, you may need to check the file system. The umount command does not unmount a file system that is busy. A file system is considered busy if a user is in a directory in the file system or if a program has a file open in that file system. Table 49 describes the general mount options that you can specify with the -o option of the mount command. If you specify multiple options, separate them with commas (no spaces). For example, -o ro, nosuid.
UFS LoggingUFS logging, new starting with the Solaris 7 Operating Environment, is the process of storing transactions (the changes that make up a complete UFS operation) in a log file before the transactions are applied to the UFS file system. Once a transaction is stored, the file system can apply the transactions to the file system later, if needed, during a recovery. UFS logging is not enabled by default. To enable UFS logging, specify the -o logging option with the mount command when mounting a file system. If you specify logging, then logging is enabled while the file system is mounted. This option prevents file systems from becoming inconsistent, thereby eliminating the need to run fsck. And, because you can bypass fsck, logging reduces the time required to reboot a system after a crash or after an unclean halt. The default behavior is nologging. The log is allocated from free blocks on the file system and sized at approximately 1 Mbyte per 1 Gbyte of file system up to a maximum of 64 Mbytes. You can enable logging on any UFS file system, including root (/). The log created by UFS logging is continually flushed as it fills up. The log is totally flushed when the file system is unmounted when the lockfs -f command is run. The fsdb command has been updated with new debugging options to support UFS logging. Finding the Mounted File SystemsTo display a list of mounted file systems, type mount and press Return. All the file systems currently mounted are displayed, as shown in the following example.
oak% mount
/ on /dev/dsk/c0t0d0s0 read/write/setuid on Wed Oct 23 10:08:50 1999
/usr on /dev/dsk/c0t0d0s6 read/write/setuid on Wed Oct 23 10:08:50 1999
/proc on /proc read/write/setuid on Wed Oct 23 10:08:50 1999
/tmp on swap on Wed Oct 23 10:08:52 1999
/usr/openwin on cheers:/export/openwin hard/remote on Wed Oct 23
10:11:08 1999
/home on blowup:(pid136) read only/intr/map=auto.home/indirect on Wed Oct 23
10:11:10 1999
/vol on blowup:(pid136) read only/intr/map=auto.vol/indirect on Wed Oct 23
10:11:10 1999
/nse on blowup:(pid136) read only/intr/map=/etc/auto.nse /indirect on Wed Oct
23 10:11:10 1999
oak%
Mounting All File Systems in the /etc/vfstab FileUse the following steps to mount all file systems in the /etc/vfstab file.
oak% su Password: # mountall oak# Mounting All File Systems of a Specific TypeUse the following steps to mount all file systems of a specific type that are in the /etc/vfstab file. The most common file system types are ufs for local disk slices and nfs for network file systems. See "Types of File Systems" on page 197 for a complete list of file system types.
The following example mounts all NFS file systems. oak% su Password: # mountall -F nfs # Starting with the Solaris 2.6 release, the -largefiles mount option is used as the default for mounting UFS file systems. If you want to prevent users from mounting file systems that contain files larger than 2 Gbytes, you must explicitly use the nolargefiles mount option to disable the default behavior. Mounting a Single File System (mount)Use the following steps to mount a single file system that has an entry in the /etc/vfstab file.
oak% su Password: # mount /opt # Remounting a UFS File System Without Large Files (mount)After you mount a file system with the default largefiles option to mount and large files have been created, you cannot remount the file system with the nolargefiles option until you remove any large files and run fsck to reset the state to nolargefiles. The nolargefiles option to mount provides total compatibility with previous file system behavior and enforces the 2-Gbyte maximum file size limit. Use the following steps to remount a UFS file system without large files.
In the following example, the directory /files1 is searched for large files, unmounted, fsck is run, and the directory is mounted again with the nolargefiles option. oak% su Password: # cd /files1 # find. -xdev -size +2000000 -exec ls -l {} \; # umount /files1 # fsck /dev/rdsk/c0t3dos7 /files1 # mount -o nolargefiles /dev/dsk/c0t3d0s7 /files1 # Unmounting All Remote File Systems (umountall -F nfs)Follow these steps to unmount all remote file systems.
oak% su Password: # umountall -F nfs #
CAUTION. If you unmount all file systems (by using umountall without any arguments), the system may be unusable and you may need to reboot it. Unmounting Individual File Systems (umount)You cannot unmount a directory that is being used. If you want to unmount a directory that is being used, all users must close any open files and change out of the directory.
In the following example, the mount command is used first to find the mount point for the file system to be unmounted. oak% mount / on /dev/dsk/c0t0d0s0 read/write/setuid on Wed Oct 23 10:08:50 1999 /usr on /dev/dsk/c0t0d0s6 read/write/setuid on Wed Oct 23 10:08:50 1999 /proc on /proc read/write/setuid on Wed Oct 23 10:08:50 1999 /tmp on swap on Wed Oct 23 10:08:52 1999 /usr/openwin on cheers:/export/openwin hard/remote on Wed Oct 23 10:11:08 1999 /home on blowup:(pid136) read only/intr/map=auto.home/indirect on Wed Oct 23 10:11:10 1999 /vol on blowup:(pid136) read only/intr/map=auto.vol/indirect on Wed Oct 23 10:11:10 1999 /nse on blowup:(pid136) read only/intr/map=/etc/auto.nse /indirect on Wed Oct 23 10:11:10 1999 [41]oak% su Password: # cd / # umount /home # Automounting DirectoriesYou can mount file systems shared through NFS by using a method called automounting. The AutoFS subsystem runs in the background and mounts and unmounts remote directories as they are needed. Whenever a user on a client system running the automounter accesses a remote file or directory available through the automounter, the automounter mounts the file system on the user's system. The remote file system remains mounted as long as the user remains in the directory and has one or more files open. If the remote file system is not accessed for a certain period of time, it is automatically unmounted. The automounter mounts and unmounts file systems as required without any intervention on the part of the user other than changing into or out of a directory. You can mount some file hierarchies with the automounter, and you can change others by using the /etc/vfstab file and the mount command. A diskless machine must have entries for / (root), /usr, and /usr/kvm in the /etc/vfstab file. The automounter works with the file systems specified in maps. These maps can be maintained as NIS, NIS+, or local files. The automounter maps can specify several remote locations for a particular file system. This way, if one of the servers is down, the automounter can try to mount from another machine. You can specify which servers are preferred for each resource in the maps by assigning each server a weighting factor. The automounter starts automatically when a system enters run level 3. You can also start it from a command line. (Describing how to set up and administer the automounter is beyond the scope of this book.) By default, the Solaris Operating Environment automounts /home. Sharing Files from a ServerNFS is a distributed file system that can be used to share files or directories from one system to other systems across a network. Computers that are running different operating systems can also share files. For example, systems running DOS can share files with systems running UNIX. NFS makes the actual physical location of the file system irrelevant to the user. You can use NFS to enable users to see all the relevant files, regardless of location. Instead of placing copies of commonly used files on every system, NFS enables you to place one copy on one system's disk and let all other systems access it across the network. Under NFS, remote file systems are virtually indistinguishable from local ones. A system becomes an NFS server if it has file systems to share or export over the network. A server keeps a list of currently exported file systems and their access restrictions (such as read/write or read-only). You may want to share resources, such as files, directories, or devices from one system on the network (typically, a server) with other systems. For example, you might want to share third-party applications or source files with users on other systems. When you share a resource, you make it available for mounting by remote systems. You can share a resource in the following ways.
The default /etc/dfs/dfstab file shows the syntax and an example of entries.
paperbark% more /etc/dfs/dfstab
# Place share(1M) commands here for automatic execution
# on entering init state 3.
#
# Issue the command '/etc/init.d/nfs.server start' to run the NFS
# daemon processes and the share commands, after adding the very
# first entry to this file.
#
# share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
paperbark%
|
[ Team LiB ] |