Proxmox Tips â
Grow LUKS crypt partition. â
TIP
This can be done even if the disk is active! No need to restart guest VM.
@ref: https://unix.stackexchange.com/questions/320957/extend-a-luks-encrypted-partition-to-fill-disk
# cryptsetup status /dev/mapper/dm_crypt-0
/dev/mapper/dm_crypt-0 is active and is in use.
type: LUKS2
cipher: aes-xts-plain64
keysize: 512 bits
key location: keyring
device: /dev/sda3
sector size: 512
offset: 32768 sectors
size: 128833536 sectors
mode: read/write
Extend lvs
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Tell cryptsetup to update
cryptsetup resize /dev/mapper/dm_crypt-0
Use parted to resize
# parted
(parted) resizepart 3
End? [206GB]? <enter 100%> here
pvresize
# pvresize /dev/mapper/dm_crypt-0
Physical volume "/dev/mapper/dm_crypt-0" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
vgs
should show updated size
# vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- <189.43g 128.00g
resize lvm
# lvresize -l+100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from <61.43 GiB (15726 extents) to <189.43 GiB (48494 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
check lvs
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
ubuntu-lv ubuntu-vg -wi-ao---- <189.43g
resize
# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 8, new_desc_blocks = 24
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 49657856 (4k) blocks long.
done!
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 5.7M 1.6G 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 187G 48G 131G 27% /
...