Easily increase storage size with LVM

June 5, 2013 — 3 Comments

Your server needs more space eh? Throw another physical drive in there and let’s use that to increase the logical volume that needs more space! In this example, we are going to use a Citrix XenServer VPS running CentOS. We are going to increase the logical volume from 250gb to 300gb.

First, add the new storage to the machine. We used XenCenter to add a ‘virtual disk’ to the VPS. This step for you might be adding a new physical drive to the hardware machine. Either way, this step is the one where we put the new/blank storage somewhere so our Linux machine can see it…

Next, let’s see if the system can see the new storage:

Note: you’ll also see information about your current drives..

This tells us that Linux sees the storage but there is no partition table on it yet. let’s create a partition on the drive using fdisk, parted, cfdisk, etc.. and toggle it to type ‘8e’ (Linux LVM)

Now it should show up a little better in the fdisk -l command.

Next, create the physical volume on the new partition on the new drive:

Now, find out the volume group and logical volume names on your system. Make note of these..

We’ll assume that the information is:
Volume Group: test_vg
Logical Volume: test_lv

Now, use vgextend to add your new drive to the existing volume group:

You can see, by viewing ‘vgdisplay’ again, it will show you the added space:

Now, pull it across into the logical volume:

You’re almost home free! Now, vgdisplay shows the correct info and so does lvdisplay – but a simple df -h still shows the filesystem size has not changed. Let’s tell the filesystem to stretch out across the full logical volume:

And to see how it worked out:

It worked!

Related posts from Linux Brigade!

  • Run fsck on a XenServer Virtual MachineRun fsck on a XenServer Virtual Machine You hope that you won’t ever need to, but you may one day need to run fsck on a Linux XenServer VM that won’t boot.. no worries, attach the storage from that VM on another VM and run it […]
  • Delete cPanel account error_log filesDelete cPanel account error_log files If you have a large number of accounts on your server, you may also be wasting a lot of space with the error_log files in each account. Some can get very large – and while you want to […]
  • Move MySQL tmp directoryMove MySQL tmp directory You’ll eventually run into a client who has a crashed table in their database – this table will be pretty large – maybe even larger than the system’s default temporary directory (usually […]
  • Install XenServer via usb flash driveInstall XenServer via usb flash drive USB Flash drives are getting cheaper and cheaper lately. I just picked up few at staples – 16GB flash drives for just under $8. I like to use them to install Linux – I always seem to […]
  • Patch your WHM/cPanel machine for heartbleedPatch your WHM/cPanel machine for heartbleed You’ve certainly heard about Heartbleed by now. If not, you can read more about this vulnerability at Heartbleed.com. Continue reading this post to find out if you’re vulnerable, and how […]

3 responses to Easily increase storage size with LVM

  1. Excellent article. Honestly, I didn’t know you could do this (to this extent) with LVM.

  2. Very helpful guide, thank you. I was just thinking about adding more space so I read this article at the perfect time.

Trackbacks and Pingbacks:

  1. Easily increase storage size with LVM | Webmaster Brigade - June 5, 2013

    [...] Your server needs more space eh? Throw another physical drive in there and let’s use that to increase the logical volume that needs more space! In this example, we are going to use a Citrix XenServer VPS running CentOS. We are going to increase the logical volume from 250gb to 300gb. This is a great article by our sister site ‘Linux Brigade’ which is a Linux Blog. You can find the post here: http://www.linuxbrigade.com/easily-increase-storage-size-with-lvm/ [...]

Leave a Reply