The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

3.4 Mounting and Unmounting Filesystems

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.

3.4.1 The fstab File

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
device

A device name (which should exist), as explained in Section 12.2.

mount-point

A directory (which should exist), on which to mount the filesystem.

fstype

The filesystem type to pass to mount(8). The default FreeBSD filesystem is ufs.

options

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.

dumpfreq

This is used by dump(8) to determine which filesystems require dumping. If the field is missing, a value of zero is assumed.

passno

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.

3.4.2 The mount Command

The mount(8) command is what is ultimately used to mount filesystems.

In its most basic form, you use:

    # mount device mountpoint

There are plenty of options, as mentioned in the mount(8) manual page, but the most common are:

Mount Options

-a

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.

-d

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.

-f

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.

-r

Mount the filesystem read-only. This is identical to using the rdonly argument to the -o option.

-t fstype

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.

-u

Update mount options on the filesystem.

-v

Be verbose.

-w

Mount the filesystem read-write.

The -o option takes a comma-separated list of the options, including the following:

nodev

Do not interpret special devices on the filesystem. This is a useful security option.

noexec

Do not allow execution of binaries on this filesystem. This is also a useful security option.

nosuid

Do not interpret setuid or setgid flags on the filesystem. This is also a useful security option.

3.4.3 The umount Command

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 <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру