Enlarging an Existing Volume on Your Server

In this article, we will show you how to increase the size an existing volume on your server.

This allows you to modify your partitioning to how you would like.

Please note: This article describes significant changes to the file system of your server. Before increasing the size of the existing volume, perform a data backup to avoid data loss.

Step 1

To check the size of the logical volume and its free capacity, enter the following command:

vgdisplay -v vg00


The free capacity is displayed in the Free PE/Size line.

Step 2

You can enlarge the volume using the lvextend command. To use all available disk space to increase the volume, enter the lvextend command in the format lvextend -l +100%FREE /dev/VOLUMEGROUP/LOGICALVOLUME

Example:

[root@9794c2d ~]# lvextend -l +100%FREE /dev/vg00/home
Size of logical volume vg00/home changed from 10.00 GiB (2560 extents) to 399.19 GiB (102192 extents).
Logical volume home successfully resized.

To increase a logical volume by 10 GB, type the lvextend command in the following format:

lvextend -l +10G /dev/VOLUMEGROUP/LOGICALVOLUME

In the example below, a logical volume is expanded from 4 GB to 14 GB:

root@localhost ~]# lvextend -l +10G /dev/vg00/var

After entering the command, the following message is displayed:

Extending logical volume var to 14.00 GB
Logical volume var successfully resized
Step 3

To display the file systems of the partitions, enter the command blkid.

blkid

Please note: The file system appears at the end of the line after the TYPE= entry.

Example:

/dev/md1: LABEL="root" UUID="1aff71de-fa12-44c2-8d2d-cd51cb0eb19b" TYPE="ext3"
Step 4

To be able to use the additional storage space, you must enlarge the file system. The table below lists examples for the different file systems.

File system Example Special feature
Ext 2,3,4 resize2fs /dev/vg00/var  
ReiserFS resize_reiserfs -f /dev/vg00/var  
JFS mount -o remount,resize /var Since kernel 2.6 the new volume size is given in blocks (for this example the command is: mount -o remount, resize=1048576 /var ).
XFS xfs_growfs /var  
Step 5

Finally, you can immediately check the change with the df command:

To check the changes to the logical volume, type the following command:

df -h /var/