Monitoring, Management & Location Tracking

Resize the CentOS LVM inside VM from a secondary virtual hard disk
Requirement:

Airwave installed on a VM, with a secondary virtual hard disk.

we have a KB "Resizing the centOS LVM inside VM", is only useful if we have one hard disk for that VM instance.

https://arubanetworkskb.secure.force.com/pkb/articles/FAQ/Resizing-CentOS-LVM-inside-VM

However,  This KB will be helpful in the scenario's where VM Administrators has to create a secondary virtual Hard disk, instead of increasing the disk space for current hard disk (could be for any reason for example: he cannot increase the disk space for the same disk as the pool that provides space to that disk has no space etc..).



Solution:

In this case, when we have added a secondary virtual hard disk, when we do # fdisk -l, we will see the secondary disk as /dev/sdb  as shown below:

[root@localhost mercury]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000650f3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13        5222    41839616   8e  Linux LVM

Disk /dev/sdb: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup00-LogVol01: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup00-LogVol00: 38.5 GB, 38520487936 bytes
255 heads, 63 sectors/track, 4683 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

And this is the # df -h, command output, before the LVM extension:

[root@localhost mercury]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       36G   11G   23G  32% /

tmpfs                 3.7G     0  3.7G   0% /dev/shm

/dev/sda1              97M   37M   56M  40% /boot

We need to extend the sdb disk space to VG group to combine to use the disk space as shown below in the configuration:

 

 

 

 



Configuration:

 

1. First, we need to create a partition in /dev/sdb

[root@localhost mercury]# fdisk /dev/sdb
# n {new partition}
# p {primary partition}
# 1 {select partition number, by default 3 is the next available}
# use the default cylinder values for First and last
# t {select partition id we just made (1)}
# 8e {Linux LVM partition}
# p {print. the new device should be described as Linux LVM}
# w {write to memory}

2. We need pv reate /dev/sdb1:

[root@localhost mercury]# pvcreate /dev/sdb1

3. Execute the command to extend the VG to sdb1:

[root@localhost mercury]# vgextend VolGroup00 /dev/sdb1

4. Enter the command to extend the LV to sdb1:

[root@localhost mercury]# lvextend /dev/VolGroup00/LogVol00 /dev/sdb1

5. Resize the VG:

[root@localhost mercury]# resize2fs /dev/VolGroup00/LogVol00

Done.

 

 

 

 



Verification

Now look at the # df -h, output, which will be different:

[root@localhost mercury]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       52G   11G   38G  22% /

tmpfs                 3.7G     0  3.7G   0% /dev/shm

/dev/sda1              97M   37M   56M  40% /boot

 

 

Version History
Revision #:
2 of 2
Last update:
‎08-04-2015 06:09 PM
Updated by:
 
Labels (1)
Contributors
Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.