Linux - KVM Guest LVM Disk Resize

[root@pbx01.mil1.wide-net.org ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 1779856 1553320 138068 92% / /dev/vda1 101086 40798 55069 43% /boot tmpfs 513060 0 513060 0% /dev/shm [root@pbx01.mil1.wide-net.org ~]# vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup00" using metadata type lvm2 [root@pbx01.mil1.wide-net.org ~]# fdisk /dev/vda vda vda1 vda2 [root@pbx01.mil1.wide-net.org ~]# fdisk /dev/vda Command (m for help): p Disk /dev/vda: 4219 MB, 4219469824 bytes 255 heads, 63 sectors/track, 512 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 382 2963992+ 8e Linux LVM Command (m for help): d Partition number (1-4): 2 Command (m for help): p Disk /dev/vda: 4219 MB, 4219469824 bytes 255 heads, 63 sectors/track, 512 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (14-512, default 14): Using default value 14 Last cylinder or +size or +sizeM or +sizeK (14-512, default 512): Using default value 512 Command (m for help): p Disk /dev/vda: 4219 MB, 4219469824 bytes 255 heads, 63 sectors/track, 512 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 512 4008217+ 83 Linux Command (m for help): t Partition number (1-4): 2 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: 4219 MB, 4219469824 bytes 255 heads, 63 sectors/track, 512 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 13 104391 83 Linux /dev/vda2 14 512 4008217+ 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. Syncing disks. [root@pbx01.mil1.wide-net.org ~]# reboot Broadcast message from root (pts/0) (Sat Sep 15 23:36:59 2012): The system is going down for reboot NOW! [root@pbx01.mil1.wide-net.org ~]# Connection to pbx01.mil1.wide-net.org closed by remote host. Connection to pbx01.mil1.wide-net.org closed. [leo@thinkleo3 ~]$ [root@pbx01.mil1.wide-net.org ~]# pvdisplay --- Physical volume --- PV Name /dev/vda2 VG Name VolGroup00 PV Size 2.83 GB / not usable 14.52 MB Allocatable yes PE Size (KByte) 32768 Total PE 90 Free PE 26 Allocated PE 64 PV UUID 3KFfOG-kfJZ-hNtT-0vo5-Lpzk-4iMR-rMmLzH [root@pbx01.mil1.wide-net.org ~]# pvresize /dev/vda2 Physical volume "/dev/vda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@pbx01.mil1.wide-net.org ~]# pvdisplay --- Physical volume --- PV Name /dev/vda2 VG Name VolGroup00 PV Size 3.82 GB / not usable 10.09 MB Allocatable yes PE Size (KByte) 32768 Total PE 122 Free PE 58 Allocated PE 64 PV UUID 3KFfOG-kfJZ-hNtT-0vo5-Lpzk-4iMR-rMmLzH [root@pbx01.mil1.wide-net.org ~]# lvdisplay --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID f134eo-A1TY-mj72-g16E-oBnl-fnNM-4hULDC LV Write Access read/write LV Status available # open 1 LV Size 1.75 GB Current LE 56 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0 --- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID 1gNpNl-ypNO-bj4a-Gsyb-eGnS-UcFh-Rbocfj LV Write Access read/write LV Status available # open 1 LV Size 256.00 MB Current LE 8 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:1 [root@pbx01.mil1.wide-net.org ~]# lvresize /dev/VolGroup00/LogVol00 -l +1 Extending logical volume LogVol00 to 3.59 GB Insufficient free space: 1 extents needed, but only 0 available [root@pbx01.mil1.wide-net.org ~]# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol00 to 933888 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol00 is now 933888 blocks long. [root@pbx01.mil1.wide-net.org ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 3.5G 1.5G 1.8G 46% / /dev/vda1 99M 40M 54M 43% /boot tmpfs 502M 0 502M 0% /dev/shm [root@pbx01.mil1.wide-net.org ~]# reboot Broadcast message from root (pts/0) (Sat Sep 15 23:43:32 2012): The system is going down for reboot NOW! [root@pbx01.mil1.wide-net.org ~]#`

26 November 2012 @ 03:18 · Updated: 30 June 2026 @ 03:28 · leo