miércoles, 10 de febrero de 2010

Add New Partition to a Volume Group

How to add a new partition with LVM.

First you have to initialize the physical volume for use by LVM with the following command:

# pvcreate /dev/sda1

A message will appear indicating you that the physical volume was succesfully initialized. In case you have trouble doing this and get a message like:

Couldn't find device with uuid '1rP8Ah-Dmzw-UdoD-ENyx-MMVz-lhG9-PMc0DP'

All you have to do is remove the missing physical volumes like this:

# vgreduce --removemissing "VolGroup_Name"

This will do the trick.

Now we add the physical volume to the already existing volume group:

# vgextend "VolGroup_Name" /dev/sda1

Now the physical volume was added to the volume group and you can resize it according to your needs with something like this:

# lvextend --size +4G "LogicalVolumePath"

Hope this works for you.