![什么阻止我扩展 LVM 逻辑卷?](https://linux22.com/image/718807/%E4%BB%80%E4%B9%88%E9%98%BB%E6%AD%A2%E6%88%91%E6%89%A9%E5%B1%95%20LVM%20%E9%80%BB%E8%BE%91%E5%8D%B7%EF%BC%9F.png)
我从我的旧电脑转移了一个 LVM-on-LUKS 分区,并且几乎成功调整了它的大小以使用全部 223 GB。
这是一个典型的 Ubuntu 安装,具有两个 LVM 分区:
~# 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
...
我还有一个占用整个大小的 PV 和 VG:
~# 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
此典型的 Ubuntu 安装有两个 LV:
~# 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
我想调整根分区的大小以使用一些剩余空间:
~# lvresize -L +10G /dev/mapper/szop--vg-root
Insufficient free space: 2560 extents needed, but only 0 available
为什么我会收到这个错误?
答案1
我需要Allocatable yes
使用以下方式标记我的 PV 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
此后,我可以成功调整我的 LV 大小。