Skip to content

Extending LVM partition online

December 19, 2009

Today i was working on a VirtualBox VM installed with CentOS-5.4 with the default 8GB disk image, i was going to compile a linux-2.6.32 vanilla kernel when i found that there’s only 3GB free space, so i’ve to extend the root part. which is LVM, and to be fair i did this about 3 or 4 times before ( extending LVM parts ) – but i can’t remember the detailed process steps, so i added a new 10GB Virtual Disk to the VM and started looking for LVM commands as follows:

using fdisk i created a new LVM ( 8e ) primary part on sdb so i’ve now /dev/sdb1 as LVM
using pvcreate i initialized sdb1
using vgextend i added sdb1 to VolGroup00
using lvextend i extended the LogVol00 to include /dev/sdb1 with the current part.
finally i ran resize2fs on /dev/mapper/VolGroup00-LogVol00 to resize the ext3 file system online.

pvcreate /dev/sdb1              #to initialize (create) the physical volume
vgextend VolGroup00 /dev/sdb1   #to add the partition to the Volume Group
lvextend /dev/VolGroup00/LogVol00 /dev/sdb1 #to append sdb1 part to the logical volume
resize2fs /dev/mapper/VolGroup00-LogVol00 #to resize the ext3 file system

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: