1and1 Help Centre Categories

print article

Increase the Logical Volume

For 1&1 Dedicated Server Linux and 1&1 Dynamic Cloud Server Linux

Follow the steps below to increase the size of the logical volume and allocate additional space on one of your partitions.

Logical Volume Management using the xfs file system, allowing greater flexibility with disk management. The minimal install of CentOS provided by 1&1 utilises LVM for /usr, rather than a standard partition. Logical Volumes have been created for /usr and /var at a minimal size (under 5GB each) for the CentOS image provided.
While shrinking a logical volume is not supported, these steps will show you how to increase it.

Step 2
Type df -h at the command prompt and hit ENTER. The partition and logical volume sizes will be listed including the used disk space. In the image below, the var logical volume is 4GB. Assume that about 9GB of web content will be uploaded to the /var folder. The disk space needs to be increased before there is enough space to upload the content. Type 'df -h' and press Enter
Type 'df -h' and press Enter
Step 3
Type fdisk -l to view the total hard disk size and partitions on the disk. It can also be noticed here that the physical partition /dev/sda3 is using Linux LVM. Type 'fdisk -l' and press Enter
Type 'fdisk -l' and press Enter
Step 4
Type the pvs command and press Enter.
Please note:
In 1&1 Dynamic Cloud Servers, the PSize value listed will often be smaller than the value listed by the fdisk command output.
Type 'pvs' and press Enter
Type 'pvs' and press Enter
Step 5
This example requires roughly 9GB of data to be uploaded to the /var folder. Since the logical volume assigned to /var is only 4GB, we will increase this to 10GB using the lvextend command. The format for the lvextend command is:
lvextend -L +6G /dev/mapper/vg00-var Type 'lvextend -L +6G /dev/mapper/vg00-var' and press Enter
Type 'lvextend -L +6G /dev/mapper/vg00-var' and press Enter
Step 6
Type df -h to display the disk free space space. The lvextend operation finished successfully in the last step, but the /dev/mapper/vg00-var size only shows 4.0 G. This is because, while the logical volume was increased successfully, the file system needs to be extended. Type 'df -h' and press Enter
Type 'df -h' and press Enter
Step 7
Type lvs to show the logical volume information once again. The logical volume has successfully been extended to 10 gigabytes. Type 'lvs' and press Enter
Type 'lvs' and press Enter
Step 8
Type mount and press ENTER to display the mounted file systems. From the output, we find that the /dev/mapper/vg00-var logical volume is using xfs (with the introduction of CentOS 6, the default filesystem is ext4). Type 'mount' and press Enter
Type 'mount' and press Enter
Step 9
To increase the file system to match that of the logical volume, use the xfs_growfs command if the filesystem uses xfs or resize2fs if the filesystem is ext4.

Typing xfs_growfs /var or resize2fs /dev/mapper/vg00-var (depending on which filesystem is used on your system) will extend the file system to the 10 gigabyte limit of the logical volume.
Please note:
Some older operating systems will need to use the resize4fs command if the resize2fs command does not work.
Type the appropriate command and press Enter
Type the appropriate command and press Enter
Step 10
Type df -h to display the disk free space to confirm that the file system has been extended. Type 'df -h' and press Enter
Type 'df -h' and press Enter