Linux VPS

Attach and use a block storage volume on a cloud VPS

Add extra block storage to a cloud server or VPS: attach the volume, find the new disk, format and mount it persistently, move data like databases onto it, and resize or detach safely.

IntermediateCloud servers and VPS2 min read

Many cloud and VPS providers let you add network-attached disks, called block storage volumes, without changing your server plan. This guide shows how to attach a block storage volume to a VPS, mount it and use it safely.

Before you start

Attach and find the disk

  1. Attach the volume to the server in the provider panel (some providers can also format and mount it automatically).
  2. On the server, list disks:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,SERIAL

The new disk appears as e.g. /dev/sdb or /dev/vdb with no mount point. Many providers also create stable links in /dev/disk/by-id/; prefer those.

Format and mount

Only format a new, empty volume:

sudo mkfs.ext4 /dev/disk/by-id/scsi-0Provider_Volume_data01
sudo mkdir -p /mnt/data && sudo mount /dev/disk/by-id/scsi-0Provider_Volume_data01 /mnt/data

Use the real by-id path from your system.

Mount automatically at boot

Get the UUID:

sudo blkid /dev/sdb

Add to /etc/fstab:

UUID=your-uuid  /mnt/data  ext4  defaults,nofail,discard  0  2

nofail stops boot from hanging if the volume is detached. Test with sudo mount -a. More detail: mount a new disk with fstab.

Move data onto the volume

Example for MySQL/MariaDB data:

  1. Stop the service: sudo systemctl stop mariadb.
  2. Copy data preserving permissions: sudo rsync -aHAX /var/lib/mysql/ /mnt/data/mysql/.
  3. Point datadir to the new path, or bind-mount it over the old path.
  4. Update AppArmor/SELinux contexts if used, then start the service and verify.

Resize a volume

  1. Increase the size in the provider panel.
  2. Grow the filesystem: sudo resize2fs /dev/sdb (ext4 on the whole disk) or sudo xfs_growfs /mnt/data. If partitioned, grow the partition first; see grow a disk with growpart.

Detach safely

  1. Stop services using it and sudo umount /mnt/data.
  2. Comment out the fstab line.
  3. Detach in the panel.

Troubleshooting

  • Disk not visible: rescan or reboot; confirm it is attached to the right server.
  • "wrong fs type": the volume is unformatted or uses another filesystem.
  • Slower than the main disk: network block storage often has lower IOPS than local NVMe; check the volume's performance tier.

Frequently asked questions

Can I attach one volume to two servers?

Usually not; most volumes are single-attach. Use NFS or object storage for sharing.

Are volumes backed up?

Not automatically in most cases; use snapshots and backups.

Volume or bigger plan?

Volumes add storage without extra CPU/RAM and survive server rebuilds.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.