pavement

Drive letters

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
m

Revision as of 11:20, 1 May 2007

Under FreeBSD and other unix-like operating systems, there are no "drive letters" as in Microsoft Windows. Instead, the entire system is laid out logically as a single contiguous filesystem that begins with / and expands from there. Separate physical devices, individual real filesystems, and other abstractions are grafted into the overall filesystem as though everything in the universe were either a file or a folder.

For example you might have a CD-ROM drive and a hard drive with four partitions on it: / (root), usr (programs and data), var (system logs), and tmp (for temporary "scratch space"). In Windows, this would be expressed as five separate drive letters, for example C: as the root drive, D: as the CD-ROM, and E:, F:, and G: as usr, var, and tmp. In the Unix-like world, however, all of these separate devices and partitions are treated equally as parts of the same overall filesystem - so a listing of a (very) simple root directory might look like this:

% ls /
usr
var
tmp
cdrom

Where /usr, /var, /tmp, and /cdrom are all subdirectories of /, even though they are all separate partitions and devices.

Please note that all examples referring to files, directories, and paths under FreeBSD (or any other unix-like OS) use the forward slash, /, not the backward slash \ which Windows uses. Under unix-like OSes, the backslash does NOT function as a directory separator, it functions as the escape character, which is not to be confused with the escape key.

You can mount devices and logical filesystems at any point in the tree that you like, and even use symlinks to make it appear to programs and users who expect to find a device or filesystem in one place that it is still there, when in reality you have moved the actual device or filesystem someplace else. This makes adding new hard drives and moving critical data from older hard drives to newer ones a very, very painless process in the unix-like world as compared to Windows - very little needs to be done and you don't have to tell your users to do things any differently; simply mount your new drive and symlink any directories you move from the old drive to the new one to their new location, and from the user perspective, it's like nothing ever changed.

Personal tools