Mount Additional Disk Linux Guide for Your VPS

· 0x.cloud Team

Mount Additional Disk Linux Guide for Your VPS

To mount additional disk Linux storage, find the disk with lsblk, create a partition, format it as ext4, mount it to a folder, and add a UUID line to /etc/fstab. It takes about five minutes. The commands below are for Ubuntu 24.04 and Debian 12; AlmaLinux 9 differences are noted along the way.

You need extra storage when data grows: Nextcloud files, object storage, backups, media, databases. Before buying more, see what's eating your current disk: check disk space on Linux.

Add storage to your server

On 0x.cloud, extra NVMe storage costs $0.08 per GB: 100 GB for files or backups comes to $8.

If you're short on RAM as well as space (Nextcloud with a database and previews, an S3 store under load), compare with a bigger plan: s4-8 gives 120 GB NVMe, 4 vCPU and 8 GB RAM for $31.99/month. See plans and extra storage.

There are two cases, depending on how the space shows up:

  • a new device (for example vdb): follow steps 1 to 6;
  • a bigger main disk (vda grew): jump to "Grow a resized VPS disk".

Step 1. Find the new disk

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS

Example output:

NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda      60G disk
├─vda1   59G part ext4   /
└─vda15 106M part vfat   /boot/efi
vdb     100G disk

The new disk is vdb: no partitions, no mount point. Depending on the driver it may show up as sdb instead. Use your own name in the commands below. A wrong name will wipe the wrong disk, so double-check the size.

Step 2. Create a partition

# GPT label and one partition spanning the disk (no parted? sudo apt install -y parted)
sudo parted -s /dev/vdb mklabel gpt mkpart data ext4 0% 100%
lsblk /dev/vdb      # vdb1 appears

On GPT the first word after mkpart (data) is the partition name, ext4 is a type hint, and 0% 100% aligns the partition and fills the disk. You can format the whole disk without a partition, but a partition table is clearer to other admins and tools.

Step 3. Format it as ext4

sudo mkfs.ext4 -L data /dev/vdb1

-L data sets a label. ext4 fits nearly every workload; XFS (mkfs.xfs, the default on AlmaLinux 9) is an option for very large file sets.

Step 4. Mount the disk

sudo mkdir -p /mnt/data
sudo mount /dev/vdb1 /mnt/data
df -h /mnt/data

Step 5. Mount it at boot with fstab

Device names like vdb can change; UUIDs don't. Get the UUID:

sudo blkid /dev/vdb1
# /dev/vdb1: LABEL="data" UUID="3f1c...e2a" TYPE="ext4"

Back up fstab and append a line:

sudo cp /etc/fstab /etc/fstab.bak
echo 'UUID=3f1c...e2a  /mnt/data  ext4  defaults,nofail  0  2' | sudo tee -a /etc/fstab

Fields: device, mount point, filesystem, options, dump (0), and fsck order (2 for non-root disks). nofail keeps the server booting if the disk is ever missing. The format is documented in man fstab.

Step 6. Test without rebooting

sudo findmnt --verify  # checks fstab syntax and UUIDs
sudo umount /mnt/data
sudo systemctl daemon-reload
sudo mount -a          # no errors means fstab is good
findmnt /mnt/data

systemctl daemon-reload matters because systemd generates mount units from fstab and will otherwise warn that fstab changed. Hand the folder to your user or app: sudo chown -R deploy:deploy /mnt/data.

Grow a resized VPS disk

If the main disk grew instead of a new one appearing, extend the partition and filesystem live:

sudo apt install -y cloud-guest-utils   # provides growpart
sudo growpart /dev/vda 1                # grow partition 1 to the end of the disk
sudo resize2fs /dev/vda1                # grow ext4 (XFS: sudo xfs_growfs /)
df -h /

On AlmaLinux 9 the package is cloud-utils-growpart (sudo dnf install -y cloud-utils-growpart), and the root filesystem is usually XFS, so use xfs_growfs / instead of resize2fs. Take a snapshot first ($0.99/month): a wrong partition number is risky, and rolling back takes minutes.

Move app data to the new disk

Example for Docker: move all container storage to /mnt/data.

sudo systemctl stop docker docker.socket   # otherwise the socket restarts Docker on the next request
sudo rsync -aH /var/lib/docker/ /mnt/data/docker/
cat /etc/docker/daemon.json 2>/dev/null    # if it exists, add data-root to what's there
echo '{ "data-root": "/mnt/data/docker" }' | sudo tee /etc/docker/daemon.json
sudo systemctl start docker
docker info | grep "Docker Root Dir"       # should say /mnt/data/docker

tee overwrites the whole file, so if daemon.json already holds settings (a log size cap, say), add data-root to them by hand. Once containers run from the new disk, you can delete the old /var/lib/docker. The option is documented in the Docker daemon docs.

For Nextcloud, set the data directory on the new disk during install; for an S3 store on Garage, point its data path at /mnt/data.

Unmount an extra disk

sudo umount /mnt/data
# umount: target is busy? see who holds it
sudo fuser -vm /mnt/data

Stop the listed processes (or leave the folder yourself with cd ~) and run umount again. Then remove the disk's line from /etc/fstab, or systemd will keep waiting for it at boot.

Troubleshooting

Symptom Cause Fix
wrong fs type, bad superblock disk not formatted step 3
disk gone after reboot no fstab entry step 5 and mount -a
server won't boot fstab error without nofail roll back to the snapshot; that's why step 6 matters
Permission denied in the app folder owned by root chown to the app user
size unchanged after growpart filesystem not grown resize2fs or xfs_growfs
umount: target is busy a process or your shell is inside fuser -vm /mnt/data, cd ~
Prompt for an AI agent

Connect to my server, find the new empty disk in lsblk (show me the output and wait for me to confirm the name), create a GPT partition, format it ext4 with label data, mount it at /mnt/data and add it to /etc/fstab by UUID with nofail, keeping a backup of fstab. Run findmnt --verify and mount -a, then show me df -h.

Mount additional disk Linux FAQ

How do I find the name of a new disk? Run lsblk. The new disk has no partitions and no mount point. On KVM virtual servers it is usually vdb or sdb; go by the size.

Why isn't my disk mounted after a reboot? It's missing from /etc/fstab or the line has an error. Add an entry by UUID and test it with sudo findmnt --verify and sudo mount -a before rebooting.

What happens if the fstab UUID is wrong? Without the nofail option the server may stop in emergency mode during boot. Always use nofail for extra disks and test with mount -a.

How much is extra storage on 0x.cloud? Extra NVMe storage costs $0.08 per GB, so 100 GB comes to $8.

What if I break something? Take a snapshot ($0.99/month) before partitioning and roll back if needed. Worst case, an OS reinstall costs $0.