LVM+DRBD+LVM+KVM+LVM Resize
info
PV -> VG -> LV -> DRBD -> VG (clvmd) -> LV -> KVM Virt (that also has pv/vg/lv)
resize LVM backing device
NODE1
<source> lvs /dev/vg_be_raid10/drbd_hopmon
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert drbd_hopmon vg_be_raid10 -wi-ao--- 9.20g
</source> <source> lvresize -L+2GB /dev/vg_be_raid10/drbd_hopmon
Extending logical volume drbd_hopmon to 11.20 GiB Logical volume drbd_hopmon successfully resized
</source>
NODE2
<source> lvs /dev/raid10/drbd_hopmon
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert drbd_hopmon raid10 -wi-ao--- 9.20g
</source> <source>
lvresize -L+2GB /dev/raid10/drbd_hopmon Extending logical volume drbd_hopmon to 11.20 GiB Logical volume drbd_hopmon successfully resized
</source>
Resize DRBD (online)
<source>
# drbdadm resize <resource> drbdadm resize hopmon
</source> <source>
#pvscan #PV /dev/drbd6 VG drbd_hopmon lvm2 [9.20 GiB / 0.20 GiB free] pvresize /dev/drbd6
</source>
Resize the LVM partition on DRBD
- this is a clusters volume group - changes will propagate on both
<source> lvresize -L+2GB /dev/drbd_hopmon/hopmon
Extending logical volume hopmon to 10.00 GiB Logical volume hopmon successfully resized
</source>
Shutdown/Start KVM Host
- shutdown the guest, then start the guest (not a reboot)
- this will allow the KVM guest to notice the PV size change
Resize GUEST lvm disk
<source> pvs
PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 7.51g 36.00m
</source> <source> fdisk -u -l /dev/vda
Disk /dev/vda: 10.7 GB, 10737418240 bytes 16 heads, 63 sectors/track, 20805 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d51fa
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 1026048 16777215 7875584 8e Linux LVM </source>
- notice the start boundary 1026048
- You will use this after you delete the parition in the next step
<source> fdisk -u /dev/vda
Command (m for help): d Partition number (1-4): 2
Command (m for help): n Command action
e extended p primary partition (1-4)
p Partition number (1-4): 2
- This is where you enter in your start boundary from before
First sector (63-20971519, default 63): 1026048
Last sector, +sectors or +size{K,M,G} (1026048-20971519, default 20971519): Using default value 20971519 Command (m for help): t Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/vda: 10.7 GB, 10737418240 bytes 16 heads, 63 sectors/track, 20805 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d51fa
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 1026048 20971519 9972736 8e Linux LVM
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. </source>
- You may have to reboot to allow the partition size to be apply. You can reboot this time.
<source> pvs
PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 7.51g 36.00m
</source> <source> pvresize /dev/vda2
Physical volume "/dev/vda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized
</source> <source> pvs
PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 9.51g 2.04g
</source>
- Now can extend the LV
<source> lvscan
ACTIVE '/dev/vg_hopmon/lv_root' [5.47 GiB] inherit ACTIVE '/dev/vg_hopmon/lv_swap' [2.00 GiB] inherit
</source> <source> lvresize -L+2GB /dev/vg_hopmon/lv_root
Extending logical volume lv_root to 7.47 GiB Logical volume lv_root successfully resized
</source> <source> lvscan
ACTIVE '/dev/vg_hopmon/lv_root' [7.47 GiB] inherit ACTIVE '/dev/vg_hopmon/lv_swap' [2.00 GiB] inherit
</source>
- Resize the filesystem
<source> df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_hopmon-lv_root
5.4G 4.8G 422M 92% /
</source> <source> resize2fs /dev/mapper/vg_hopmon-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg_hopmon-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/mapper/vg_hopmon-lv_root to 1958912 (4k) blocks. The filesystem on /dev/mapper/vg_hopmon-lv_root is now 1958912 blocks long. </source> <source>
df -h /
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_hopmon-lv_root
7.4G 4.8G 2.3G 68% /
</source>