Last active
April 5, 2024 13:14
-
-
Save theodric/9e10908c393d8905bf1f96906d535f74 to your computer and use it in GitHub Desktop.
Resize encrypted LVM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IN SHORT: | |
0. increase size of outermost container (grow qcow2, dd disk to larger disk, etc.) | |
1. increase size of partition containing the encrypted volume set (cfdisk, fdisk, etc.) | |
2. unlock encrypted volume | |
3. grow LVM "physical volume" | |
4. grow LVM "logical volume" | |
5. check filesystem | |
6. grow filesystem | |
7. tidy up and test. | |
Steps on Debian: | |
[if qemu image, first on host system:] | |
qemu-img resize diskimage.qcow2 +50G | |
[then, within liveCD environment] | |
cfdisk /dev/sda - and grow the partition to fill the larger device | |
apt update && apt install -y lvm2 cryptsetup | |
modprobe dm-crypt | |
cryptsetup luksOpen /dev/sda3 aribtraryname | |
pvdisplay -m [note your device in the list - must be 'Allocatable: yes' - if not, see next line] | |
pvchange -x y /dev/mapper/arbitraryname | |
pvdisplay -m | |
pvresize /dev/mapper/arbitraryname | |
vgscan --mknodes | |
vgchange -ay | |
lvdisplay [note the names assigned to your volumes] | |
lvextend -l +100%FREE /dev/somethingelse/volumename | |
e2fsck -f /dev/somethingelse/volumename | |
resize2fs /dev/somethingelse/volumename | |
vgchange -an | |
cryptsetup luksClose arbitraryname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment