如何将剩余的 19.5GB 添加sda2
到vg00-lv01
?我尝试过lvextend
,但这告诉我Insufficient free space: 512 extents needed, but only 0 available
。
我使用的是 Ubuntu 20.4。
NAME FSTYPE SIZE MOUNTPOINT LABEL
sda 20G
├─sda1 ext4 487M /boot
└─sda2 LVM2_member 19.5G
├─vg00-lv00 swap 1.9G [SWAP]
└─vg00-lv01 ext4 7.6G /
sr0 1024M
输出sudo fdisk -l /dev/sda
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x520f1760
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 999424 41943039 40943616 19.5G 8e Linux LVM
输出pvs -a
PV VG Fmt Attr PSize PFree
/dev/sda1 --- 0 0
/dev/sda2 vg00 lvm2 a-- <9.52g 0
提前致谢!
答案1
您需要调整物理卷和逻辑卷的大小。
pvresize /dev/sda2
lvextend /dev/vg00-lvol1 /dev/sda2 # grow the LV by the amount of free PV
fsadm resize /dev/vg00/lvol1 # grow the FS within the LV