Easily increase storage size with LVM

Rob —  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!

  • 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 […]
  • Block account from sending mail WHM/cPanelBlock account from sending mail WHM/cPanel There may come a time when you’d like to block an account / domain on your WHM/cPanel server from being able to send mail. Here’s how you’d get it done!

    We’re going to set up a […]

  • Learn the CSF command line options You have CSF installed and use the GUI to do most things.  (If you don’t have it installed yet, you can read our article on how to install csf).  BUT – knowing the csf (ConfigServer […]
  • 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

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url=""> 

*