Mounting and Disk Arbitration


The disk arbitration daemon, diskarbitrationd, monitors disk connections and maintains a disk arbitration table, which is a list of disks available to graphical user interface applications such as the Finder. When you insert a disk or mount a file system from the Finder, diskarbitrationd probes the disk to determine its file-system format, checks the disk for issues, mounts the file system, and updates the disk arbitration table.

Using Commands

There are several commands that permit you to manage disk mounts and troubleshoot mounting issues.

disktool

Sometimes you need to update the disk arbitration table manually by using the command disktool r. Although disktool is deprecated for most of its uses, it is still useful for refreshing the disk arbitration daemon. Use this command after mounting a disk drive or disk image from the command line. Although you can use disktool for much more, it's best to use diskutil for most features. Most features of disktool require root access to the volume. The disktool command has no man page. For more information, type disktool with no options.

diskutil

The diskutil command provides functionality similar to that of the Mac OS X application Disk Utility. You can use diskutil to mount and diskutil to unmount local disk volumes from the command line, so they disappear and reappear in the Finder. It can also be used for many other disk-related operations such as partitioning and erasing disks, conducting RAID maintenance, ejecting media, and much more. For more information, type man diskutil.

drutil

The drutil command lets you interact with attached CD and DVD burners. For example, you can use the TRay command to open, close, and eject media. The command

drutil tray close drive 1


closes the tray of the first burning device seen, if possible. The man page for drutil explains each of its options in great detail.

mount and umount

If you mount or unmount a local volume using the mount and umount commands, diskarbitrationd does not detect the disk. You typically use the mount and umount commands only for network volumes. In some cases, however, you might need to mount a local volume with mount to pass mount options that are not available with diskutil or disktool. For example, when you boot into single-user mode, you type /sbin/mount uw / to mount the root volume read-write. You should refresh disk arbitration with disktool r after using the mount or umount command. You can use mount with no options to obtain a list of mounted volumes.

For more information, see the man pages for mount, mount_afp, mount_ftp, mount_hfs, mount_msdos, mount_nfs, mount_ntfs, mount_smbfs, mount_webdav, and umount.

Mounting With Files

Command-line tools are not the only way to deal with local mounts, though. Next we'll look at a couple of files that deal with mounted volumes.

volinfo.database

Mac OS X distinguishes between native HFS Plus volumes, which are present at startup, and removable volumes. The system keeps a list of native volumes in the file /var/db/ volinfo.database. Each volume in the list has a unique 64-bit volume identifier.

fstab

Mac OS X supports an fstab file so that you can mount file systems in particular locations at system startup. The format of the Mac OS X fstab file, however, is slightly different from that of other UNIX systems. Because of disk arbitration, the device files on Mac OS X are not static. You cannot create an fstab file to mount /dev/disk0s1 at /, because you have no guarantee that the mounted disk will be disk0s1 the next time the computer reboots. Instead, use the device label; for example:

LABEL=Disk2 /Disk2 hfs rw 0 0




Apple Training Series. Mac OS X System Administration Reference, Volume 1
Apple Training Series: Mac OS X System Administration Reference, Volume 1
ISBN: 032136984X
EAN: 2147483647
Year: 2005
Pages: 258
Authors: Schoun Regan

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