参考
LVMパーティションを縮小したい
設定
pvscan
# pvscan
PV /dev/sdc3 VG pve lvm2 [74.40 GiB / 48.15 GiB free]
Total: 1 [74.40 GiB] / in use: 1 [74.40 GiB] / in no VG: 0 [0 ]
- 74.40 - 48.15 = 26.25
26.25GBを指定したら怒られた
# pvresize --setphysicalvolumesize 26.25G /dev/sdc3
/dev/sdc3: cannot resize to 6719 extents as 6720 are allocated.
0 physical volume(s) resized / 1 physical volume(s) not resized
27GBの指定で成功
# pvresize --setphysicalvolumesize 27G /dev/sdc3
Physical volume "/dev/sdc3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc3 pve lvm2 a-- 27.00g 764.00m
確認
# gdisk -l /dev/sdc
Number Start (sector) End (sector) Size Code Name
1 34 2047 1007.0 KiB EF02
2 2048 262143 127.0 MiB EF00
3 262144 156301454 74.4 GiB 8E00
gdiskでsdc3のサイズを変更
# gdisk /dev/sdc
Command (? for help): d
Partition number (1-3): 3
Command (? for help): n
Partition number (3-128, default 3):
First sector (262144-156301454, default = 262144) or {+-}size{KMGTP}:
Last sector (262144-156301454, default = 156301454) or {+-}size{KMGTP}: +27G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8E00
Changed type of partition to 'Linux LVM'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
- 念のためOS再起動した。