Ubuntu

在 Ubuntu 20.4 上擴展 LVM

  • October 11, 2021

如何將剩餘的 19.5GB 從添加sda2vg00-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 

提前致謝!

您需要調整其中的物理捲和邏輯卷的大小。

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

引用自:https://unix.stackexchange.com/questions/672754