Saturday, May 21, 2016

[Tutorial] How to resize (bigger) an LVM volume with encryption used as disk by a VM

Case:
Xen Host with Volume Group
1 Volume is used as xvdb by a VM and now you want to resize (bigger) the encrypted volume. This example is for ext2/3/4.
You can do this with running VM.
 xvdb                         202:16  0 550G 0 disk     
 --luks-1d3d064f-7e4e-4653-99c1-0ef41f213819 (dm-0) 253:0  0 550G 0 crypt   

On host:
#extending to 200G in total, use + to add, see man
lvextend -L200G /dev/VGStorage/examplevolume

On VM:
#umount first if not done yet
cryptsetup resize $mappeddevicename
e2fsck -f /dev/mapper/$mappeddevicename
resize2fs /dev/mapper/$mappeddevicename

$mappeddevicename is your mapped device name, which can be something like "secure" or if generated "luks-92342-..."

No comments:

Post a Comment