Monday, February 8, 2010

How to add new hard drive to existing LVM volume

Sometimes your server running out of space, but if your server configured using LVM Volume, it will not be a problem anymore. Plug your new hard drive and let's configure

1. Creat an LVM partition
[root@oracledev ~]# fdisk /dev/sda
press n for creating new partition
press t for partition type and choose 8e for LVM
press w to write any changes


2. Create LVM physical volume
[root@oracledev ~]# lvm
lvm> pvcreate /dev/sda1
Physical volume "/dev/sda1" successfully created

3. Extend physical volume to existing logical volume group
lvm> vgextend VolGroup00 /dev/sda1
Volume group "VolGroup00" successfully extended

4. Extend the volume to 100%
lvm> lvextend -l +100%FREE /dev/VolGroup00/LogVol02
Extending logical volume LogVol02 to 323.47 GB
Logical volume LogVol02 successfully resized

5. Resize the partition size, but unmount it firstly
[root@oracledev ~]# resize2fs /dev/VolGroup00/LogVol02

reff:http://www.redhat.com/docs/manuals/csgfs/browse/4.6/Cluster_Logical_Volume_Manager/

No comments: