gpt4 book ai didi

lvm - 调整大小2fs : Bad magic number in super-block while trying to open

转载 作者:行者123 更新时间:2023-12-03 04:32:42 38 4
gpt4 key购买 nike

我正在尝试调整 CentOS7 上的逻辑卷大小,但遇到以下错误:

resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.

我尝试添加新分区(使用 fdisk)并使用 vgextend 扩展卷组,然后调整大小。使用 lvextend 调整逻辑卷大小工作正常,但在 resize2fs 上失败。

我还尝试删除现有分区(使用 fdisk)并使用更大的结束 block 重新创建它,然后使用 lvm pvresize 调整物理卷的大小,然后使用 lvm lvresize 调整逻辑卷的大小。到目前为止,一切都运行良好。

当我尝试使用 resize2fs 时,使用上述两种方法,我收到了完全相同的错误。

希望以下内容能够提供一些启发。

fdisk -l

[root@server~]# fdisk -l

Disk /dev/xvda: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0009323a

Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 1026047 512000 83 Linux
/dev/xvda2 1026048 41943039 20458496 8e Linux LVM
/dev/xvda3 41943040 62914559 10485760 8e Linux LVM

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-root: 29.5 GB, 29532094464 bytes, 57679872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

pv显示

[root@server ~]# pvdisplay
--- Physical volume ---
PV Name /dev/xvda2
VG Name centos
PV Size 19.51 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID 7bJOPh-OUK0-dGAs-2yqL-CAsV-TZeL-HfYzCt

--- Physical volume ---
PV Name /dev/xvda3
VG Name centos
PV Size 10.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2559
Free PE 0
Allocated PE 2559
PV UUID p0IClg-5mrh-5WlL-eJ1v-t6Tm-flVJ-gsJOK6

vg显示

[root@server ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 29.50 GiB
PE Size 4.00 MiB
Total PE 7553
Alloc PE / Size 7553 / 29.50 GiB
Free PE / Size 0 / 0
VG UUID FD7k1M-koJt-2veW-sizL-Srsq-Y6zt-GcCfz6

lv显示

[root@server ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID KyokrR-NGsp-6jVA-P92S-QE3X-hvdp-WAeACd
LV Write Access read/write
LV Creation host, time localhost, 2014-10-09 08:28:42 +0100
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID ugCOcT-sTDK-M8EV-3InM-hjIg-2nwS-KeAOnq
LV Write Access read/write
LV Creation host, time localhost, 2014-10-09 08:28:42 +0100
LV Status available
# open 1
LV Size 27.50 GiB
Current LE 7041
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

我可能做了一些愚蠢的事情,所以任何帮助将不胜感激!

最佳答案

经过一番尝试和错误...正如可能的答案中提到的,结果需要 xfs_growfs 而不是 resize2fs

CentOS 7,

fdisk /dev/xvda

新建主分区,类型设置为linux lvm

n
p
3
t
8e
w

创建新的主卷并将卷组扩展到新卷。

partprobe
pvcreate /dev/xvda3
vgextend /dev/centos /dev/xvda3

检查物理卷的可用空间,用可用空间扩展逻辑卷。

vgdisplay -v
lvextend -l+288 /dev/centos/root

最后执行在线调整大小来调整逻辑卷的大小,然后检查可用空间。

xfs_growfs /dev/centos/root
df -h

关于lvm - 调整大小2fs : Bad magic number in super-block while trying to open,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26305376/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com