当服务器或PC机器的硬盘在使用一段时间后,会出现无法使用正常进行使用;
1. 当将文件系统挂载到指定的目录的时候,会出现mount 失败,如下图:
[root@template ~]# mount /dev/sdc /media/
mount: wrong fs type, bad option, bad superblock on /dev/sdc,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
2.查看后台的log 信息:如syslog message等查看是否有错误的说明,这里的错误截取了message 日志的部分内容:
926 Oct 18 13:30:49 template kernel: sd 0:0:2:0: [sdb] Unhandled sense code
927 Oct 18 13:30:49 template kernel: sd 0:0:2:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
928 Oct 18 13:30:49 template kernel: sd 0:0:2:0: [sdb] Sense Key : Medium Error [current]
929 Oct 18 13:30:49 template kernel: Info fld=0x22c66634
930 Oct 18 13:30:49 template kernel: sd 0:0:2:0: [sdb] Add. Sense: a synchronization mark error
931 Oct 18 13:30:49 template kernel: sd 0:0:2:0: [sdb] CDB: Read(10): 28 00 22 c6 65 98 00 01 00 00
932 Oct 18 13:30:49 template kernel: JBD: Failed to read block at offset 19654
933 Oct 18 13:30:49 template kernel: JBD: recovery failed
934 Oct 18 13:30:49 template kernel: EXT4-fs (sdb): error loading journal
935 Oct 18 13:30:49 template kernel: EXT4-fs (sdc): warning: checktime reached, running e2fsck is recommended
3.根据日志的相关提示,尝试对磁盘进行修复:
[root@template ~]# e2fsck -p /dev/sdc
/dev/sdc: recovering journal
Error reading block 72928454 (Attempt to read block from filesystem resulted in short read).
/dev/sdc: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
4.再根据实际情况查看磁盘是否需要进一步修复,如果需要则进行下面的步骤:
[root@template ~]# fsck /dev/sdc
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sdc: recovering journal
Error reading block 72928454 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes
Force rewrite<y>? yes
/dev/sdc contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdc: 29/36634624 files (0.0% non-contiguous), 16523254/146515446 blocks