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
- A volume created in your provider's panel in the same location as the server.
- Root or sudo on the server.
- Background: object vs block vs file storage.
Attach and find the disk
- Attach the volume to the server in the provider panel (some providers can also format and mount it automatically).
- On the server, list disks:
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,SERIALThe 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_data01sudo mkdir -p /mnt/data && sudo mount /dev/disk/by-id/scsi-0Provider_Volume_data01 /mnt/dataUse the real by-id path from your system.
Mount automatically at boot
Get the UUID:
sudo blkid /dev/sdbAdd to /etc/fstab:
UUID=your-uuid /mnt/data ext4 defaults,nofail,discard 0 2nofail 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:
- Stop the service:
sudo systemctl stop mariadb. - Copy data preserving permissions:
sudo rsync -aHAX /var/lib/mysql/ /mnt/data/mysql/. - Point
datadirto the new path, or bind-mount it over the old path. - Update AppArmor/SELinux contexts if used, then start the service and verify.
Resize a volume
- Increase the size in the provider panel.
- Grow the filesystem:
sudo resize2fs /dev/sdb(ext4 on the whole disk) orsudo xfs_growfs /mnt/data. If partitioned, grow the partition first; see grow a disk with growpart.
Detach safely
- Stop services using it and
sudo umount /mnt/data. - Comment out the fstab line.
- 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.
