Increase LVM Volume

I had the occasion to need some extra filespace on the LVM’d root partition of a RHEL(or CentOS) vm. This is how to do it:

First off, VMWare allowed me to create a second HDD on the fly while the vm was running (YAY!)

Once that was done, I rooted into the server and:

# echo “- – -” > /sys/class/scsi_host/host#/scan
(partprobe should also do the trick ??)

# fdisk -l
(Just to see that the new disk is available – in this case /dev/sdb)

# fdisk /dev/sdb
(create a new partition here)

# mkfs.ext3 /dev/sdb1

# vgs
(list the volume groups here)

# pvcreate /dev/sdb1
(add new physical volume)

# vgextend VolGroup00 /dev/sdb1
(extend my default volume group from the vgs command)

# vgs
(check to see pv and vg has another volume now)

# lvextend /dev/VolGroup00/LogVol00 /dev/sdb1
(extend my / volume by the entire size of /dev/sdb1)

# resize2fs /dev/VolGroup00/LogVol00
(resize filesystem to match vol size increase)
(requires a 2.6 kernel to resize while fs running)

That was it! And remember that all this was done on the fly, on the root partition and filesystem, WHILE the vm was running.

Be Sociable, Share!

One Response to “Increase LVM Volume”

  1. Lâmôlabs » Delicious Bookmarks for September 9th from 01:47 to 02:05 Says:

    […] LincolnBlogs » Blog Archive » Increase LVM Volume – September 9th ( tags: vm vmware lvm raid resize sysadmin storage tips tricks example ) […]

Leave a Reply

You must be logged in to post a comment.