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
END

本文标题:因LVM错误扩容缩减导致分区无法mount

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202210467.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2022 年 11 月 10 日
如果觉得我的文章对你有用,请随意赞赏