恢复ext4文件系统superblock

恢复ext4文件系统superblock
1. Create ext4 文件系统。
[root@localhost ~]# mkfs.ext4 /dev/vdb1
[root@localhost ~]# partprobe /dev/vdb

2. 挂载文件系统
[root@localhost ~]# grep vdb2 /etc/fstab
/dev/vdb1    /ext4    ext4    defaults    0 0

[root@localhost ~]# mount -a

[root@localhost ~]# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/vdb1                        100G  1.7G   94G   2% /ext4

3. 卸载文件系统,并破坏super block
[root@localhost ~]# umount /ext4
[root@localhost ~]#  
[root@localhost ~]# dd if=/dev/zero of=/dev/vdb1 bs=1024 count=5
5+0 records in
5+0 records out
5120 bytes (5.1 kB) copied, 0.00481915 s, 1.1 MB/s

[root@localhost ~]# partx /dev/vdb
partx: /dev/vdb: failed to read partition table
[root@localhost ~]#
[root@localhost ~]# mount /ext4
mount: wrong fs type, bad option, bad superblock on /dev/vdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[root@localhost ~]# dmesg
[22600278.492089] EXT4-fs (vdb1): VFS: Can't find ext4 filesystem

4. 恢复superblock
[root@localhost ~]# fsck -t ext4 /dev/vdb1
fsck from util-linux 2.20.1
e2fsck 1.41.14 (22-Dec-2010)
fsck.ext4: Superblock invalid, trying backup blocks...
One or more block group descriptor checksums are invalid.  Fix? yes

Group descriptor 0 checksum is invalid.  FIXED.
Group descriptor 1 checksum is invalid.  FIXED.
Group descriptor 2 checksum is invalid.  FIXED.
...
Fix? yes


/dev/vdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/vdb1: 11/6553600 files (0.0% non-contiguous), 459349/26214144 blocks

5. 测试是否恢复了。
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/vdb1                        100G  1.7G   94G   2% /ext4

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

转载于:http://blog.itpub.net/29048127/viewspace-1134127/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值