Certification Objective 5.04Mounting and Unmounting a Fife System


Certification Objective 5.04—Mounting and Unmounting a Fife System

Exam Objective 2.7: Perform mounts and unmounts on a Solaris 10 OS file system, and use volume management to access mounted diskettes and CD-ROMs, restrict access, troubleshoot volume management problems, and explain access methods without volume management.

To the user, all the file systems on a Solaris system appear to be one unified directory tree with its root (/) directory at the top. When you create a file system on a disk, you attach it to the tree at some point underneath root (/), and this process is called mounting the file system. The different ways of mounting file systems are as follows:

  • If a file system is used infrequently, you can mount it by issuing a mount command from the command line.

  • You can make entries for the frequently used file systems in the /etc/vfstab file, and these file systems will be mounted automatically when the system is booted.

  • You can use the AutoFS utility, which automatically mounts the file system when it's accessed and unmounts it when the user moves to another directory.

When a Solaris system is booted, it automatically mounts the file systems listed in the virtual file system table (vfstab) file.

Automatic Mounting with /etc/vfstab

During the boot procedure, when the system enters the multiuser mode, the mountall command, which mounts the file systems specified in the /etc/vfstab file, is executed.

image from book
Exam Watch

The kernel mounts the root (/), /usr, and /var file systems before the mountall command is executed; the command mounts the file systems listed in the /etc/vfstab file with the value of the mount at boot field equal to yes.

image from book

The fields of an entry in the /etc/vfstab file are described here:

  • Device to mount. This field identifies the block device name (e.g., /dev/dsk/c0t0d0s0) corresponding to the file system being mounted or a directory name for a virtual file system.

  • Device to fsck. This field identifies the raw device name (e.g., /dev/rdsk/c0t0d0s0) that will be used by the fsck command for the file system. Use a hyphen (-) if this field is not applicable—for example, in the case of a read-only file system or a network-based file system.

  • Mount point. This field identifies where on the directory tree the file system is to be mounted—for example, /usr.

  • FS type. This field identifies the type of the file system.

  • fsck pass. This field specifies the pass number for the fsck command to indicate how to check the file system:

    • A value of hyphen (-) means the file system is not checked.

    • A value of zero means the file system is not checked if it is a UFS file system, otherwise it's checked.

    • A value of greater than zero means the file system is checked.

  • Mount at boot. Specifies whether the file system will be mounted automatically by the mountall command during the system boot; the values for this field are yes and no. The value of this field should be set to no for the root (/), /usr, and var/ file systems, as well as for the virtual file systems such as /proc and /dev/fd.

  • Mount options. A list of comma-separated options, with no spaces, which are used for mounting the file system. Use a hyphen (-) to indicate no option.

On the Job 

In an entry in the /etc/vfstab file, you must specify the value for each field. To specify that there is no value, type a hyphen (-), not a white space; otherwise, the system may not boot successfully.

Once the Solaris system has been booted, you may still need to mount a file system to the existing directory tree. You can do that manually, as is discussed in the next section.

Manual Mounting and Unmounting

As a system administrator, you will need to mount new file systems to a directory tree that is already up and running. The new file systems may be on a hard drive or on a medium such as a floppy or a CD-ROM. In order to mount and unmount file systems manually, you can use the commands described in Table 5-6.

Table 5-6: Commands for mounting and unmounting file systems

Command

Description

mount

Used to mount a file system as well as remote resources.

umount

Used to unmount a mounted file system or a remote resource.

mountall

Used to mount all file systems that are specified in the /etc/ vfstab file. This command runs automatically when the system enters the multiuser mode.

umountall

Used to unmount all file systems specified in the /etc/vf stab file.

image from book
Exam Watch

Note that the commands to unmount the file systems are umount and umountall, and not unmount and unmountall.

image from book

The umount and umountall commands do not unmount a file system that is busy (except when you use the -f option). A file system is considered busy if a user is accessing a file in the file system, a file in the file system is open, or the file system is being shared.

The mountall command is executed automatically during bootup when the system enters the multiuser mode, and it mounts all the file systems specified in the /etc/vfstab file with the value of the mount at boot field set equal to yes. To mount an individual file system after the system is up and running, you can use the mount command, which has the following syntax:

 mount [<options>] [-o <specificOptions>] <mountDevice> <mountPoint> 

<mountDevice> is the name of the device that contains the file system that needs to be mounted, and <mountPoint> is the name of an existing directory in the directory tree. If the directory has content, it will be hidden until the file system is unmounted. The options specified by <options> are described as follows:

  • -F <FSType>. Specify the type of the file system that will be mounted.

  • -m. Mount the file system without making an entry in the /etc/mnttab file.

  • -p. Print. Display the list of the mounted file systems in the /etc/vfstab format. It must be the only option specified.

  • -r. Mount the file system read only.

  • -v. Verbose. Display the list of the mounted file systems in verbose format. It must be the only option specified.

The <specificOptions> are the file system-specific options described in Table 5-7.

Table 5-7: Operands to be used with the -o option of the mount command

Option

Description

Default

devices | nodevices

Allow (or disallow) the opening of device-special files.

devices

exec | noexec

Allow (or disallow) the execution of programs in the file system.

exec

ro | rw

Read-only (or read/write) permissions.

rw

setuid | nosetuid

Allow (or disallow) executing setuid and setgid.

setuid

The /etc/mnttab file is managed by the MNTFS file system, and it provides a read-only access to the list of file systems currently mounted on the local system.

You can unmount a mounted file system by using the umount command, which has the following syntax:

    umount <mountPoint> 

The <mountPoint> may specify either the directory name where the file system is mounted or the device name for the file system. You can use the -f option to force the file system to unmount even if it is busy. But be warned that use of this option can cause open files to lose data.

Exercise 5-2: Mounting a CD-ROM, Browsing Its Content, and Unmounting It

image from book

Make the access readable only. Assume the CD-ROM is attached as a slave to the primary IDE channel, and the file system you want to access is of type hsfs and it resides on slice 0.

  1. Insert the CD-ROM into the CD-ROM drive.

  2. Mount the CD-ROM by issuing the following command:

         # mount -F hsfs -o ro /dev/dak/c0t1d0s0 /cdrom 

  3. You can browse the subtree starting with /cdrom by using the ls command—for example:

        # ls -l /cdrom 

  4. Unmount the CD-ROM by issuing the following command:

        # umount /cdrom 

  5. Eject the CD by issuing the following command:

        # eject cdrom 

image from book

Instead of manually mounting the removable medium, such as a CD-ROM or a diskette, you can use volume management to accomplish this task.

Accessing Removable Media with Volume Management

As with manual mounting, you can use volume management to access the removable media. Accessing the media with volume management (the volume management) will be easier and you will not even need superuser privileges to do that. Table 5-8 shows how to access removable media that is being managed by volume management.

Table 5-8: Accessing data on removable media managed by volume management

Removable Media

Action

Directory in Which to Find the Files

Diskette

Insert the diskette and issue the command: volcheck.

/floppy

Removable hard disk

Insert the removable hard disk and issue the command: volcheck.

/rmdisk/jaz0

or

/rmdisk/zip0

CD-ROM

Insert the CD. You may have to wait for a few seconds.

/cdrom/<volName>

DVD

Insert the DVD. You may have to wait for a few seconds.

/dvd/<volName>

Volume management (vold), by default, manages all removable media devices. Occasionally, you will need to manage the media manually without using volume management. In that case, stop the vold daemon, use the media manually, and start the vold daemon when you want to. You can use the following commands to stop and start volume management:

    /etc/init.d/volmgt stop    /etc/init.d/volmgt start 

The most important takeaways from this chapter are the three most important tasks to perform before a user can use the file systems on a disk:

  • You add the disk to the system, and the system assigns it a device name that reflects its full path in the device tree. The system itself refers to the disk with an abbreviated name called instance name, which is mapped to the physical device name in the /etc/path_to_inst file.

  • You partition the disk by referring to it with its logical device name, which also points to its physical device name.

  • You create the file system on a disk partition and make it available by mounting it to the existing directory tree by using the mount command.




Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
Sun Certified System Administrator for Solaris 10 Study Guide Exams 310-XXX & 310-XXX
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net