Skip to content
VDS · Backups and disk

Partitions and file systems

How disk partitioning works on a VPS, how LVM differs from regular partitions, how to mount an additional directory, and what to write in fstab so the machine boots.

Updated August 23, 2026

The virtual machine disk appears to the system as /dev/sda. The layout depends on the image you choose: Debian and Ubuntu usually install with a single root partition, while AlmaLinux uses LVM. You need to know your layout before you need to extend anything.

What you have now

lsblk -f
df -hT
sudo fdisk -l /dev/sda
sudo blkid

lsblk -f is the most useful: it shows the device tree, file systems, labels, and mount points in a single screen.

If the output contains lines like vg-root and the type lvm, you have LVM. Then these will come in handy:

sudo pvs
sudo vgs
sudo lvs

Plain partitions or LVM

Plain partitions are simpler: one partition — one file system. Only the last partition on the disk can be extended, and only if there is free space after it.

LVM adds a layer: physical volume, volume group, logical volumes. You can carve out multiple volumes, extend them in any order, and add space without reworking the layout. The trade-off is an extra layer you have to remember during recovery.

For a single machine with one disk, the difference is small. Don't redo the layout unnecessarily: moving the root is an operation with a real risk of losing the system.

File systems

SystemDefault locationFeatures
ext4Debian, UbuntuProven, extends online, shrinks when unmounted
xfsAlmaLinux, CentOS StreamFast with large files, extends online, does not shrink

Practical takeaway: if you plan for flexibility, stay on ext4. You'll almost never need to shrink a partition on a VPS anyway — the disk on the machine doesn't shrink along with your plan.

Extending after increasing the disk

sudo growpart /dev/sda 1
sudo resize2fs /dev/sda1

For LVM:

sudo growpart /dev/sda 3
sudo pvresize /dev/sda3
sudo lvextend -l +100%FREE /dev/mapper/vg-root
sudo resize2fs /dev/mapper/vg-root      # xfs_growfs / for XFS

Both operations are performed on a running system. For details on moving to a larger tier — the disk has become too small.

An error in the partition number in growpart or parted destroys the partition table, and the machine stops booting. Before any layout change: save sudo sfdisk -d /dev/sda > /root/parts.txt and make sure the data backup is fresh.

Mounting and fstab

Persistent mount points are described in /etc/fstab. Use the UUID, not the device name:

sudo blkid /dev/sda1
UUID=1a2b3c4d-...  /var/lib/postgresql  ext4  defaults,noatime  0  2

Checking before rebooting is mandatory:

sudo mount -a
sudo findmnt --verify

An error in fstab leaves the machine at an emergency console on boot. If this happens, the rescue disk will help: the machine reboots into SystemRescue, root login without a password, the disk is visible as /dev/sda — you mount the partition, edit fstab, and return to normal boot mode.

Swap

A swap file is created in the usual way:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab

Swap saves you from a process being suddenly killed when memory runs out, but heavy swapping runs into disk speed and makes the machine very slow. It's wiser to limit the resource demands of services — see resource limits.

Common mistakes

  • You didn't check the fstab edit with mount -a. Boot breaks, and you have to troubleshoot through the console in the control panel.
  • You mounted a directory over data. The old contents didn't go anywhere, but became invisible — unmount and check.
  • You didn't set noatime. It's a small thing, but the extra write on every file read on a loaded machine is noticeable.