Learn how to create an additional Block Storage volume, attach it to your Public Cloud instance, and configure it on Linux or Windows.
You can create additional disks for your Public Cloud instances. This can be useful in cases where:
- You want to increase your storage capacity without changing the instance model.
- You want to have highly available, high-performance storage.
- You want to move your storage and data to another instance.
- You want to prepare the environment if you want to use Terraform.
Requirements
- A Public Cloud instance in your account
- Administrative (sudo) access to your instance via SSH (Linux) or RDP (Windows)
OVHcloud Control Panel Access
- Direct link: Public Cloud Projects
-
Navigation path:
Public Cloud> Select your project
Instructions
The different types of volumes
OVHcloud offers three types of Block Storage volumes, each tailored to specific needs in terms of performance, capacity, and cost. These solutions enable you to attach persistent storage volumes to your instances, guaranteeing a high level of reliability and availability.
For more information about the types of volumes, please visit our website.
All volume types are also available in an encrypted version (LUKS). These volumes ensure data confidentiality without impacting performance. They are available through the OVHcloud Control Panel as well as via the tools presented in the next section, by specifying the types <volume_type>-luks.
Adding a new volume
Via the OVHcloud Control Panel
Open Block Storage in the left-hand menu under Storage and click Create a volume.
On the following screen, choose your configuration settings:
Select a region: Select the location for your block storage volume. For more information about Local Zones, see this guide.
NOTE: Your volume must be created in the same region as the instance to which you wish to attach it. If you create it in another region, you can delete it and recreate it in the correct region.
Volume type: Choose your volume type and select your encryption level. More information about the types of volumes is available on our website.
From here, complete your volume's configuration by selecting the Volume capacity and Volume name, and then clicking Create the volume.
Once your new disk is available, click the more options ... button to the right of the disk and select Attach to instance.
In the pop-up window, choose an available instance and click Confirm. If no instances are available it is because you do not have an instance in a region matching that of the additional disk.
The process may take a few minutes to complete.
NOTE: Navigating away from the page during creation may interrupt the process.
Via Terraform
NOTE: Please not that the "high-speed-gen-2" or "luks" volume types may not be available in all regions.
Type of volumes:
- Classic
- HIgh-speed
- High-speed-gen2
- Classic-luks
- High-speed-luks
- High-speed-gen2-luks
The types ending in -luks are encrypted (LUKS).
NOTE: Creating a -luks volume automatically generates a dedicated key.
Do not modify or delete this key it is linked to a Block Storage volume. Doing so would make the data on that volume and all it's snapshots permanently unrecoverable.
To create a simple block storage volume, you need three elements:
- The name of the volume
- The region
- The size of the volume in GB
In our example, we will create a block storage in the US-EAST-VA-1 region with a size of 10 GB. Add the following lines to a file named simple_blockstorage.tf:
Then we will attach it to the target instance.
NOTE: The instance and the volume must be in the same region.
Add the following lines below the previous ones:
Create and attach the volume by running:
The output should look like this:
Via the Horizon interface
Go to the Volumes drop-down section, click Volumes and then + Create Volume.
Fill in the Volume Name field and select the type of volume you want. Then click on Create Volume.
NOTE: Please note that if the volume type "high-speed-gen2" or "luks" does not appear in the list, this means that it is not available in this region.
To attach this volume to an instance, on your volume line, click the drop-down menu ▼ next to Edit Volume. Then click on Manage Attachments.
Select the instance to which you wish to attach your volume, then click on Attach Volume.
Via the OpenStack CLI
NOTE: Please note that if the volume type "high-speed-gen2" or "luks" does not appear in the list, this means that it is not available in this region.
Types of volumes:
- Classic
- High-speed
- High-speed-gen2
- Classic-luks
- High-speed-luks
- High-speed-gen2-luks
The types ending in -luks are encrypted (LUKS).
NOTE: Creating a -luks volume automatically generates a dedicated key.
Do not modify or delete this key it is linked to a Block Storage volume. Doing so would make the data on that voolume and all it's snapshots permanently unrecoverable.
List the volume types available in the region:
Create a volume with at least a size (in GB) and a type. Optionally, add a name.
To attach a volume to an instance available in the region, use the following command:
Configuring the new disk
The examples below presume you are logged in as a user with elevated permissions.
Using Linux
Establish an SSH connection to your instance, then use the command below to list the attached disks.
sda in this example refers to the default disk of the instance. The additional disk will then be labeled sdb.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 50G 0 disk
└─sda1 8:1 0 49.9G 0 part /
sdb 8:16 0 10G 0 disk
Create a partition on the additional disk using the commands below.
If your additional disk is less than 2TB:
If your additional disk is larger than 2TB:
Format partition sdb1:
Mount the partition:
Verify the mount point:
The mount is not persistent after reboot. To automate mounting, edit the fstab file.
Retrieve the UUID of the new volume:
Open /etc/fstab:
Add the line below, replacing the UUID with your own:
Save and exit the editor. The disk will mount automatically after each reboot.
Using Windows
Establish a remote desktop (RDP) connection to your Windows instance.
Right-click on the Start Menu button and open Disk Management.
The disk appears as an unknown volume with unallocated space.
If offline, initialized it via Windows GUI or the DISKPART. Otherwise, proceed to formatting.
Initializing the disk in Disk Management
Right-click on the disk and select Online.
If offline, right-click on the disk and select Online.
Right-click again and select Initialize Disk.
Next, select MBR (Master Boot Record) if your additional disk is less than 2TB, or GPT (GUID Partition Table) if it is more than 2 TB, then click OK.
Initializing the disk with DISKPART
Right-click Start Menu and open Run.
Type cmd and click OK.
At the command prompt, open DISKPART:
Run these DISKPART commands to bring the disk to online:
Formatting the disk
In Disk Management, right-click the disk and select New Simple Volume....
In the wizard, click Next to confirm the volume size (maximum by default), then Next again.
Accept the drive letter or select another, then click Next.
Label the volume (optional) and click Next.
Click Finish to format the disk.
The disk appears in File Explorer as a drive.
Detach a volume
Before detaching a volume, unmount in the operating system.
NOTE: An error message may appear if you have software or processes running on the additional disk. In this case, it is recommended to stop all processes before continuing.
Here is how to unmount the volume from the operating system before detaching it from the instance:
On Linux
Connect via SSH, then list the attached disks.
Unmount the partition:
Remove the device ID from the fstab; otherwise the partition remounts after reboot.
Save and exit the editor.
On Windows
Establish a remote desktop (RDP) connection to your Windows instance.
Right-click the Start Menu and open Disk Management.
Right-click the volume and select Change Drive Letter and Paths....
Click Remove.
Click Yes to confirm.
When finished, you can close the Disk Management window.
Finally, we will detach the volume from the instance:
Via OVHcloud Control Panel
Open Block Storage in the left-hand menu under Storage.
Click the more options ... button next to the corresponding volume and select Detach from instance.
NOTE: You can also cancel your Block Storage volume using this menu.
Click Confirm in the pop-up window to start the process.
Via Terraform
Delete these lines from your Terraform file:
Run this command to verify the planned deletion:
The output should look like this:
Apply the changes:
The output should look like this:
Go further
For more information and tutorials, please see our other Public Cloud support guides or explore the guides for other OVHcloud products and services.