next up previous contents index
Next: Fighting fragmentation Up: Filesystems Previous: Checking filesystem integrity with

 

用badblocks检查磁盘错误

应该周期性地用badblocks 命令检查坏块 它输出找到的所有坏块的编号的列表。列表给fsck 记录在文件系统数据结构中, 使操作系统存储数据时不使用这些坏块。举例:

$ badblocks /dev/fd0H1440 1440 > bad-blocks
$ fsck -t ext2 -l bad-blocks /dev/fd0H1440
Parallelizing fsck version 0.5a (5-Apr-94)
e2fsck 0.5a, 5-Apr-94 for EXT2 FS 0.5, 94/03/10
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Check reference counts.
Pass 5: Checking group summary information.

/dev/fd0H1440: ***** FILE SYSTEM WAS MODIFIED *****
/dev/fd0H1440: 11/360 files, 63/1440 blocks
$
如果badblocks报告一个块已经使用,e2fsck  将试着将此块移到其他地方。如果该块真的坏了,而不是在坏块边缘,文件内容可能丢失。



Linux学院
RedhatCentOSSuse LinuxDebianUbuntu
Sun Jun 29 13:31:22 EEST 1997
《Linux命令大全》 | 《Linux函数调用大全》 | 《Linux系统管理员手册》 | 中国存储网