The filesystem is best visualized as a tree, rooted, as it were, at /. /dev, /usr, and the other directories in the root directory are branches, which may have their own branches, such as /usr/local, and so on.
There are various reasons to house some of these directories on separate filesystems. /var contains the directories log/, spool/, and various types of temporary files, and as such, may get filled up. Filling up the root filesystem is not a good idea, so splitting /var from / is often favorable.
Another common reason to contain certain directory trees on other filesystems is if they are to be housed on separate physical disks, or are separate virtual disks, such as Network File System mounts, or CDROM drives.
During the boot process, filesystems listed in /etc/fstab are automatically mounted (unless they are listed with the noauto option).
The /etc/fstab file contains a list of lines of the following format:
device /mount-point fstype options dumpfreq passno
A device name (which should exist), as explained in Section 12.2.
A directory (which should exist), on which to mount the filesystem.
The filesystem type to pass to mount(8). The default FreeBSD filesystem is ufs.
Either rw for read-write filesystems, or ro for read-only filesystems, followed by any other options that may be needed. A common option is noauto for filesystems not normally mounted during the boot sequence. Other options are listed in the mount(8) manual page.
This is used by dump(8) to determine which filesystems require dumping. If the field is missing, a value of zero is assumed.
This determines the order in which filesystems should be checked. Filesystems that should be skipped should have their passno set to zero. The root filesystem (which needs to be checked before everything else) should have it's passno set to one, and other filesystems' passno should be set to values greater than one. If more than one filesystems have the same passno then fsck(8) will attempt to check filesystems in parallel if possible.
The mount(8) command is what is ultimately used to mount filesystems.
In its most basic form, you use:
There are plenty of options, as mentioned in the mount(8) manual page, but the most common are:
Mount Options
Mount all the filesystems listed in /etc/fstab. Exceptions are those marked as ``noauto'', excluded by the -t flag, or those that are already mounted.
Do everything except for the actual system call. This option is useful in conjunction with the -v flag to determine what mount(8) is actually trying to do.
Force the mount of an unclean filesystem (dangerous), or forces the revocation of write access when downgrading a filesystem's mount status from read-write to read-only.
Mount the filesystem read-only. This is identical to using the rdonly argument to the -o option.
Mount the given filesystem as the given filesystem type, or mount only filesystems of the given type, if given the -a option.
``ufs'' is the default filesystem type.
Update mount options on the filesystem.
Be verbose.
Mount the filesystem read-write.
The -o option takes a comma-separated list of the options, including the following:
Do not interpret special devices on the filesystem. This is a useful security option.
Do not allow execution of binaries on this filesystem. This is also a useful security option.
Do not interpret setuid or setgid flags on the filesystem. This is also a useful security option.
The umount(8) command takes, as a parameter, one of a mountpoint, a device name, or the -a or -A option.
All forms take -f to force unmounting, and -v for verbosity. Be warned that -f is not generally a good idea. Forcibly unmounting filesystems might crash the computer or damage data on the filesystem.
-a and -A are used to unmount all mounted filesystems, possibly modified by the filesystem types listed after -t. -A, however, does not attempt to unmount the root filesystem.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the
documentation
before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.