Data disks
Add, grow and delete extra disks on a VM, and format, mount and grow them inside the VM.
Root disk and data disks
Every VM has a root disk. It holds the operating system and its size is part of the plan you chose, so the only way to change it is to resize the plan. A data disk is an extra disk you add on top of that, to keep data separate from the system and to get more room without changing plans.
Data disks are available on OVHcloud VMs, and only when the feature is switched on for your account area. When it is on, the VM's page has a Disks tab and the order form offers Add a data disk.
Order a disk with a new VM
On the order form, tick Add a data disk and enter a size. The disk is charged with the first month and created and attached while the VM is built. If the VM or its disk cannot be created, the whole payment, disk included, is refunded to your wallet.
Add a disk to a running VM
The VM must be running or stopped, and paid up.
- Open the VM and choose the Disks tab.
- Under Add a disk, enter a size in GB. The price appears as you type: what the disk costs per billing period, and what is charged now, which is only the part of the current period that is left.
- Choose Pay and add disk. The amount is taken from your wallet first. The new disk shows Creating and attaching… and becomes Active in a minute or two.
If the provider cannot create the disk, the amount is returned to your wallet automatically and the row says why. If the provider's quota is used up, the tab says so before you pay. Only one disk change can run on a VM at a time, and a VM can have a limited number of data disks.
Prices and renewal
A disk is part of the VM's subscription. It is billed per GB, and from the next renewal it renews together with the VM: the VM's renewal price already includes its disks. You see each disk's price in Rial, and the date it renews, in the Disks tab.
Make a disk larger
- In the Disks tab, choose Make larger on the disk.
- Enter the new total size. Only the added GB are charged, for the rest of the current period.
- Confirm. The disk shows Growing… and returns to Active with the new size.
A disk can only grow. It can never be made smaller, so choose a size you are happy to keep paying for. To use a smaller disk, add a new one, copy your data over and delete the old one.
Delete a disk
Choose Delete on the disk and type its size (or the VM's name) to confirm.
Deleting a disk destroys everything on it and cannot be undone. Unmount it inside the VM first. There is no refund for the rest of the paid period (the same rule as every other resource).
Deleting the VM also deletes its data disks. The delete dialog lists them before you confirm.
Use the new disk inside the VM
A new disk is empty and unformatted. The platform never changes anything inside your VM, so you prepare the disk yourself over SSH. The Disks tab has a "How to use the new disk" guide with these commands ready to copy.
1. Find the disk. It is the one without a mount point. Its name depends on the VM: on OVHcloud it is usually /dev/sdb (the root disk is /dev/sda), on other VMs it can be /dev/vdb or /dev/nvme1n1, and the letter can change. The guide in the Disks tab fills in the disk's id, so the last line below finds the right device for you:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
ls -l /dev/disk/by-id/
DEV=$(readlink -f "$(ls /dev/disk/by-id/*<disk id>* | head -n1)"); echo "$DEV"
2. First use only: format, mount and make it permanent.
mkfserases everything on the disk. Run it once, on a new disk only, never on a disk that already holds data (for example after making it larger).
sudo mkfs.ext4 "$DEV"
sudo mkdir -p /mnt/data
UUID=$(sudo blkid -s UUID -o value "$DEV")
echo "UUID=$UUID /mnt/data ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
sudo systemctl daemon-reload && sudo mount -a && df -h /mnt/data
The disk is added to /etc/fstab by its filesystem UUID, never by /dev/sdb, because the device name can change. The nofail option keeps the VM booting even if the disk is ever removed.
3. After you made the disk larger, grow the filesystem. The extra space appears by itself; the filesystem must be grown to use it. This works while the disk is mounted.
lsblk "$DEV"
sudo resize2fs "$DEV"
For XFS, run sudo xfs_growfs /mnt/data instead. If you partitioned the disk, run sudo growpart "$DEV" 1 first and then grow the partition's filesystem. (Tested on OVHcloud: the new size shows inside the VM at once and resize2fs grows a mounted ext4 disk with the data intact.)
4. Before you delete the disk, unmount it and remove its line from /etc/fstab:
sudo umount /mnt/data
A VM snapshot is taken of the VM's own disk. Data disks are separate disks and are not part of it, so do not rely on a snapshot to back one up.