resize2fs:尝试打开时超级块中的魔术码错误 [英] resize2fs: Bad magic number in super-block while trying to open

查看:102
本文介绍了resize2fs:尝试打开时超级块中的魔术码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在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)并使用更大的端块重新创建它,然后使用lvm pvresize调整物理卷的大小,然后使用lvm lvresize调整逻辑卷的大小.到目前为止,一切仍然正常.

一旦我尝试使用resize2fs,并且使用上述两种方法,都会收到完全相同的错误.

希望以下内容可以阐明一些问题.

fdisk -l <​​/p>

[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

pvdisplay

[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

vgdisplay

[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

lvdisplay

[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

I am trying to resize a logical volume on CentOS7 but am running into the following error:

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.

I have tried adding a new partition (using fdisk) and using vgextend to extend the volume group, then resizing. Resize worked fine for the logical volume using lvextend, but it failed at resize2fs.

I have also tried deleting an existing partition (using fdisk) and recreating it with a larger end block, then resizing the physical volume using lvm pvresize, followed by a resize of the logical volume using lvm lvresize. Again everything worked fine up to this point.

Once I tried to use resize2fs, using both methods as above, I received the exact same error.

Hopefully some of the following will shed some light.

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

pvdisplay

[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

vgdisplay

[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

lvdisplay

[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

I've probably done something stupid, so any help would be greatly appreciated!

解决方案

After a bit of trial and error... as mentioned in the possible answers, it turned out to require xfs_growfs rather than resize2fs.

CentOS 7,

fdisk /dev/xvda

Create new primary partition, set type as linux lvm.

n
p
3
t
8e
w

Create a new primary volume and extend the volume group to the new volume.

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

Check the physical volume for free space, extend the logical volume with the free space.

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

Finally perform an online resize to resize the logical volume, then check the available space.

xfs_growfs /dev/centos/root
df -h

这篇关于resize2fs:尝试打开时超级块中的魔术码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆