For Dedicated Servers, Server Power Deals and Value Dedicated Servers managed in the server administration of the IONOS account

In this article, we'll show you how to customize the Logical Volume on a Dedicated Server.

The Logical Volume Manager (LVM) is used to manage the storage space on Linux dedicated servers that were purchased either as part of a server deal or before October 20, 2021. If you create or have created one of these dedicated servers with an IONOS image, the entire storage space of the hard disk(s) is not partitioned when this server is made available for you to use, which allows you to distribute the storage space individually.

Please Note

When you install an IONOS image with Plesk on the server, approximately 90% of the available disk space is partitioned.

Please Note

This article describes deep changes to your server's file system. Before increasing the size of the existing volume, perform a backup to avoid data loss.

To manually adjust the size of the logical volume, follow the steps below:

Requirements

You have logged on to the server as an administrator.

Preparation

  • To check the available space of the logical volume, enter the following command:

    [root@localhost ~]# df -h
    Filesystem             Size  Used Avail Use% Mounted on
    devtmpfs                32G     0   32G   0% /dev
    tmpfs                   32G     0   32G   0% /dev/shm
    tmpfs                   32G  193M   32G   1% /run
    tmpfs                   32G     0   32G   0% /sys/fs/cgroup
    /dev/sda2               28G  168M   28G   1% /
    /dev/mapper/vg00-usr   9.8G  2.1G  7.2G  23% /usr
    none                    32G  4.0K   32G   1% /tmp
    /dev/mapper/vg00-home  9.8G   37M  9.3G   1% /home
    /dev/mapper/vg00-var   9.8G  362M  9.0G   4% /var
    tmpfs                  6.3G     0  6.3G   0% /run/user/0

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

    [root@localhost ~]# vgdisplay -v NAME_DER_VOLUMEGROUP

    Example:

    [root@localhost ~]# vgdisplay -v vg00

  • To determine the filesystem, enter the following command:

    [root@localhost ~]# df -Th | grep "^/dev"

  • Make a note of the file system.

Manually Increasing the Logical Volume

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

[root@localhost ~]# lvextend -L +10G /dev/VOLUMEGROUP/LOGICALVOLUME

To use all available space to increase the size of the desired Logical Volume, enter the lvextend command in the following format:

[root@localhost ~]# lvextend -l +100%FREE [PATH OF LOGICAL VOLUME].

The following example uses all of the disk space to increase the size of the vg00/var logical volume:

[root@localhost ~]# lvextend -l +100%FREE /dev/vg00/var
Size of logical volume vg00/var changed from 10.00 GiB (2560 extents) to 1.76 TiB (462142 extents).
Logical volume vg00/var successfully resized.

Enlarging the File System

To use the additional space, you must increase the size of the file system. The table below lists corresponding examples for the different file systems and the commands used to increase the size of each file system:

Filesystem Command Example Note
Ext 2,3,4 resize2fs [PATH OF LOGICAL VOLUMES] resize2fs /dev/vg00/var To fit an ext3 filesystem, it must not be mounted or corrupted.
XFS xfs_growfs [PATH OF MOUNT POINTS] xfs_growfs /var  
ReiserFS resize_reiserfs -f [PATH OF LOGICAL VOLUMES] resize_reiserfs -f /dev/vg00/var To fit a ReiserFS filesystem, it must not be mounted or corrupt.

After entering the appropriate command, you will see that the file system has been enlarged. Example:

[root@localhost ~]# resize2fs /dev/vg00/var
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vg00/var is mounted on /var; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 226
The filesystem on /dev/vg00/var is now 473233408 blocks long.

To verify that the filesystem has been adjusted, issue the following command:

[root@localhost ~]# df -h