Automatic Filesystem Mounting Removable Media Management

i.e., the directory at which the filesystem is mounted The single argument is sufficient for full identification of the mounted filesystem. The umount command looks in the filesystem status file etcmnttab or, etcmtab for another argument. If a specified name cannot be found, it simply means there is no need for dismounting because the specified filesystem is not mounted at all. umount supports the same options as the mount command. Online UNIX documentation often presents both commands in the same manual pages. A few examples: To dismount the filesystem devdskc1d2s0 mounted at home: umount devdskc1d2s0 or umount home • To dismount all filesystems described in the filesystem status file etcmtab: umount −a Pay attention that the root filesystem can never be dismounted. • A filesystem can be dismounted only if it is not busy. A filesystem is busy as long as any running process is requiring any resource within the filesystem. For example, when a user changes a directory within a certain filesystem by executing the cd command, that filesystem becomes busy, and the superuser cannot dismount it. The only way to dismount a busy filesystem is to first make it free by destroying all related running processes. Once all processes release the filesystem, it can be dismounted. For example, to dismount the home filesystem supposing it as a separate filesystem, all users must log out. Releasing a busy filesystem is not a simple task. It is not always easy to determine which processes are associated with the filesystem. The fuser command could be instrumental in this case: fuser [option] fsname where fsname The name of the filesystem, specified as a special device file recommended or a mount directory option wo option Lists all involved processes, identified by their PIDs −u Lists all involved processes; the login user name is added in parentheses besides the PIDs −k Destroys all involved processes and makes the filesystem free The −k option of the fuser command is dangerous, and must be used with extreme caution; for example, fuser −k home will kick−out all logged−in users from the system.

5.3.3 Automatic Filesystem Mounting

Regardless of its form, once the filesystem configuration file is set up, mounting may take place automatically. The following commands, depending on the implemented UNIX flavor, will mount all filesystems specified in the filesystem configuration file. mount −a Mostly for BSD flavors mountall 119 mount all For AIX Once the filesystem configuration file is specified properly, even the mount command can work with a single argument either the mount−point or the special device file name specified on the command line. Another argument is read and taken from the filesystem configuration file. This is a good opportunity to check newly specified filesystem configuration entries, and to avoid potential surprises once the system is rebooted.

5.3.4 Removable Media Management

Mounting and dismounting can be performed manually or automatically in the sense that a single command can be used simultaneously for multiple filesystems. However, a command itself must always be invoked by a user or from a script. This means that each time a floppy disk or a CD−ROM is used a user must mount andor dismount a filesystem residing on the medium. This can be frustrating for many users, but this is the way things work on many UNIX systems. Modern UNIX versions, like Solaris 2.x, introduced a special daemon, a media volume management daemon, to manage an automatic mounting and dismounting of removable media filesystems. The daemon permanently monitors devices like floppy drives or CD−ROM drives and provides an appropriate action as soon as a medium disk has been inserted into a corresponding device; it also ejects a medium if requested by the user. The name for the daemon on Solaris 2.x is vold: ps −ef | grep −v grep | grep vold root 200 1 80 Sep 28 ? 0:01 usrsbin vold The volddaemon is started during the system startup, and it lives as long as the system itself. In the presented example, the running program is usrsbinvold and the process ids are PID=200 and PPID=1 the parent process init, as for all daemons. Solaris uses the term volume instead of medium, which explains the name of the daemon. The vold daemon takes care of all replaceable mountable devices. It automatically mounts newly inserted volumes media, assuming a single predefined mount−point for each volume medium of the same device. There is no need for any additional action. Users can simply insert floppy or CD−ROM disks and use them. The media volume management daemon vold is often referred to as a volume manager. This can be quite confusing, because the name volume manager is commonly used on different UNIX platforms to identify the logical volume manager — the suite of programs that manage logical volumes, in a new approach in the management and handling of available disk space. Instead of dealing with disk units as physical entities, they can be logically grouped and treated as logical entities. The logical volume manager will be discussed in greater detail later.

5.4 Filesystem Configuration