xfs文件系统不支持缩小操作,如果要踢盘,那就必须把目录做备份,重做挂接点拷贝恢复了。
[root@oem /]# umount /app
[root@oem /]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 132.00g
swap centos -wi-ao---- <6.69g
datalv datavg -wi-a----- 924.00m
[root@oem /]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 138.69g 4.00m
/dev/sdb datavg lvm2 a-- 1020.00m 96.00m
[root@oem /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 140G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 138.7G 0 part
├─centos-root 253:0 0 132G 0 lvm /
└─centos-swap 253:1 0 6.7G 0 lvm [SWAP]
sdb 8:16 0 1G 0 disk
└─datavg-datalv 253:2 0 924M 0 lvm
sdc 8:32 0 1G 0 disk
sr0 11:0 1 1024M 0 rom
[root@oem /]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 138.69g 4.00m
datavg 1 1 0 wz--n- 1020.00m 96.00m
[root@oem /]# mkfs.xfs /dev/datavg/datalv
mkfs.xfs: /dev/datavg/datalv appears to contain an existing filesystem (ext4).
mkfs.xfs: Use the -f option to force overwrite.
[root@oem /]# mkfs.xfs /dev/datavg/datalv -f
meta-data=/dev/datavg/datalv isize=512 agcount=4, agsize=59136 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=236544, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@oem /]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Oct 6 19:45:05 2020
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=14d08e59-107d-4e6d-b7ef-e77f1bbd49a3 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/dev/datavg/datalv /app xfs defaults 0 0
192.168.52.141@tcp:/sgfs /lustre/sgfs lustre defaults 0 0
~
"/etc/fstab" 13L, 578C written
[root@oem /]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Oct 6 19:45:05 2020
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=14d08e59-107d-4e6d-b7ef-e77f1bbd49a3 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/dev/datavg/datalv /app xfs defaults 0 0
192.168.52.141@tcp:/sgfs /lustre/sgfs lustre defaults 0 0
[root@oem /]# mount /app
[root@oem /]# df -hT /app
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/datavg-datalv xfs 921M 33M 889M 4% /app
[root@oem /]# cp /home/oracle/soft/em13400_linux64-5.zip /app/
[root@oem /]# df -hT /app
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/datavg-datalv xfs 921M 803M 118M 88% /app
[root@oem /]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created.
[root@oem /]# vgextend datavg /dev/sdc
Volume group "datavg" successfully extended
[root@oem /]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 138.69g 4.00m
/dev/sdb datavg lvm2 a-- 1020.00m 96.00m
/dev/sdc datavg lvm2 a-- 1020.00m 1020.00m
[root@oem /]# lvextend -l +100%free /dev/datavg/datalv
Size of logical volume datavg/datalv changed from 924.00 MiB (231 extents) to 1.99 GiB (510 extents).
Logical volume datavg/datalv successfully resized.
[root@oem /]# xfs_growfs /dev/datavg/datalv
meta-data=/dev/mapper/datavg-datalv isize=512 agcount=4, agsize=59136 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=236544, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 236544 to 522240
[root@oem /]# df -hT /app
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/datavg-datalv xfs 2.0G 804M 1.3G 40% /app
[root@oem /]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 138.69g 4.00m
/dev/sdb datavg lvm2 a-- 1020.00m 0
/dev/sdc datavg lvm2 a-- 1020.00m 0
[root@oem /]# vgreduce datavg /dev/sdc
Physical volume "/dev/sdc" still in use
[root@oem /]# pvs -o+pv_used
PV VG Fmt Attr PSize PFree Used
/dev/sda2 centos lvm2 a-- 138.69g 4.00m <138.69g
/dev/sdb datavg lvm2 a-- 1020.00m 0 1020.00m
/dev/sdc datavg lvm2 a-- 1020.00m 0 1020.00m
[root@oem /]# lvresize -L 0.9G -r /dev/datavg/datalv
Rounding size to boundary between physical extents: 924.00 MiB.
fsadm: Xfs filesystem shrinking is unsupported.
/usr/sbin/fsadm failed: 1
Filesystem resize failed.
[root@oem /]#
2019-01-17 Centos7 LVM XFS 分区大小调整 - 简书
剔除vg中的pv--ext4文件系统-CSDN博客
继续做备份恢复:安装xfsdump做备份,需注意足够的空间存储备份。
[root@oem /]# yum install xfsdump -y
Loaded plugins: fastestmirror
Determining fastest mirrors
(1/2): attr-2.4.46-13.el7.x86_64.rpm | 66 kB 00:00:00
(2/2): xfsdump-3.1.7-1.el7.x86_64.rpm | 308 kB 00:00:02
-------------------------------------------------------------------------------------------------------------------------------------------
Total 11 kB/s | 374 kB 00:00:34
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : attr-2.4.46-13.el7.x86_64 1/2
Installing : xfsdump-3.1.7-1.el7.x86_64 2/2
Verifying : attr-2.4.46-13.el7.x86_64 1/2
Verifying : xfsdump-3.1.7-1.el7.x86_64 2/2
Installed:
xfsdump.x86_64 0:3.1.7-1.el7
Dependency Installed:
attr.x86_64 0:2.4.46-13.el7
Complete!
[root@oem /]# xfsdump --help
xfsdump: version 3.1.7 (dump format 3.0)
xfsdump: usage: xfsdump [ -a (dump DMF dualstate files as offline) ]
[ -b
[ -c
[ -d
[ -e (allow files to be excluded) ]
[ -f
[ -h (help) ]
[ -l
[ -m (force usage of minimal rmt) ]
[ -o (overwrite tape) ]
[ -p
[ -q
xfs文件系统调整lvm容量-yepyang-ChinaUnix博客