本文主要是介绍Linux系统LVM扩容报Logical volume datavg/lv_data successfully resized,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Linux系统LVM扩容报Logical volume datavg/lv_data successfully resized
问题现象
今天在对现有的环境进行扩容的时候报Couldn’t find valid filesystem superblock错误
[root@ZHHALxjspo0db021 ~]# resize2fs /dev/datavg/lv_data
resize2fs 1.45.3 (14-Jul-2019)
resize2fs: Bad magic number in super-block while trying to open /dev/datavg/lv_data
Couldn't find valid filesystem superblock.
问题定位与分析
在遇到该问题后,我这边先对挂载磁盘的存储信息和LVM的vg和lv的信息进行了查看
[root@ZHHALxjspo0db021 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 5.0M 16G 1% /dev/shm
tmpfs 16G 24M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/rootvg-lv_root 100G 9.3G 91G 10% /
/dev/sda2 1014M 312M 703M 31% /boot
/dev/sda1 200M 5.8M 195M 3% /boot/efi
/dev/mapper/datavg-lv_data 400G 361G 40G 91% /data
/dev/mapper/rootvg-lv_kdump 30G 63M 30G 1% /kdump
/dev/mapper/rootvg-lv_pkg 30G 63M 30G 1% /pkg
/dev/mapper/rootvg-lv_tmp 50G 96M 50G 1% /tmp
/dev/mapper/rootvg-lv_home 50G 36G 15G 71% /home
/dev/mapper/rootvg-lv_hxb_home 50G 84M 50G 1% /home/hxb
/dev/mapper/rootvg-lv_itm 10G 81M 10G 1% /itm
tmpfs 3.1G 0 3.1G 0% /run/user/0
tmpfs 3.1G 0 3.1G 0% /run/user/710
103.161.75.43:/686055f00c1c11ef8000fa163eca3664/3a7b18500c2611ef8000fa163eca3664 1.3T 83G 1.2T 7% /ob_backup
[root@ZHHALxjspo0db021 ~]# vgsVG #PV #LV #SN Attr VSize VFreedatavg 1 1 0 wz--n- 1.20t <430.00grootvg 1 8 0 wz--n- 348.80g 12.80g
[root@ZHHALxjspo0db021 ~]# lvsLV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convertlv_data datavg -wi-ao---- 800.00glv_home rootvg -wi-ao---- 50.00glv_hxb_home rootvg -wi-ao---- 50.00glv_itm rootvg -wi-ao---- 10.00glv_kdump rootvg -wi-ao---- 30.00glv_pkg rootvg -wi-ao---- 30.00glv_root rootvg -wi-ao---- 100.00glv_swap rootvg -wi-a----- 16.00glv_tmp rootvg -wi-ao---- 50.00g
根据上面查看的信息,发现lv的扩容是成功,只是由于resize2fs执行失败没有生效。因此就根据报错进行搜索Couldn’t find valid filesystem superblock,在相关文档找到了xfs_growfs和resize2fs两种命令使LV扩容生效,通过对两种命令的详细了解,发现使由于不同的文件系统使用不同的命令。其中xfs_growfs用于xfs文件系统,resize2fs用于ext2、ext3、ext4文件系统。这个时候我们查看现在文件系统使用的xfs,到这里其实我们就大概知道,是使用命令错误了。
[root@ZHHALxjspo0db021 ~]# cat /etc/fstab#
# /etc/fstab
# Created by anaconda on Mon Jan 22 14:06:27 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/rootvg-lv_root / xfs defaults 0 0
UUID=cf581f78-d0ef-4c00-857f-7218c6b0d59a /boot xfs defaults 0 0
UUID=5D28-EC3B /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
/dev/mapper/rootvg-lv_home /home xfs defaults 0 0
/dev/mapper/rootvg-lv_hxb_home /home/hxb xfs defaults 0 0
/dev/mapper/rootvg-lv_itm /itm xfs defaults 0 0
/dev/mapper/rootvg-lv_kdump /kdump xfs defaults 0 0
/dev/mapper/rootvg-lv_pkg /pkg xfs defaults 0 0
/dev/mapper/rootvg-lv_tmp /tmp xfs defaults 0 0
/dev/mapper/datavg-lv_data /data xfs defaults 0 0
103.161.75.43:/686055f00c1c11ef8000fa163eca3664/3a7b18500c2611ef8000fa163eca3664 /ob_backup nfs rw,nfsvers=4.1,sync,lookupcache=positive,hard,timeo=600,wsi ze=1048576,rsize=1048576,namlen=255 0 0
问题处理
在使用xfs_growfs命令后,报如下错误
[root@ZHHALxjspo0db021 ~]# xfs_growfs /dev/mapper/datavg-lv_data
xfs_growfs: /dev/mapper/datavg-lv_data is not a mounted XFS filesystem
根据上面的报错看,是找不到挂在的文件系统,因此就猜测可能使命令参数可能有问题,因此查看帮忙信息,这个时候我们发现xfs_growfs后面使用的mountpoint挂载点。
[root@ZHHALxjspo0db021 ~]# xfs_growfs --help
xfs_growfs: invalid option -- '-'
Usage: xfs_growfs [options] mountpointOptions:-d grow data/metadata section-l grow log section-r grow realtime section-n don't change anything, just show geometry-i convert log from external to internal format-t alternate location for mount table (/etc/mtab)-x convert log from internal to external format-D size grow data/metadata section to size blks-L size grow/shrink log section to size blks-R size grow realtime section to size blks-e size set realtime extent size to size blks-m imaxpct set inode max percent to imaxpct-V print version information
在把xfs_growfs的参数修改挂载点后,命令执行成功,到这里得到解决。
[root@ZHHALxjspo0db021 ~]# xfs_growfs /data
meta-data=/dev/mapper/datavg-lv_data isize=512 agcount=4, agsize=26213888 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=1, sparse=1, rmapbt=0= reflink=0
data = bsize=4096 blocks=104855552, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=51199, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 104855552 to 209715200
[root@ZHHALxjspo0db021 ~]#
[root@ZHHALxjspo0db021 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 5.0M 16G 1% /dev/shm
tmpfs 16G 24M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/mapper/rootvg-lv_root 100G 9.3G 91G 10% /
/dev/sda2 1014M 312M 703M 31% /boot
/dev/sda1 200M 5.8M 195M 3% /boot/efi
/dev/mapper/datavg-lv_data 800G 361G 439G 46% /data
/dev/mapper/rootvg-lv_kdump 30G 63M 30G 1% /kdump
/dev/mapper/rootvg-lv_pkg 30G 63M 30G 1% /pkg
/dev/mapper/rootvg-lv_tmp 50G 95M 50G 1% /tmp
/dev/mapper/rootvg-lv_home 50G 36G 15G 71% /home
/dev/mapper/rootvg-lv_hxb_home 50G 84M 50G 1% /home/hxb
/dev/mapper/rootvg-lv_itm 10G 81M 10G 1% /itm
tmpfs 3.1G 0 3.1G 0% /run/user/0
tmpfs 3.1G 0 3.1G 0% /run/user/710
103.161.75.43:/686055f00c1c11ef8000fa163eca3664/3a7b18500c2611ef8000fa163eca3664 1.3T 83G 1.2T 7% /ob_backup
问题总结
这个问题主要使自己平时安装操作系统使用的都是ext的文件使用,没有注意到xfs文件系统对于逻辑卷的扩容还需要特殊的命令才可以生效。问题虽然解决,但是也顺便记录一下自己解决问题的过程。
这篇关于Linux系统LVM扩容报Logical volume datavg/lv_data successfully resized的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!