Increasing the size of an additional disk

View as Markdown

Find out how to increase the size of an additional volume and enlarge its main partition

Objective

If you have reached the maximum capacity on your additional disk, you can add more storage by increasing its size.

This guide explains how to increase the size of an additional disk and extend the main partition accordingly.

Requirements


OVHcloud Control Panel Access

  • Direct link:
  • Navigation path: Public Cloud > Select your project

Instructions

These steps assume you have already configured an additional disk as described in Creating and configuring an additional disk on an instance.

Monitoring disk usage before resizing

Warning

We recommend that you always maintain 20% free space on your storage volumes. This ensures optimum performance and avoids the risk of system degradation or failure when the volume reaches its maximum capacity.

To resize your disk at the right time, monitor disk usage regularly. Below are quick tutorials for both Windows and Linux to help you track disk space and anticipate when an upgrade is needed.

On Windows
On Linux
Using Command Prompt

Open Command Prompt (Win + R → cmd → Enter).

Run the following command:

wmic logicaldisk get name, size, freespace

This will display the free space and total size of each disk.

Using PowerShell

Open PowerShell as Administrator.

Run the following command:

Get-PSDrive | Where-Object {$_.Free -ne $null} | Select-Object Name, Used, Free

This will show the used and available disk space.

Warning

Before resizing, we recommend creating a snapshot of your volume to protect your data. If something goes wrong during the resize or partition extension, you can restore from the snapshot. See Creating a volume snapshot for instructions.

Modifying the size of the disk

In your Public Cloud project, click on Block Storage in the left-hand menu under Storage & backup.

If the volume is attached to a Windows instance, click on ... in the row of the volume and select Detach from instance.

Click on ... in the row of the volume and select Edit.

control panel
Warning

Volume resizing is irreversible. You can only increase the size of a volume, never decrease it. Make sure the new size is correct before confirming.

In the popup window, enter the new size for the volume and click on Modify the volume.

control panel

Extending the partition (Linux instance)

Establish an SSH connection to your instance to adjust the partition to the resized disk.

First, check the filesystem type:

admin@server:~$ lsblk -f /dev/vdb1
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
vdb1   ext4         a1b2c3d4-e5f6-7890-abcd-ef1234567890
Info

The steps below apply to ext2/ext3/ext4 filesystems. Unlike ext4, XFS cannot be resized while unmounted — the xfs_growfs tool requires the filesystem to be mounted. If your filesystem is XFS, still unmount the disk and recreate the partition as described below, but skip the e2fsck and resize2fs steps: remount the disk instead, then run sudo xfs_growfs /mnt/disk.

Before unmounting, check the current partition layout:

admin@server:~$ sudo fdisk -l /dev/vdb
Disk /dev/vdb: 70 GiB, 75161927680 bytes, 146800640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000001

Device     Boot  Start       End   Sectors  Size Id Type
/dev/vdb1        2048  104857599 104855552   50G 83 Linux
Warning

Note the Start sector value (in this example, 2048). You must re-enter this exact value when recreating the partition in the next step. Using a different start sector will misalign the filesystem and cause data corruption or loss.

First, unmount the disk:

admin@server:~$ sudo umount /mnt/disk

In our example:

admin@server:~$ sudo umount /mnt/vdb

Recreate the partition using the following command. This process only rewrites the partition table — your filesystem data is preserved, provided you re-enter the exact same start sector when prompted.

admin@server:~$ sudo fdisk /dev/vdb
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command

Type d to delete the partition:

Command (m for help): d

Selected partition 1
Partition 1 has been deleted.

Type n to recreate the partition:

Command (m for help): n

Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)

Type p to select the primary partition type:

Select (default p):
Using default response p.

Type the partition number, in our example 1:

Partition number (1-4, default 1): 1

Enter the first sector value you noted earlier (2048), then accept the default last sector to extend the partition across all remaining available space on the disk:

First sector (2048-146800639, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-146800639, default 146800639):

Created a new partition 1 of type 'Linux' and of size 70 GiB.

To list the changes, type p again.

Next, type w to save the changes:

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Check the partition (for ext2/ext3/ext4 filesystems):

admin@server:~$ sudo e2fsck -f /dev/vdb1

e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vdb1: 12/3276800 files (0.0% non-contiguous), 251700/13107200 blocks
admin@server:~$ sudo resize2fs /dev/vdb1

resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/vdb to 18350080 (4k) blocks.
The filesystem on /dev/vdb is now 18350080 (4k) blocks long.

Finally, re-mount and check the disk:

admin@server:~$ sudo mount /dev/vdb1 /mnt/disk/
admin@server:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 9.8G 840M 8.6G 9% /
udev 10M 0 10M 0% /dev
tmpfs 393M 5.2M 388M 2% /run
tmpfs 982M 0 982M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 982M 0 982M 0% /sys/fs/cgroup
/dev/vdb1 69G 52M 66G 1% /mnt/disk

Once this is completed, detach the volume from the instance and reattach it to ensure the updated QoS settings (IOPS and bandwidth) are properly applied.

After reattaching, you can verify the updated volume configuration in your Public Cloud project under Block Storage.

Extending the partition (Windows instance)

Before proceeding, reattach the volume to the instance. Click on ... in the row of the volume and select Attach to instance.

Establish a remote desktop (RDP) connection to your Windows instance.

Once logged in, right-click on the Start Menu button and open Disk Management.

windows

The extended disk now displays the additional capacity as unallocated space.

windows

Right-click on the volume and select Extend Volume from the context menu.

windows

In the "Extend Volume Wizard", click Next.

You can modify the disk space in this step to add less than the full amount to the partition. Click on Next.

windows

Click on Finish to complete the process.

The resized volume now includes the additional disk space.

windows

Once this is completed, detach the volume from the instance and reattach it to ensure the updated QoS settings (IOPS and bandwidth) are properly applied.

After reattaching, open Disk Management again to confirm the volume displays the correct total size. You can also verify the updated volume configuration in your Public Cloud project under Block Storage.

Go further

Creating and configuring an additional disk on an instance

Change your Block Storage volume type

Join our community of users.

Was this page helpful?