Skip to main content

Unallocated Disk Space (Root Dedicated Server)

We usually install new Root Servers with a portion of the storage capacity unallocated. This allows customers to add the free hard disk space using LVM where they need it.

Allocate Free Disk Space to a Partition

To allocate the disk space, first determine how much space is still unassigned. You can get this information by using the pvs or vgdisplay tools:

root@server:~# vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
Act PV 1
VG Size 931.15 GiB
PE Size 4.00 MiB
Total PE 238374
Alloc PE / Size 195614 / 764.12 GiB
Free PE / Size 42760 / 167.03 GiB
VG UUID mc0LwE-Vx8J-OoWK-qMOb-ZuNR-vpJL-3irxC5

Once the free space is known, extend the desired partition using lvextend. Specify the partition to extend (e.g. /dev/vg0/home) and the amount to add (e.g. -L +10G for 10 GB):

root@server:~# lvextend /dev/vg0/home -L +10G
Extending logical volume home to 678.12 GiB
Logical volume home successfully resized

Finally, resize the filesystem using resize2fs:

root@server:~# resize2fs /dev/vg0/home
resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/vg0/home to 5242880 (4k) blocks.
The filesystem on /dev/vg0/home is now 5242880 blocks long.

Alternatively, you can combine both steps using lvextend --resizefs:

root@server:~# lvextend -L +10G /dev/vg0/home --resizefs

The newly allocated disk space is now available. This procedure can be performed on a running system.

See also Resize a Partition After a Disk Upgrade for CloudVM-specific instructions.