Extending a LVM Volume Group

By Zhiqiang Ma On Nov 27, 2012

We introduced how to create a LVM group with two hard disk partitions, which the LVM group can be used for installing LVM backed Xen DomUs. The LVM volume can have large capacity from several hard disks. However, we may use all the disk space after some time and we may need to extend the capacity. In this post, we introduce how to extend a LVM group with a new hard disk.

Assume we have created one LVM volume group vg_xen and we have plugged a new disk sdd to the server. Now we will extend the volume group with the new hard disk sdd.

Create a partition on the new hard disk

We can use fdisk to create a new partition:
# fdisk /dev/sdd
Add a new partition by command: n

Select primary partition by: p

Select partition number 1: 1

Then select from the first section to the last one.

Write table to disk and exit by command: w

We can find out the new partition in /dev/ directory:

$ ls /dev/sd*
We can find:
/dev/sdd1

Initialize the disk partition

Create a volume group descriptor at the starts of the partition and create a new physical volume:
# pvcreate /dev/sdd1

Add the new physical volume to the volume group

Now we can add the new physical volume to the volume group:
# vgextend vg_xen /dev/sdd1
The vg_xen LVM group’s capacity is extended. We can display the information of the volume group by
# vgdisplay
and the information of the logical volumes by
# lvdisplay
and the information of the physical volumes by
# pvdisplay

By: Zhiqiang Ma Last updated: Nov 27, 2012 Views: 361
Tags: , , , , , , ,

About Zhiqiang Ma

Zhiqiang Ma is a PhD candidate at Dep. of CSE, HKUST. He is interested in system software for cloud computing, virtualization of large-scale distributed system, etc. Find Zhiqiang on Facebook, Twitter, LinkedIn and Google+.

Add your comments, share your thoughts

Be nice. Keep it clean. Stay on topic. No spam.