LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)

时间:2023-03-08 17:38:13
LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
 LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while) -- ::

分类: Linux

LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)
给某个硬盘增加分区之后
[root@Mysql01-- ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mysql0121366-LogVol02 .7G .6G .8G % /
tmpfs 495M 495M % /dev/shm
/dev/sda1 194M 29M 155M % /boot
/dev/mapper/vg_mysql0121366-LogVol01 .0G .1G .0G % /data
这里增加/data大小
[root@Mysql01-- ~]# fdisk -l /dev/sda Disk /dev/sda: 40.8 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000eb81f Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM 进行分区
[root@Mysql01-- ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). Command (m for help): n
Command action
e extended
p primary partition (-)
p
Partition number (-):
First cylinder (-, default ):
Using default value
Last cylinder, +cylinders or +size{K,M,G} (-, default ):
Using default value Command (m for help): p Disk /dev/sda: 40.8 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000eb81f Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM
/dev/sda3 Linux Command (m for help): t
Partition number (-):
Hex code (type L to list codes): 8e
Changed system type of partition to 8e (Linux LVM) Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error : Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe() or kpartx()
Syncing disks. 重启服务器或者 partprobe
创建物理卷
[root@Mysql01-- ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
使用vgscan查询物理卷
[root@Mysql01-- ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_mysql0121366" using metadata type lvm2
使用新增物理卷扩展vg
[root@Mysql01-- ~]# vgextend vg_mysql0121366 /dev/sda3
Volume group "vg_mysql0121366" successfully extended
[root@Mysql01-- ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_mysql0121366" using metadata type lvm2
查询vg
[root@Mysql01-- ~]# vgdisplay
--- Volume group ---
VG Name vg_mysql0121366
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 37.79 GiB
PE Size 4.00 MiB
Total PE
Alloc PE / Size / 17.80 GiB
Free PE / Size / 19.99 GiB
VG UUID Zy2PVv-xSsx-NEAv-L6ba-G8Oy-tBBq-5zXKQm
查询lv
[root@Mysql01-- ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_mysql0121366/LogVol01
LV Name LogVol01
VG Name vg_mysql0121366
LV UUID 5znkJ2-wdeZ-Y2o1-ECDS-gzzl-PqaS-qo2yZR
LV Write Access read/write
LV Creation host, time Mysql01--, -- :: +
LV Status available
# open
LV Size 8.00 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Logical volume ---
LV Path /dev/vg_mysql0121366/LogVol00
LV Name LogVol00
VG Name vg_mysql0121366
LV UUID b1FV1n-iKyK-kZ23-glRO-opFh-gDRp-TzWNcL
LV Write Access read/write
LV Creation host, time Mysql01--, -- :: +
LV Status available
# open
LV Size 2.00 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : --- Logical volume ---
LV Path /dev/vg_mysql0121366/LogVol02
LV Name LogVol02
VG Name vg_mysql0121366
LV UUID eoVdk3-cbcP-9PlI-kZBL-6pY2-Jpbl-1WI2uH
LV Write Access read/write
LV Creation host, time Mysql01--, -- :: +
LV Status available
# open
LV Size 7.80 GiB
Current LE
Segments
Allocation inherit
Read ahead sectors auto
- currently set to
Block device : [root@Mysql01-- ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mysql0121366-LogVol02 .7G .6G .8G % /
tmpfs 495M 495M % /dev/shm
/dev/sda1 194M 29M 155M % /boot
/dev/mapper/vg_mysql0121366-LogVol01 .0G .1G .0G % /data
扩展lv
[root@Mysql01-- ~]# lvextend -L +19G /dev/mapper/vg_mysql0121366-LogVol01
Extending logical volume LogVol01 to 27.00 GiB
Logical volume LogVol01 successfully resized
[root@Mysql01-- ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mysql0121366-LogVol02 .7G .6G .8G % /
tmpfs 495M 495M % /dev/shm
/dev/sda1 194M 29M 155M % /boot
/dev/mapper/vg_mysql0121366-LogVol01 .0G .1G .0G % /data
若不是xfs我们可以用resize2fs,这里报错了
[root@Mysql01-- ~]# resize2fs -f /dev/mapper/vg_mysql0121366-LogVol01
resize2fs 1.41. (-May-)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/vg_mysql0121366-LogVol01
Couldn't find valid filesystem superblock.
[root@Mysql01-- ~]# xfs_growfs /dev/mapper/vg_mysql0121366-LogVol01
meta-data=/dev/mapper/vg_mysql0121366-LogVol01 isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to
[root@Mysql01-- ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_mysql0121366-LogVol02 .7G .6G .8G % /
tmpfs 495M 495M % /dev/shm
/dev/sda1 194M 29M 155M % /boot
/dev/mapper/vg_mysql0121366-LogVol01 27G .1G 24G % /data