Lvm

lvextend:新大小(3071999 個擴展區)與現有大小(3071999 個擴展區)匹配

  • August 12, 2016

我在具有 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

此卷組的 pv 輸出:

# 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?

當您使用lvextendorlvresize時,您需要使用+or 指定為您的 lvm 卷分配的更多空間或擴展

例子:

lvextend -l +100%FREE /dev/datalake/volume

或沒有+

lvextend -l <total number of extends to catch up> /dev/datalake/volume

我更喜歡使用第一種方法,因為這樣我不需要知道分配的擴展數和新擴展數。

引用自:https://serverfault.com/questions/670009