linux下检查磁盘完整性,磁盘与文件系统管理之七:检查文件系统

文件系统检查

一、为什么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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值