51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

因LVM错误扩容缩减导致分区无法mount

LVM扩容之后未刷新磁盘分区,导致磁盘分区block过大,无法挂载。

[root@cloud-master ~]# mount /dev/mapper/centos-Data_DBs1 /data/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/centos-Data_DBs1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.



`[root@cloud-master ~]# dmesg | tail
[    3.462749] IPv6: ADDRCONF(NETDEV_UP): ens32: link is not ready
[    3.465232] IPv6: ADDRCONF(NETDEV_CHANGE): ens32: link becomes ready
[    3.485060] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[    3.535564] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    3.545565] Netfilter messages via NETLINK v0.30.
[    3.548498] ip_set: protocol 6
[    5.610284] floppy0: no floppy controllers found
[    5.610320] work still pending
[   24.807799] EXT4-fs (dm-1): bad geometry: block count 1309696 exceeds size of device (131072 blocks)
[   43.774927] EXT4-fs (dm-1): bad geometry: block count 1309696 exceeds size of device (131072 blocks)`

补救措施

在不接触 inode 的情况下重新初始化超级块和组描述符并尝试恢复数据。

mkfs.ext4 -S /dev/sdc1

然后

fsck.ext4 -fy /dev/sdc1

恢复的数据将在 lost+found 文件夹中,会失去名称。

[root@cloud-master lost+found]# ll
total 12
drwxr-xr-x. 2 root root 4096 Nov 10 13:15 #9218
drwx------. 2 root root 4096 Nov 10 13:14 #9227
-rw-r--r--. 1 root root    8 Nov 10 13:15 #9229
testdisk恢复

官网:https://www.cgsecurity.org/

具体操作请参考网络,自测仅能恢复文件,不能完全恢复分区。

使用 testdisk 恢复旧的分区大小会更好。

yum -y install epel-release
yum install testdisk
赞(0)
未经允许不得转载:工具盒子 » 因LVM错误扩容缩减导致分区无法mount