Difference between revisions of "LVM+DRBD+LVM+KVM+LVM Resize"
From RARFORGE
(→info) |
(→Resize GUEST lvm disk) |
||
(One intermediate revision by one user not shown) | |||
Line 27: | Line 27: | ||
Logical volume drbd_hopmon successfully resized | Logical volume drbd_hopmon successfully resized | ||
</source> | </source> | ||
+ | |||
+ | |||
== Resize DRBD (online) == | == Resize DRBD (online) == | ||
Line 125: | Line 127: | ||
</source> | </source> | ||
− | * You may have to reboot to allow the partition size to be apply. You can '''reboot''' this time. | + | |
+ | * You can try to run 'partprobe' to re-read the disk partitions.. but it may not work | ||
+ | * If partprobe fails you will have to reboot to allow the partition size to be apply. You can '''reboot''' this time. | ||
<source> | <source> |
Latest revision as of 16:23, 26 July 2013
Contents |
[edit] info
PV -> VG -> LV -> DRBD -> VG (clvmd) -> LV -> KVM Virt (that also has pv/vg/lv)
[edit] resize LVM backing device
[edit] NODE1
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
lvresize -L+2GB /dev/vg_be_raid10/drbd_hopmon Extending logical volume drbd_hopmon to 11.20 GiB Logical volume drbd_hopmon successfully resized
[edit] NODE2
lvs /dev/raid10/drbd_hopmon LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert drbd_hopmon raid10 -wi-ao--- 9.20g
lvresize -L+2GB /dev/raid10/drbd_hopmon Extending logical volume drbd_hopmon to 11.20 GiB Logical volume drbd_hopmon successfully resized
[edit] Resize DRBD (online)
# drbdadm resize <resource>
drbdadm resize hopmon
#pvscan #PV /dev/drbd6 VG drbd_hopmon lvm2 [9.20 GiB / 0.20 GiB free] pvresize /dev/drbd6
[edit] Resize the LVM partition on DRBD
- this is a clusters volume group - changes will propagate on both
lvresize -L+2GB /dev/drbd_hopmon/hopmon Extending logical volume hopmon to 10.00 GiB Logical volume hopmon successfully resized
[edit] 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
[edit] Resize GUEST lvm disk
pvs PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 7.51g 36.00m
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
- notice the start boundary 1026048
- You will use this after you delete the parition in the next step
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.
- You can try to run 'partprobe' to re-read the disk partitions.. but it may not work
- If partprobe fails you will have to reboot to allow the partition size to be apply. You can reboot this time.
pvs PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 7.51g 36.00m
pvresize /dev/vda2 Physical volume "/dev/vda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized
pvs PV VG Fmt Attr PSize PFree /dev/vda2 vg_hopmon lvm2 a-- 9.51g 2.04g
- Now can extend the LV
lvscan ACTIVE '/dev/vg_hopmon/lv_root' [5.47 GiB] inherit ACTIVE '/dev/vg_hopmon/lv_swap' [2.00 GiB] inherit
lvresize -L+2GB /dev/vg_hopmon/lv_root Extending logical volume lv_root to 7.47 GiB Logical volume lv_root successfully resized
lvscan ACTIVE '/dev/vg_hopmon/lv_root' [7.47 GiB] inherit ACTIVE '/dev/vg_hopmon/lv_swap' [2.00 GiB] inherit
- Resize the filesystem
df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_hopmon-lv_root 5.4G 4.8G 422M 92% /
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.
df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_hopmon-lv_root 7.4G 4.8G 2.3G 68% /