Linux fstab 参数详解
[root@qs-wg-db1 /]# cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sda1 /u01 ext3 defaults 0 0
[root@qs-wg-db1 /]# man fstab
FSTAB(5) Linux Programmer's Manual FSTAB(5)
NAME
fstab - static information about the filesystems
SYNOPSIS
#include <fstab.h>
DESCRIPTION
The file fstab contains descriptive information about the various file systems. fstab is only read by programs, and not written; It is the duty of the system administrator to properly create and maintain this file. Each filesystem is described on a separate line; fields on each line are separated by tabs or spaces. Lines starting with '#' are comments. The order of records in fstab is important(fatab中记录的顺序很重要) because fsck(8), mount(8), and umount(8) sequentially iterate through fstab doing their thing.
The first field(第一个字段), (fs_spec), describes the block special device or remote filesystem to be mounted.
For ordinary mounts it will hold (a link to) a block special device node (as created by mknod(8)) for the device to be mounted, like '/dev/cdrom' or '/dev/sdb7'.
For NFS mounts one will have <host>:<dir>, e.g., 'knuth.aeb.nl:/'. For procfs, use 'proc'.
Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL=<label> or UUID=<uuid>, e.g., 'LABEL=Boot' or 'UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'. This will make the system more robust: adding or removing a SCSI disk changes the disk device name but not the filesystem volume label.
The second field, (fs_file),(第二个字段) describes the mount point for the filesystem. For swap partitions, this field should be specified as 'none'. If the name of the mount point contains spaces these can be escaped as '/040'.
The third field, (fs_vfstype)(第三个字段), describes the type of the filesystem. Linux supports lots of filesystem types(支持的文件类型), such as adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details, see mount(8). For the filesystems currently supported by the running kernel, see /proc/filesystems. An entry swap denotes a file or partition to be used for swapping, cf. swapon(8). An entry ignore causes the line to be ignored. This is useful to show disk partitions which are currently unused.
The fourth field, (fs_mntops)(第四个字段), describes the mount options associated with the filesystem. It is formatted as a comma separated list of options. It contains at least the type of mount plus any additional options appropriate to the filesystem type. For documentation on the available options for non-nfs file systems, see mount(8). For documentation on all nfs-specific options have a look at nfs(5). Common for all types of file system are the options ''noauto'' (do not mount when "mount -a" is given, e.g., at boot time), ''user'' (allow a user to mount), ''owner'' (allow device owner to mount), ''pamconsole'' (allow a user at the console to mount), and ''comment'' (e.g., for use by fstab-maintaining programs). The ''owner'', ''pamconsole'' and ''comment'' options are Linux-specific. For more details, see mount(8).
The fifth field, (fs_freq),(第五个字段) is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.(0表示不需要dump)
The sixth field, (fs_passno)(第六个字段), is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked. (如果不指定或者为0, 该硬件在重启时fsck将不检查)
The proper way to read records from fstab is to use the routines getmntent(3).
FILES
/etc/fstab
SEE ALSO
getmntent(3), mount(8), swapon(8), fs(5), nfs(5)
HISTORY
The ancestor of this fstab file format appeared in 4.0BSD.
网上找到一份中文版的:
fs_spec fs_file fs_type fs_options fs_dump fs_pass
/dev/hda1 / ext2 defaults 1 1
(1)fs_spec: 该字段定义希望加载的文件系统所在的设备或远程文件系统,对于一般的本地块设备情况来说:IDE设备一般描述为 /dev/hdaXN,X是IDE 设备通道(a, b, or c),N代表分区号;SCSI设备一描述为/dev/sdaXN。对于NFS情况,格式一般为:,例如: `knuth.aeb.nl:/'。对于procfs,使用`proc'来定义。 对文件系统的定义(fs spec),它描述了将被装载的块设备或远程文件系统。对于通常的mount操作而言,这个字段应该包括一个将被装载的块设备的设备结点(通过mknod 命令来创建)或指向这类结点的连接(例如/dev/cdrom或/dev/sdb),对于NFS mount操作,这个字段应该包含host:dir格式的信息,例如:knuth.aeb.nl:/,对于进程文件系统procfs,使用proc。
除了显示的使用设备名,你可以使用设备的UUID或设备的卷标签,例如,你可以在这个字段写成“LABAL=root”或“UUID=3e6be9de -8139-11d1-9106-a43f08d823a6”,这将使系统更具伸缩性。例如,如果你的系统添加或移除了一个SCSI硬盘,这有可以改变你的设备名,但它不会修改你的卷标签。
(2)fs_file: 该字段描述希望的文件系统加载的目录点,对于swap设备,该字段为none;对于加载目录名包含空格的情况,用40来表示空格。描述文件系统的载入点,对于交换分区(swap),这个字段定义为none,如果在载入点的路径中包含空格符,可以用“/040”来替代空格符。
(3)fs_type: 定义了该设备上的文件系统,一般常见的文件类型为ext2 (Linux设备的常用文件类型)、vfat(Windows系统的fat32格式)、NTFS、iso9600等.文件系统类型(fs vfstype),主要用来定义文件系统的类型。Linux系统支持大量的文件类型,包括sdfs,affs,autofs,jfs,minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,,smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs等等。如果想了解你的kernel目前支持哪些文件系统,可以查看/proc/filesystems的内容。如果这个字段定义为swap,这条纪录将关联到一个用于交换目的的文件或分区。如果这个字段定义为ignored,这行将被忽略。这对于显示目前没有使用的分区非常有用。
(4)fs_options: 指定加载该设备的文件系统是需要使用的特定参数选项,多个参数是由逗号分隔开来。文件系统选项(fs mntops)在装载文件系统时使用的装载选项。多个选项之间用逗号做分隔符,这些选项列表包括了装载类型以及对于该文件系统合适的其它装载选项。对于非 NFS系统可用的装载选项可以参看mount命令的说明,对于nfs系统的选项可以查看关于nfs的文档。对于所有文件系统都适用的选项有noauto (当使用mount –a命令时不载入),user(允许用户进行装载),owner(允许设备所有人装载),_netdev(设备需要网络),后两个选项是linux系统所特有的。
对于大多数系统使用"defaults"就可以满足需要。其他常见的选项包括:
选项 含义
ro 以只读模式加载该文件系统
sync 不对该设备的写操作进行缓冲处理,这可以防止在非正常关机时情况下破坏文件系统,但是却降低了计算机速度
user 允许普通用户加载该文件系统
quota 强制在该文件系统上进行磁盘定额限制
noauto 不再使用mount -a命令(例如系统启动时)加载该文件系统
(5)fs_dump: 该选项被"dump"命令使用来检查一个文件系统应该以多快频率进行转储,若不需要转储就设置该字段为0.文件系统频率(fs_freq),被dump程序使用来确定哪个文件系统需要dump,如果最后一个字段没有设置,系统将认为其值为0,而dump程序则认为此文件系统无需dump。
(6)fs_pass: 该字段被fsck命令用来决定在启动时需要被扫描的文件系统的顺序,根文件系统"/"对应该字段的值应该为1,其他文件系统应该为2。若该文件系统无需在启动时扫描则设置该字段为0.被fsck程序所使用来确定进行在系统重启进行文件系统检查时的顺序,对于根系统/这个值应设为1,其它文件系统可以设为2,在同一个物理硬盘内的文件系统应该被顺序检测,而不同硬盘中的文件系统则应该同时检测以充分利用系统的并行性。如果最后一个字段值为0或没有设置,fsck程序装跳过此文件系统的检测。
在linux编程中可以用getmntent过程来访问这个文件的内容。
Linux fstab 参数详解的更多相关文章
- /etc/fstab 参数详解及如何设置开机自动挂载
某些时候当Linux系统下划分了新的分区后,需要将这些分区设置为开机自动挂载,否则,Linux是无法使用新建的分区的. /etc/fstab 文件负责配置Linux开机时自动挂载的分区. Window ...
- /etc/fstab 参数详解(转)
转自:http://blog.csdn.net/duyiwuer2009/article/details/8644753/ /dev/hda5 /home/new ...
- Linux内核参数详解
所谓Linux服务器内核参数优化(适合Apache.Nginx.Squid等多种web应用,特殊的业务有可能需要做略微调整),主要是指在Linux系统中针对业务服务应用而进行的系统内核参数调整,优化并 ...
- linux top 参数详解
top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.下面详细介绍它的使用方法. top - 01:06:48 up 1:22, ...
- /etc/fstab文件详解【转】
******************************************************************************* 有很多人经常修改/etc/fstab文件 ...
- 【转载】Linux命令-自动挂载文件/etc/fstab功能详解[转]
博客园 首页 新随笔 联系 订阅 管理 随笔 - 322 文章 - 0 评论 - 19 Linux命令-自动挂载文件/etc/fstab功能详解[转] 一./etc/fstab文件的作用 ...
- linux系统开机自动挂载光驱 和 fstab文件详解
Linux 通过 UUID 在 fstab 中自动挂载分区 summerm6关注 2019.10.17 16:29:00字数 1,542阅读 607 https://xiexianbin.cn/lin ...
- linux PHP 编译安装参数详解
linux PHP 编译安装参数详解 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -- ...
- Linux 之 编译器 gcc/g++参数详解
2016年12月9日16:48:53 ----------------------------- 内容目录: [介绍] gcc and g++分别是gnu的c & c++编译器 gcc/g++ ...
随机推荐
- C++ Primer 学习笔记_75_模板与泛型编程 --模板定义
模板与泛型编程 --模板定义 引言: 所谓泛型程序就是以独立于不论什么特定类型的方式编写代码.使用泛型程序时,我们须要提供详细程序实例所操作的类型或值. 模板是泛型编程的基础.使用模板时能够无须了解模 ...
- Clojure绘制UML
简单介绍 使用Clojure封装了Graphviz的使用.眼下主要实现了UML的绘制 使用 以命令模式的UML为例,演示cdraw的使用 安装Graphviz cdraw是对Graphviz的简单封装 ...
- HDU4451Dressing(计数)
HDU4451Dressing(计数) 题目链接 题目大意:给你N件衣服, M条裤子, K双鞋子,如今有P个不合理的的搭配(衣服和裤子或者裤子和鞋子),要求不用P中不理的搭配方式来将衣服裤子鞋子三件搭 ...
- 大一C语言结课设计之《简单计算器》
/*===============================================*\ ** 设计目的:简单计算器,计算形如10*(20.2-30.6)+5.0/2的表达式值 ** 简 ...
- [Swust OJ 767]--将军回家(Dijkstra算法)
题目链接:http://acm.swust.edu.cn/problem/767/ Time limit(ms): 1000 Memory limit(kb): 65535 Description ...
- C语言宏的特殊用法和几个坑(转)
总结一下C语言中宏的一些特殊用法和几个容易踩的坑.由于本文主要参考GCC文档,某些细节(如宏参数中的空格是否处理之类)在别的编译器可能有细微差别,请参考相应文档. 宏基础 宏仅仅是在C预处理阶段的一种 ...
- 在windows下的QT编程中的_TCHAR与QString之间的转换
由于在windows下的QT编程中,如果涉及到使用微软的API,那么不可避免使用_TCHAR这些类型,因此在网上查了一下,其中一个老外的论坛有人给出了这个转换,因此在这里做一下笔记 : )#ifdef ...
- Qt+SQLite数据加密的一种思路(内存数据库)
了解Qt是比较早的,可是一直没有耐心去做一个练习.近期花了差不多两周时间做了次Qt开发练习,基本完成了Qt的入门,逃脱微软平台又迈出了几小步.Qt虽然是C++的,但开发应用是比较方便的,我觉得它在界面 ...
- 如何配置和使用Tomcat访问日志
配置位置在log下的server.xml,(tomcat容器) <Engine defaultHost="localhost" name="Catalina&quo ...
- [置顶] C++ Pirate: Lambda vs Bind
Lambda 与 Bind的性能比较 转载请说明出处:http://blog.csdn.net/cywosp/article/details/9379403 先让我们看看下面函数: template ...