ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 磁盘与文件系统管理之七:检查文件系统

磁盘与文件系统管理之七:检查文件系统

原创 Linux操作系统 作者:LRU2010 时间:2010-12-13 13:50:07 0 删除 编辑

文件系统检查


一、为什么RHEL开机会花会很长时间?

为加快调用文件的效率,开机时RHEL将数据存放在buffer/cache中,每次开机时RHEL也会检查文件系统的完整性.




二、文件系统的状态

为减少检查文件系统完整性所花的时间, RHEL会根据文件系统状态是否为dirty决定是否深入检查每个文件的完整性,如果是dirty则会花很长时间去检查每个文件的完整性.

RW: dirty

RO: clean




三、Fsck手动检查文件系统的完整性

语法: fsck [-A] [-a] [-y] [-f] [DEVICE]

 -A    Walk through the /etc/fstab file and try to check all file systems in one run.

 -a    Automatically repair the file system without any questions (use this option with caution).

 -y     For  some filesystem-specific checkers, the -y option will cause the fs-specific fsck to always attempt to fix any detected filesystem corruption automatically. 

 -f      即使FS是干净的也要强制检查

【note】 不要对已经挂载的文件系统执行fsck,否则会破坏FS结构,模拟如下:

[root@gwan ~]# mount | grep '/dev/sda4'

/dev/sda4 on /newdisk type ext3 (rw)

[root@gwan ~]# fsck /dev/sda4

fsck 1.39 (29-May-2006)

e2fsck 1.39 (29-May-2006)

/dev/sda4 is mounted.  

WARNING!!!  Running e2fsck on a mounted filesystem may cause

SEVERE filesystem damage.

Do you really want to continue (y/n)? no

check aborted.

[root@gwan ~]# umount /dev/sda4

[root@gwan ~]# fsck /dev/sda4

fsck 1.39 (29-May-2006)

e2fsck 1.39 (29-May-2006)

/dev/sda4: clean, 11/26208 files, 8979/104420 blocks

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24463783/viewspace-681642/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-08-19

  • 博文量
    24
  • 访问量
    30989