How to Increase an Ubuntu Logical Volume?
Beware this content is over 4 years old and considered stale. It may no longer be accurate and/or reflect the understanding of the author but remains here for reference only. Please keep this in mind as you use this content.
I’ve been using 1&1 Linux Dynamic Cloud Server for some time now and realised that one particular site had utilised almost all of it’s available space in
/var. I had already extended the space by 10 GB using the fairly helpful information contained / hidden in the 1&1 FAQs on their website but needed to expand it yet again and thought I could condense the instructions for my own future reference.
While the 1&1 Linux packages come with CentOS as standard, I always reformat to use Ubuntu because it’s so much easier to troubleshoot and install all the modules I need.
That is why these instructions are geared toward Ubuntu, for CentOS, checkout the link above to the FAQ.
OK, lets get started. I’ll assumed you’ve already got access to the server by the command line via SSH and you are already logged in as root or have sudo capabilities.
First display the disk free space and sizes.
View the total hard disk size and partitions on the disk.
You’ll be using the one with the
Linux LVM system type.
View information on the physical volume, using the physical volume show command. As I understand it, that should tell you have much available space you have to play with in total. In my case, the 1&1 Linux Dynamic Cloud Server was original configured and bought with 400 GB hard disk space.
Use the logical volume extend command to increase the size of a logical volume
by specifying the size in GB and the volume path. Here I am extending my
/var which is mapped via
/dev/mapper/vg00-var by 100 GB.
The output should mention the new total size of your logical volume but now you’ll need to tell the filesystem to utilise the extra space you’ve added.
You can initially, confirm the logical volume has been “extended” but the filesystem needs to be informed too.
You’ll need to know what the filesystem type is of the logical volume, using the next command.
Towards the bottom you find the entry for
/dev/mapper/vg00-var which is the one we’re dealing with and the type is
In the FAQ it examples that to increase the filesystem you’ll need to use the right command that matches the type so you’ll use either:
xfs_growfs if the filesystem uses
resize2fs if the filesystem is
As our logical volume is
ext4 we’ll use this command:
You can now confirm that everything has been updated from the changes you’ve made by checking the disk free space again.
That should be it. Drop a comment if you get stuck.