Linux服务器磁盘坏道的发现及解决全过程

     服务器的磁盘也没有作监控,其实我也不知道如何对磁盘的状态作监控,忽然查看不到新数据,上去看了一下磁盘的状况,发现磁盘出现只读的状况,没法写入数据。node

1、处理过程linux

一、磁盘坏道检查服务器

    出现问题以后,首先把业务停掉了,而后把磁盘卸载掉来进行修复,出现这种问题有多是磁盘的磁道有坏区,我首先检查了一下磁盘坏道的状况。ide

badblocks -sv /dev/sdbip

    差很少检查了一些时间,发现并无坏道。it

二、修复磁盘文件系统io

    在修复文件系统的时候发现没法修复,提示Superblock invalid。class

[root@ad4 ~]# fsck -t ext4 /dev/sdb监控

fsck from util-linux-ng 2.17.2file

e2fsck 1.41.12 (17-May-2010)

fsck.ext4: Superblock invalid, trying backup blocks...

fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb

The superblock could not be read or does not describe a correct ext2

filesystem.  If the device is valid and it really contains an ext2

filesystem (and not swap or ufs or something else), then the superblock

is corrupt, and you might try running e2fsck with an alternate superblock:

    e2fsck -b 8193 <device>

三、查看文件系统备份Superblock

[root@ad4 ~]# mke2fs -n /dev/sdb         

mke2fs 1.41.12 (17-May-2010)

/dev/sdb is entire device, not just one partition!

Proceed anyway? (y,n) y

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=1 blocks, Stripe width=0 blocks

122093568 inodes, 488364854 blocks

24418242 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

14904 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

        102400000, 214990848

四、修复文件系统   

e2fsck -b 214990848 -y /dev/sdb

 出现了不少修复的东西,修复了一会





  修复好以后,挂载进去目录查看以下

相关文章
相关标签/搜索