Was hindert mich daran, ein logisches LVM-Volume zu erweitern?

Was hindert mich daran, ein logisches LVM-Volume zu erweitern?

Ich habe eine LVM-auf-LUKS-Partition von meinem alten Computer übertragen und es fast geschafft, ihre Größe so zu ändern, dass alle 223 GB genutzt werden.

Es ist eine typische Ubuntu-Installation mit zwei LVM-Partitionen:

~# lsblk

...
└─sda5                                          8:5    0   223G  0 part  
  └─luks-a8df437a-7906-4574-a6ff-16e337f8cb19 252:0    0   223G  0 crypt 
    ├─szop--vg-root                           252:1    0 146.6G  0 lvm   
    └─szop--vg-swap_1                         252:2    0     2G  0 lvm   
...

Ich habe auch ein PV und VG, die die gesamte Größe einnehmen:

~# pvdisplay

  --- Physical volume ---
  PV Name               /dev/mapper/luks-a8df437a-7906-4574-a6ff-16e337f8cb19
  VG Name               szop-vg
  PV Size               223.04 GiB / not usable 1.84 MiB
  Allocatable           NO
  PE Size               4.00 MiB
  Total PE              57097
  Free PE               19064
  Allocated PE          38033
  PV UUID               oxRbRw-P8xz-wTM9-1p1n-UkP7-zknB-31AHLR

~# vgdisplay

  --- Volume group ---
  VG Name               szop-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  20
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               223.04 GiB
  PE Size               4.00 MiB
  Total PE              57097
  Alloc PE / Size       38033 / 148.57 GiB
  Free  PE / Size       19064 / 74.47 GiB
  VG UUID               IFezjq-rKPJ-Ydko-JV9P-l8RM-4oX8-Tijx9w

Für diese typische Ubuntu-Installation gibt es zwei LVs:

~# lvdisplay

  --- Logical volume ---
  LV Path                /dev/szop-vg/root
  LV Name                root
  VG Name                szop-vg
  LV UUID                a7BeRt-5STg-gbsr-cBES-h2q8-P0yT-nuK2Ic
  LV Write Access        read/write
  LV Creation host, time szop, 2016-08-07 16:39:48 +0000
  LV Status              available
  # open                 0
  LV Size                146.59 GiB
  Current LE             37528
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

  --- Logical volume ---
  LV Path                /dev/szop-vg/swap_1
  LV Name                swap_1
  VG Name                szop-vg
  LV UUID                On2jUZ-UTqF-3AxH-YkVq-DYPn-dbUA-2cq3iy
  LV Write Access        read/write
  LV Creation host, time szop, 2016-08-07 16:39:49 +0000
  LV Status              available
  # open                 0
  LV Size                1.97 GiB
  Current LE             505
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

Ich möchte die Größe der Root-Partition ändern, um den verbleibenden Speicherplatz zu nutzen:

~# lvresize -L +10G /dev/mapper/szop--vg-root

  Insufficient free space: 2560 extents needed, but only 0 available

Warum erhalte ich diesen Fehler?

Antwort1

Ich musste mein PV folgendermaßen Allocatable yesmarkieren pvchange:

~# pvchange -xy /dev/mapper/szop--vg-root

Physical volume "/dev/mapper/luks-a8df437a-7906-4574-a6ff-16e337f8cb19" changed
1 physical volume changed / 0 physical volumes not changed

Danach konnte ich die Größe meines LV erfolgreich ändern.

verwandte Informationen