In my previous article,
Supporting Dynamic root-disk in LVM-enabled Templates, I discussed the challenges around supporting LVM-enabled VM-templates in cloud-based deployments of Enterprise Linux 6 VMs. The kernel used for Enterprise Linux 7 distributions makes template-based deployment of LVM-enabled VMs a bit easier. Instead of having to add an RPM from EPEL and then hack that RPM to make it support LVM2-encapsulated root volumes/filesystems, one need only ensure that the
cloud-utils-growpart RPM is installed and do same launch-time massaging via
cloud-init. By way of example:
#cloud-config
runcmd:
- /usr/bin/growpart /dev/xvda 2
- pvresize /dev/xvda2
- lvresize -r -L +2G VolGroup00/logVol
- lvresize -r -L +2G VolGroup00/auditVol
Will cause the launched instance to:
- Grow the second partition on the boot disk to the end of the disk
- Instruct LVM to resize the PV to match the new partition-size
- Instruct LVM to grow the VolGroup00/logVol volume — and the filesystem on top of it — by 2GiB
- Instruct LVM to grow the VolGroup00/auditVol volume — and the filesystem on top of it — by 2GiB
Upon login, the above launch-time configuration-actions can be verified by using `
vgdisplay -s` and `
lvs --segments -o +devices`:
# vgdisplay -s
"VolGroup00" 29.53 GiB [23.53 GiB used / 6.00 GiB free]
# lvs --segments -o +devices
LV VG Attr #Str Type SSize Devices
auditVol VolGroup00 -wi-ao---- 1 linear 8.53g /dev/xvda2(2816)
auditVol VolGroup00 -wi-ao---- 1 linear 2.00g /dev/xvda2(5512)
homeVol VolGroup00 -wi-ao---- 1 linear 1.00g /dev/xvda2(1536)
logVol VolGroup00 -wi-ao---- 1 linear 2.00g /dev/xvda2(2304)
logVol VolGroup00 -wi-ao---- 1 linear 2.00g /dev/xvda2(5000)
rootVol VolGroup00 -wi-ao---- 1 linear 4.00g /dev/xvda2(0)
swapVol VolGroup00 -wi-ao---- 1 linear 2.00g /dev/xvda2(1024)
varVol VolGroup00 -wi-ao---- 1 linear 2.00g /dev/xvda2(1792)
No comments:
Post a Comment