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!

  • Block Countries from your server easily with CSFBlock Countries from your server easily with CSF If you don’t have a need for certain international visitors to your Linux server, its easy to block them out!  First, you’ll need to make sure that CSF is installed.  You can follow our […]
  • 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 […]

  • Search previous commands typedSearch previous commands typed If you want to see a collection of your previous commands used in Linux, you can always type ‘history’ for a listing of them. You can even search through history by grepping for the […]
  • Send mail via the command lineSend mail via the command line During your stint as a Linux administrator, you’ll likely want to send mail from the server you are working on. Whether its sending a quick test message or emailing yourself a file, it can […]
  • Warning: Skipping the data of table mysql.event.Warning: Skipping the data of table mysql.event. Your MySQL script was running great, but then you started getting errors – If you get this warning when dumping the mysql database, it’s not a bug – MySQL did this on purpose because they […]

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 to ohyesuare Cancel 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=""> 

*