Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our QA department found a moderate issue this morning. It appears out server build automation software didn't quite work properly with the partitioning info we gave it, and failed back to an antiquated standard build (8GB /, 10GB /var, 8GB /opt, and 4gb swap). The disk is a 300GB raid 10, which should be fully utiized. So, I am trying to scale everything out in a sane way. Extending swap was easy, and it was extended to 24GB. I want to extend /var to 20GB, and /opt to 10GB (no additional software is being installed, these are logging servers). Then / must be extended to use the remaining disk space.

So, the heart of my question - is this something that can be done online? Or do I have to log into ash and do it from there? I know that ext3 (supposedly) supports hot online resizing, but I don't know about lvm2. Any advice would be appreciated. Thanks!

Edit: I will have OOB access to these servers shortly, I was just hoping not to have to have our already overworked QA department run a bunch of cabling to get it for me if I don't have to.

share|improve this question
up vote 4 down vote accepted

Unless the disk partitions are divided by LVM... LVM won't care. (i.e. is the volume 1 big 300gb LVM? or are there 4 LVM volumes?) If there's only 1 big LVM volume... re sizing will be cake. If not... your disk is going to be scattered all over the place. You can dynamically increase the size of LVM volumes by adding more to it... and then resize the file-system on top of it... but then your disk will be rather fragmented...


your disk will look like this:

vol1(8gb), vol2(10gb), vol3(8gb),vol4(4gb), vol1(50gb), vol2(100gb) etc...

share|improve this answer
As of right now it is one Volume Group, total size of 300GB, with 4 lvm disks inside (lv_root, lv_swap, lv_opt, and lv_var). I have resized swap since that was easy, the rest will need to be resized as well. The fragmentation shouldn't be an issue - the data for the device is stored on an external SAN. I just need to know if it can be done online or not :) – Matthew Dec 14 '11 at 18:38
then you have a simple task of "lvextend" and then "resize2fs" – TheCompWiz Dec 14 '11 at 18:44
Yup :) But can it be done online or not? – Matthew Dec 14 '11 at 18:47
Sure to both. Just remember to have a backup. Life is full of OMGWTFBBQ! – TheCompWiz Dec 14 '11 at 18:50

Say we want to extend /opt with 5G:

lvextend -L +5G /dev/vgname/lv_opt

Or if we want it to be extended to exactly 10G no matter what the current size is:

lvextend -L 10G /dev/vgname/lv_opt

Since ext3 supports online resizing, you want to do this afterwards, to resize the volume online:

resize2fs /dev/vgname/lv_opt

I have done this a tonne of times, and I have never experienced it failing. It does, however, take a long while if you are extending e.g. a 4 TB volume to 5 TB.

Should you (or anyone else reading this) be using XFS:

xfs_growfs /opt

Note: with XFS the partition must be mounted and to grow it, point towards the mount point rather than the raw partition.

share|improve this answer
Great, thank you! – Matthew Dec 14 '11 at 19:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.