This section describes how the Unix and Mac OS
filesystems work,
in general.
Unix was invented with one of the first true hierarchical filesystems for its time.
A directory five levels down from the root was treated the same
as any one in a more shallow level.
The filename could be any character string, up to 14 whole characters.
By contrast, early versions of VAX/VMS, a contemporary OS from Digital Equipment Corporation, had a system where a disk would have one home directory for each user, numbered by the user number, for instance [38,1061], and that was it. There were no subdirectories, and no top-level directories unattached to user identities. And no files were allowed at the root layer. Filenames had to be 9.3 format (up to 9 char name, and a dot and a 3 char suffix). This was a big improvement over RT-11's 6.3 names. Each character could be A-Z (upper case only), 0-9, or one of five punctuation marks. (Three characters were packed into two bytes, to save space, and the period was implied, not stored.) Later versions allowed named subdirectories similar to Unix, although the top-level directories continued to be user accounts.
A unix pathname is either absolute or relative. Absolute names start with a slash and describe the path from the root directory down to where the file is. For instance, /usr/bin/diff is the program file for the diff command. Relative filenames don't start with a slash so bin/diff, if used from the /usr directory, would refer to the same diff program. If there's no slashes at all, it refers to a file in the same directory.
In a Unix filesystem, one volume is always special, the root volume. Its root is the root of the entire filesystem.
Other volumes are mounted as subdirectories called mount points. The subdirectories can be located anywhere, even chained on top of other volumes by using a directory located in them as a mount point.
In the picture, one hard disk partition in yellow is mounted as "/", the root, known by a single character, slash.
Another partition, in red, is mounted on /usr. This directory and its subdirectories is often the biggest piece of a Unix OS installation, and often there is no need to ever write to it, so this sysadmin decided to make it a separate volume and mount it write-protected, to guarantee that it can't be tampered with.
Typically the unix mount command (see man mount) takes a preexisting directory, and manipulates the kernel data structures to make the given volume appear in place of that directory. Specifically, the root directory of the subvolume appears as the contents of the mount point directory, and all of its subdirectories appear relative to their parents, all the way down. Any previous contents are hidden; usually the directories used for these purposes are empty. Automount systems typically create their own mountpoint directories dynamically. Usually there's a directory devoted to these directories coming and going. For instance, on Mac OS X, if you mount a network volume named sonic, it will make a mount point directory named /Volumes/sonic before mounting the volume there.
The mount point can be either in the root volume, or in one of its direct or indirect subdirectories.
The other argument to the mount command is the 'device'.
At least that's what it was originally.
Hard disk partitions are usually consecutive groups of cylinders.
The CD in our examples is mounted on /cdrom, a special directory placed there for that purpose. Other Unix systems might put all new mount points in a special directory for that purpose, /mnt. This may or may not be an automount system.
The filesystem for Mac OS 9 and earlier was the inspiration for the Mac-like properties of the Mac OS X filesystem. It consists of volumes using a filesystem of type HFS or HFS+. Each volume is known by a name, and the volume names coexist at the top level. The volume names can collide; there is no mechanism forcing floppy disks or disk partitions to have unique names. On Mac OS X, the volume names are made distinct by appending a suffix; if you mount two volumes named sonic, they will mount at /Volumes/sonic and /Volumes/sonic_1.
Absolute filenames use colon as a separator and do not begin with a colon. For example, atlanta:idd:barium salts would be a file named barium salts (with a space in it) in a directory idd at the top level of a volume named atlanta. The Unix equivalent would roughly be /atlanta/idd/barium salts. (For the command name you'd have to use a trick to avoid misunderstanding the space character.)
Relative filenames come in three kinds. The general kind work like the absolute but start with a colon. Therefore :idd:barium salts will look for a file named barium salts in a directory named idd in the current directory.
Multiple colons at the start go up a level. Therefore :::idd:barium salts will look for a file named barium salts in a directory named idd in a directory two levels above the current directory. Multiple colons elsewhere are prohibited (and usually superfluous).
Special case: names that have no colons are relative to the current directory. Therefore barium salts will look for a file named barium salts in the current directory. Because of this, you cannot refer to a volume in a context that expects a file. Volumes are not considered files in classic Mac OS.
The root 'directory', which contains all of the mount points, cannot really hold any files, because it's unclear on which volume they would actually reside. Instead, the Finder, and the file selection dialogs, depict a phony directory called the desktop that appears on the back surface of your screen, outside of any application, behind all windows. This is a union of the icons for the objects:
Of course all of these lead to more opportunities for confusion, and for objects of the same name to coexist on the desktop without penalty or shame.
Apple's Mac OS X tries to combine the two, by appearing to have a MacOS structure, while being implemented at a lower level by Darwin, a descendant of BSD Unix.
The 'System Disk' on the Mac level is the root volume on the BSD level. This is washington in the picture, in yellow. Traditionally it's the first disk icon on the desktop but these days you can change that. It has the directories System and Library that it boots OS X up from, plus other essentials such as the Volumes directory. If it has MacOS 9 on it also, that is often in a directory named System Folder.
Most other volumes are mounted off of the Volumes directory. Typically a directory of the same name is created there, and all files appear under that. If the volume name collides with a preexisting one, it gets a numbered modification such as atlanta-1. Sometimes MacOS X mounts them elsewhere such as /private/var/automount. And, you can always use the unix mount command to mount a volume anywhere you want by hand.
The Finder and the file selection dialogs depict the filesystem similar to Mac OS 9, as described above. The system volume, and the volumes under /Volumes, all appear on the desktop, along with files from each volume's Desktop Folder directory. Also, each user's home directory has a Desktop directory that gets merged in if that user is logged in.
As before, because these come from distinct directories and/or name spaces,
files with the same name can coexist on the desktop.
To add to the confusion, the MacOS X Finder often hides suffixes
(something that Tactile Interrogator never does).
Therefore, a user named Pat might have these icons all displayed on the desktop,
each of which appears in the desktop with the same name 'atlanta':
- a volume named atlanta
- a file /Desktop Folder/atlanta
- a file /Volumes/chicago/Desktop Folder/atlanta
- a file /Volumes/atlanta/Desktop Folder/atlanta
- a file /Users/pat/Desktop/atlanta
- a directory /Users/pat/Desktop/atlanta.app
In Interrogator, you access each of these directories individually. Interrogator has no 'desktop' concept because of the inconvenience when icons on the desktop become buried under windows. The desktop is like a window that always stays behind all other windows. A normal window is more servicable.
Documentation > Filesystem Overview |
|
||||