Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » 案列分析

Understanding /etc/fstab on Linux

fstab - static information about the filesystems,这个文件描述系统中各种文件系统的信息系统在启动时会检查/etc/fstab这个文件。如果这个文件格式错误,启动时会提示你文件系统损坏。这个文件每行包含6个字段,意思分别为:

The first field, (fs_spec), describes the block special device or remote filesystem to be mounted.
    第一列:用来指定你要挂载的文件系统的设备名称或块信息,也可以是远程的文件系统


The second field, (fs_file), describes the mount point for the filesystem.
    第二列:指定挂载点,你要挂到什么位置


The  third  field, (fs_vfstype), describes the type of the filesystem.
    第三列:指定文件系统的类型


The fourth field, (fs_mntops), describes the mount options associated with the filesystem.
    第四列:挂载时option,默认defaults,它包含了rw,suid,dev,exec,auto,nouser,async选项


The  fifth field, (fs_freq), is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped.   

    第五列:dump工具通过这个选项位置上的数字来决定文件系统是否需要备份。如果是0dump就会被忽略,这个值一般为0


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.

    第六列:fsck命令通过检测该字段来决定文件系统通过什么顺序来扫描检查,根文件系统/对应该字段的值应该为1,其他文件系统应该为2.

    若文件系统无需在启动时扫描检查,则设置该字段为0


今天就碰到这么一个问题,由于之前维护人员把这个文件编辑错误,导致系统启动失败。好在通过维护模式编辑这个文件,修改为正确格式,重启之后可以正常进入。

Give root password for maintenance

(or type Control-D to continue):
(Repair filesystem) 1 #

(Repair filesystem) 1 # mount -o remount,rw / (默认是read only,这个命令把/修改为read write)

(Repair filesystem) 1 # vi /etc/fstab
:x
(Repair filesystem) 1 # reboot


fstab样本

[oracle@db1 ~]$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 10 05:02:51 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_db1-lv_root /                       ext4    defaults        1 1
UUID=41da8ae5-6b87-4506-ac0d-d174738f0aa8 /boot                   ext4    defaults        1 2
/dev/mapper/vg_db1-lv_swap swap                    swap    defaults        0 0
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
/dev/sda3  /oradata ext4  defaults  0  0

[oracle@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 com-
       ments. blank lines are ignored.  The order of records in fstab is important because  fsck(8),  mount(8),  and  umount(8)
       sequentially iterate through fstab doing their thing.

这个文件描述系统中各种文件系统的信息。一般而言,应用程序仅读取这个文件,而不对它进行写操作。对它的维护是系统管理员的工作。在这个文件中,每个文件系统用一行来描述,在每一行中,用空格或TAB符号来分隔各个字段,文件中以#开头的行是注释信息。Fstab文件中的纪录的排序十分重要。因为fsck/mount/umount等程序在做它们的工作时会按此顺序进行。

结论:不论做什么事情,你不了解,不清楚的事情一定不要做,做了一般会是错的,如果做对了也是侥幸


关键词:linux fstab 

相关文章

Install oracle products on docker
How to enable autologin on OEL6/7
Linux的分支有多少,你知道么?
Linux下配置vsftpd
如何配置HITACHI存储多路径软件
Exadata OS用户的密码策略
whats sosreport
Config xming+putty for X11 forwarding
在Linux中如何重置root密码,当你忘记时
在Oracle Enterprise Linux上使用nmon
如何在Windows和Linux上启用Large page
Linux性能优化方面的"神图"
Top