我在具有 1 个分区的 12TB 设备上配置了 LVM。然后,我尝试将 LVM 扩展到具有 1 个分区的第二个 12TB 设备上。vgextend 工作正常,但 lvextend 看不到第二个设备上的空间。
以下是我对第二个设备的分区方式:
# parted /dev/mapper/3600a09803830304d2f2b456f61565846
GNU Parted 2.1
Using /dev/mapper/3600a09803830304d2f2b456f61565846
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) mkpart primary xfs 0% 100%
(parted) set 1 lvm on
(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/3600a09803830304d2f2b456f61565846: 12.9TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 12.9TB 12.9TB primary lvm
(parted) quit
Information: You may need to update /etc/fstab.
扩展卷组有效:
# vgextend datalake /dev/mapper/3600a09803830304d2f2b456f61565846p1
Physical volume "/dev/mapper/3600a09803830304d2f2b456f61565846p1" successfully created
Volume group "datalake" successfully extended
扩展逻辑卷不起作用:
# lvextend -l100%FREE /dev/datalake/volume
New size (3071999 extents) matches existing size (3071999 extents)
Run `lvextend --help' for more information.
我之后尝试运行 xfs_growfs,但文件系统仍然保持相同的大小:
# xfs_growfs /datalake
meta-data=/dev/mapper/datalake-volume isize=256 agcount=32, agsize=98303967 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=3145726944, imaxpct=5
= sunit=1 swidth=16 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal bsize=4096 blocks=521728, version=2
= sectsz=512 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
它应该看到 24T 的空间,但是它只看到 12T:
# df -h /datalake
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/datalake-volume
12T 34M 12T 1% /datalake
该卷组的 pvs 输出:
# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/3600a09803830304d2f2b456f61565846p1 datalake lvm2 a-- 11.72t 11.72t
/dev/mapper/3600a09803830304e2f5d464474527471p1 datalake lvm2 a-- 11.72t 0
该卷组的 vgs 输出:
# vgs
VG #PV #LV #SN Attr VSize VFree
datalake 2 1 0 wz--n- 23.44t 11.72t
该卷组的 lvs 输出:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
volume datalake -wi-ao---- 11.72t
如何将逻辑卷扩展到完整的 24TB?
答案1
当您使用lvextend
或 时lvresize
,您需要使用+
或 指定为 lvm 卷分配的更多空间或扩展
例子:
lvextend -l +100%FREE /dev/datalake/volume
或无+
lvextend -l <total number of extends to catch up> /dev/datalake/volume
我更喜欢使用第一种方法,因为这样我不需要知道已分配的扩展和新的扩展的数量。