首页 > 科技 > /etc/fstab & mount options

/etc/fstab & mount options

2006年10月22日 15点59分 发表评论 阅读评论

Information about the local and remotely mounted file systems is stored in/etc/fstab. Each file system is described on a separate line. Each line is composed of multiple fields, each separated by spaces or tabs. When your system boots, it processes each file system in the order listed.

A sample /etc/fstab might look like the following:

/dev/hda1 / ext2 defaults 1 1
/dev/hda2 swap swap defaults 0 0
/dev/hda5 /usr ext2 defaults 1 2
/dev/hda7 /tmp ext2 defaults 1 2
/dev/hda8 /var ext2 defaults 1 2
/dev/hda9 /home ext2 defaults 1 2
/dev/hdc /cdrom iso9660 ro,noauto,user 0 0
none /proc proc defaults 0 0

Field Name Description
——————————-
fs_spec: Describes the block device or remote file system to be mounted.
fs_file: Describes the mount point (the directory the file system will be mounted as). For swap partitions, this should be “none.”
fs_vfstype: Describes the file system type. Valid file system types are minix, ext, ext2, xiafs, msdos, hpfs, iso9660, nfs, and swap. This field can also be set to “ignore,” which will cause the system to ignore the entry. Ignoring an entry is useful for marking unused partitions.
fs_mntops: Mount options. Specifies mounting options. Mount options are covered later in this section.
fs_freq: Used by the dump(8) command to determine which file systems need to be dumped. A value of 0 indicates that the file system does not need to bedumped.
fs_passno: Used by the fsck(8) program to determine the order in which filesystems are checked upon boot. The root file system should have an fs_passno setting of 1, and other local file systems should have an fs_passno of 2. Remote file systems should have an fs_passno of 0, which indicates they should not be checked on boot.

Mount Options

Although most file systems in /etc/fstab are given the mount option of Default, there are other options you can use. Options are listed in /etc/fstab, and are separated by commas (no spaces or tabs).

Mount Option Description
—————————-
async: I/O is done asynchronously to this file system.
atime: Timestamps for each inode are updated when accessed.
auto: Can be mounted with the -a option of the mount(8) command.
defaults: Use the default mount options: rw, suid, dev, exec, auto, nouser,and async.
dev: Interpret character or block special devices on the file system.
exec: Allow binaries (programs) to be executed on this file system.
noatime: Timestamps for each inode are not updated when accessed.
noauto: Cannot be mounted with the -a option of the mount(8) command (it must be mounted explicitly).
nodev: Do not interpret character or block special devices on the file system.
noexec: Do not allow binaries (programs) to be executed on this file system.
nosuid: Do not allow setuid or setgid permissions on programs to take effect.
nouser: Do not allow nonroot users to mount this file system.
remount: Attempt to remount a file system that has already been mounted. This is typically used to change mount options, and is only used by the mount(8) command (never used in /etc/mnttab).
ro: Mount the file system as read-only.
rw: Mount the file system as read-write.
suid: Allow setuid or setgid permissions on programs to take effect.
sync: I/O is done synchronously to this file system.
user: Allow nonroot users to mount this file system. This option also sets the noexec, nosuid, and nodev options, unless overridden.

分类: 科技 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.