|
| 1 | +--- |
| 2 | +title: "Increasing the size of an additional disk" |
| 3 | +excerpt: "Find out how to increase the size of an additional volume and enlarge its main partition" |
| 4 | +slug: vps-increase-size-additional-disk |
| 5 | +section: "Backup options" |
| 6 | +updated: 2023-03-10 |
| 7 | +--- |
| 8 | + |
| 9 | +**Last updated 10th March 2022** |
| 10 | + |
| 11 | +## Objective |
| 12 | + |
| 13 | +If you have reached the maximum capacity on your additional disk, you can add more storage by increasing its size. |
| 14 | + |
| 15 | +This guide explains how to increase the size of an additional disk and extend the main partition accordingly. |
| 16 | + |
| 17 | +## Requirements |
| 18 | + |
| 19 | +- A [VPS](https://www.ovhcloud.com/asia/vps/) in your OVHcloud account |
| 20 | +- An [additional disk](https://docs.ovh.com/asia/en/vps/config-additional-disk-vps) configured on the VPS |
| 21 | +- Access to the [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager&from=https://www.ovh.com/asia/&ovhSubsidiary=asia) |
| 22 | +- Administrative access via SSH or RDP to your VPS |
| 23 | + |
| 24 | +## Instructions |
| 25 | + |
| 26 | +The following steps presume that you have configured an additional disk according to [our guide](https://docs.ovh.com/asia/en/vps/config-additional-disk-vps). |
| 27 | + |
| 28 | +### Modifying the size of the disk <a name="extend"></a> |
| 29 | + |
| 30 | +Log in to the [OVHcloud Control Panel](https://ca.ovh.com/auth/?action=gotomanager&from=https://www.ovh.com/asia/&ovhSubsidiary=asia), go to the `Bare Metal Cloud`{.action} section and select your server from `Virtual Private Servers`{.action}. |
| 31 | + |
| 32 | +In the box **Summary of options**, click on `...`{.action} in the section "Additional disks". Select `Increase the disk size`{.action}. |
| 33 | + |
| 34 | +{.thumbnail} |
| 35 | + |
| 36 | +Choose the new disk size in the popup window, then click on `Increase`{.action}. |
| 37 | + |
| 38 | +{.thumbnail} |
| 39 | + |
| 40 | +A message will appear to confirm your request. Click on the link inside the message box and follow the order process. (It is also possible that a new browser tab for the order has opened automatically.) |
| 41 | + |
| 42 | +{.thumbnail} |
| 43 | + |
| 44 | +After the payment is confirmed, the disk upgrade will take a few minutes. You can check the progress in the tab `Additional disks`{.action}: If your chosen new size is displayed, the disk is ready. |
| 45 | + |
| 46 | +{.thumbnail} |
| 47 | + |
| 48 | +> [!warning] |
| 49 | +> |
| 50 | +> Back up your data located on the additional disk before continuing. |
| 51 | +> |
| 52 | +
|
| 53 | +### Extending the partition |
| 54 | + |
| 55 | +> [!warning] |
| 56 | +> OVHcloud provides services for which you are responsible, with regard to their configuration and management. It is therefore your responsibility to ensure that they function correctly. |
| 57 | +> |
| 58 | +> This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend contacting a [specialist service provider](https://partner.ovhcloud.com/en-gb/directory/) or reaching out to [our community](https://community.ovh.com/en/) if you experience any issues. |
| 59 | +> |
| 60 | +
|
| 61 | +#### On a Linux VPS |
| 62 | + |
| 63 | +> [!primary] |
| 64 | +> |
| 65 | +> Note that this section describes a general approach to the necessary steps, based on an Ubuntu server OS. Some commands may require customisation for the distribution or operating system you are using. |
| 66 | +> |
| 67 | +
|
| 68 | +If a GNU/Linux distribution is installed on your VPS, establish an SSH connection to your server from the command line terminal or by using a SSH client application. |
| 69 | + |
| 70 | +The examples below presume you are logged in as a user with elevated permissions. |
| 71 | + |
| 72 | +Ensure that the disk is not mounted by using this command: |
| 73 | + |
| 74 | +```bash |
| 75 | +ubuntu@server:~$ sudo umount /mnt/disk |
| 76 | +``` |
| 77 | + |
| 78 | +Replace `/mnt/disk` with your actual mount path to the additional disk, if needed. |
| 79 | + |
| 80 | +Determine the names of disks and partitions: |
| 81 | + |
| 82 | +```bash |
| 83 | +ubuntu@server:~$ lsblk |
| 84 | +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS |
| 85 | +loop0 7:0 0 63.2M 1 loop /snap/core20/1623 |
| 86 | +loop1 7:1 0 63.3M 1 loop /snap/core20/1828 |
| 87 | +loop2 7:2 0 111.9M 1 loop /snap/lxd/24322 |
| 88 | +loop3 7:3 0 49.8M 1 loop /snap/snapd/18357 |
| 89 | +loop4 7:4 0 103M 1 loop /snap/lxd/23541 |
| 90 | +sda 8:0 0 160G 0 disk |
| 91 | +├─sda1 8:1 0 159.9G 0 part / |
| 92 | +├─sda14 8:14 0 4M 0 part |
| 93 | +└─sda15 8:15 0 106M 0 part /boot/efi |
| 94 | +sdc 8:32 0 100G 0 disk |
| 95 | +└─sdc1 8:33 0 50G 0 part |
| 96 | +``` |
| 97 | + |
| 98 | +In this example, the disk is named `sdc` and it has the correct new disk size of 100 GB after the upgrade explicated in the [first part](#extend) of this guide. The partition `sdc1` exists on the disk and uses 50 GB. |
| 99 | + |
| 100 | +Recreate the partition on the disk by running `fdisk`: |
| 101 | + |
| 102 | +```bash |
| 103 | +ubuntu@server:~$ sudo fdisk /dev/sdc |
| 104 | +``` |
| 105 | + |
| 106 | +Enter the following commands at the `fdisk` prompt: |
| 107 | + |
| 108 | +```console |
| 109 | +Welcome to fdisk (util-linux 2.37.2). |
| 110 | +Changes will remain in memory only, until you decide to write them. |
| 111 | +Be careful before using the write command. |
| 112 | + |
| 113 | +Command (m for help): d |
| 114 | +Selected partition 1 |
| 115 | +Partition 1 has been deleted. |
| 116 | + |
| 117 | +Command (m for help): n |
| 118 | +``` |
| 119 | + |
| 120 | +Confirm each of the default values by pressing `Enter`: |
| 121 | + |
| 122 | +```console |
| 123 | +Partition type |
| 124 | + p primary (0 primary, 0 extended, 4 free) |
| 125 | + e extended (container for logical partitions) |
| 126 | +Select (default p): |
| 127 | + |
| 128 | +Using default response p. |
| 129 | +Partition number (1-4, default 1): |
| 130 | +First sector (2048-209715199, default 2048): |
| 131 | +Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199): |
| 132 | + |
| 133 | +Created a new partition 1 of type 'Linux' and of size 100 GiB. |
| 134 | +``` |
| 135 | + |
| 136 | +Enter `n` and finally `w`: |
| 137 | + |
| 138 | +```console |
| 139 | +Partition #1 contains a ext4 signature. |
| 140 | + |
| 141 | +Do you want to remove the signature? [Y]es/[N]o: n |
| 142 | + |
| 143 | +Command (m for help): w |
| 144 | + |
| 145 | +The partition table has been altered. |
| 146 | +Calling ioctl() to re-read partition table. |
| 147 | +Syncing disks. |
| 148 | +``` |
| 149 | + |
| 150 | +Verify the partition and extend the file system: |
| 151 | + |
| 152 | +```bash |
| 153 | +ubuntu@server:~$ sudo e2fsck -f /dev/sdc1 |
| 154 | +e2fsck 1.46.5 (30-Dec-2021) |
| 155 | +/dev/sdc1: recovering journal |
| 156 | +Pass 1: Checking inodes, blocks, and sizes |
| 157 | +Pass 2: Checking directory structure |
| 158 | +Pass 3: Checking directory connectivity |
| 159 | +Pass 4: Checking reference counts |
| 160 | +Pass 5: Checking group summary information |
| 161 | +/dev/sdc1: 11/3276800 files (0.0% non-contiguous), 284558/13106944 blocks |
| 162 | +``` |
| 163 | +```bash |
| 164 | +ubuntu@server:~$ sudo resize2fs /dev/sdc1 |
| 165 | +resize2fs 1.46.5 (30-Dec-2021) |
| 166 | +Resizing the filesystem on /dev/sdc1 to 26214144 (4k) blocks. |
| 167 | +The filesystem on /dev/sdc1 is now 26214144 (4k) blocks long. |
| 168 | +``` |
| 169 | + |
| 170 | +Finally, mount the disk: |
| 171 | + |
| 172 | +```bash |
| 173 | +ubuntu@server:~$ sudo mount /dev/sdc1 /mnt/disk/ |
| 174 | +``` |
| 175 | + |
| 176 | +Partition 1 is now using the full size of the disk. |
| 177 | + |
| 178 | +```bash |
| 179 | +ubuntu@server:~$ df -h |
| 180 | +Filesystem Size Used Avail Use% Mounted on |
| 181 | +tmpfs 776M 992K 776M 1% /run |
| 182 | +/dev/sda1 155G 2.2G 153G 2% / |
| 183 | +tmpfs 3.8G 0 3.8G 0% /dev/shm |
| 184 | +tmpfs 5.0M 0 5.0M 0% /run/lock |
| 185 | +/dev/sda15 105M 5.3M 100M 5% /boot/efi |
| 186 | +tmpfs 776M 4.0K 776M 1% /run/user/1000 |
| 187 | +/dev/sdc1 99G 24K 94G 1% /mnt/disk |
| 188 | +``` |
| 189 | + |
| 190 | + |
| 191 | +#### On a Windows VPS |
| 192 | + |
| 193 | +If a Windows OS is installed on your VPS, establish a remote desktop (RDP) connection to your server. |
| 194 | + |
| 195 | +Once logged in, right-click on the `Start Menu`{.action} button and open `Disk Management`{.action}. |
| 196 | + |
| 197 | +{.thumbnail} |
| 198 | + |
| 199 | +The [extended disk](#extend) displays the additional capacity as unallocated space. Right-click on the volume of your additional disk and select `Extend Volume`{.action} from the context menu. |
| 200 | + |
| 201 | +{.thumbnail} |
| 202 | + |
| 203 | +In the "Extend Volume Wizard", click on `Next`{.action} to proceed. |
| 204 | + |
| 205 | +You can modify the disk space in this step if necessary. Click on `Next`{.action}. |
| 206 | + |
| 207 | +{.thumbnail} |
| 208 | + |
| 209 | +Click on `Finish`{.action} to complete the process. |
| 210 | + |
| 211 | +The resized volume now includes the additional disk space. |
| 212 | + |
| 213 | +{.thumbnail} |
| 214 | + |
| 215 | + |
| 216 | +## Go further |
| 217 | + |
| 218 | +Join our community of users on <https://community.ovh.com/en/>. |
0 commit comments