linuxwebcluster.com

Growing a Logical Volume

I'm working in the same virtual machine as my last post, but now I'm out of space. My laptop is pretty full and when I get into virtualizing server farms, I usually have to create servers with small drives. Here's the easy way to add a disk to an LVM volume group and quickly handle your unfortunate situation... 

Assuming that you have a default installation of Centos / RHEL / Fedora that uses LVM2, this should work fine. First create the drive in VMWare (or add the physical disk, if doing this on a real machine). You should be able to see it in the output from 'fdisk -l', which in my case, tells me the system sees my new disk as /dev/sdb. 

1. Run fdisk and create a single partition, using the whole disk:   fdisk /dev/sdb
2. Create the physical volume:  pvcreate /dev/sdb1
3. Run vgscan to get the exact name of the volume group you want to grow. Here, it's "VolGroup00"
4. Add the new physical volume to your volume group:  vgextend VolGroup00 /dev/sdb1
5. Run lvscan to get the exact name of the logical volume you want to grow. By default: /dev/VolGroup00/LogVol00
6. Grow it to 100% of new capacity  :  lvextend -l +100%FREE /dev/VolGroup00/LogVol00
7. Resize the filesystem. If using the default ext3 filsystem, then simply: resize2fs /dev/VolGroup00/LogVol00

After a quick online resize operation, your shiny new space will be waiting! 

 

Add your comment

Your name:
Subject:
Comment:

Subscribe to the Linux Admins Blog and get new posts delivered by email!
Enter your email address:

Delivered by FeedBurner

Linux News


Tell the developers:

The type of clustering you are most likely to deploy is:
 
What Linux distro do you use for clusters?
 

Copyright 2010    RapidScale Clusters, LLC