Guides

What is block storage? Block vs file vs object storage, and using a volume on Linux

Block storage presents raw disk blocks your server formats itself: how it differs from file and object storage, and how to format, mount and grow a volume.

Published ~8 min read

Short answer: block storage is storage presented as a raw device made of fixed-size blocks, each addressed by its number, with no idea of files or folders. The operating system puts a file system on it and decides what goes where. A hard disk, an SSD, a SAN volume, a cloud volume attached to an instance and the virtual disk of a VPS are all block storage — to the server they look like a disk, and they are used like one.

The term mostly comes up next to its two alternatives, file storage and object storage, because the three suit very different jobs. This guide explains the difference, what happens underneath, and how you use a block device on a Linux server, from formatting to growing it.

Block vs file vs object storage

Block storageFile storageObject storage
UnitNumbered blocksFiles in directoriesObjects with a key and metadata
Looks likeA disk: /dev/sdb, /dev/vdb, /dev/nvme0n1A mounted share: /mnt/shareAn HTTP API: PUT and GET by key
File systemYours — ext4, XFS, NTFS, ZFSThe storage server'sNone; flat namespace
ProtocolsSATA, SAS, NVMe; iSCSI, Fibre Channel, NVMe-oF; Ceph RBDNFS, SMB/CIFSS3 and compatible APIs
Shared by several serversNot safely, without a cluster file systemYes, that is its pointYes, over HTTP
LatencyLowestLow to moderateHighest
Best forOperating systems, databases, VM disksShared documents, home directoriesBackups, media, static assets, archives

The decisive line is who owns the file system. With block storage your server does, so it can use any file system, lock individual blocks, and get the low latency that databases need. The price is that only one server should write to a block device at a time: two machines mounting the same ext4 volume will corrupt it, because neither knows what the other has cached.

How does block storage work?

A block device is a long array of sectors — 512 bytes or, on modern drives, 4,096 bytes each. The kernel’s block layer reads and writes them by number, in requests it queues and merges. A file system on top keeps the map from files to blocks: which blocks belong to /var/lib/mysql/ibdata1, which are free, which hold the directory tree.

Between the file system and the physical media there are often more layers, each of them again a block device:

  • Partitions split one device into several (/dev/vda1, /dev/vda2).
  • RAID (mdadm, a hardware controller) combines several disks into one device that survives a disk failure.
  • LVM pools devices into volume groups and cuts flexible logical volumes from them.
  • Encryption (LUKS / dm-crypt) presents an encrypted device as a plain one.

Networked block storage moves the disk out of the server. With iSCSI or NVMe over Fabrics, a client (the initiator) sends block reads and writes over the network to a storage system (the target), and the client still sees a local disk. Distributed systems such as Ceph go further: they split a virtual disk into objects spread and replicated across many servers, and expose it again as one block device (RBD). Cloud volumes and most VPS disks are built this way or on local drives in the host, and from inside the VM you cannot tell which.

How do you use a block device on Linux?

First, see what is there. lsblk shows devices, partitions and mount points; blkid shows file systems and their UUIDs:

Linux · inspect block devices
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
blkid

A new, empty second disk — say /dev/vdb — gets a file system and a mount point:

Linux · format and mount a new disk (as root; check the device name first)
mkfs.ext4 -L data /dev/vdb
mkdir -p /data
mount /dev/vdb /data
# make it permanent by UUID, and do not block boot if it is missing
echo "UUID=$(blkid -s UUID -o value /dev/vdb) /data ext4 defaults,nofail 0 2" >> /etc/fstab
mount -a && df -h /data

When an existing disk grows — a cloud volume resized, or a VPS disk enlarged by the provider — the extra space appears at the end of the device, and the partition and file system must be grown into it:

Linux · grow the last partition and its file system
apt install -y cloud-guest-utils     # provides growpart on Debian and Ubuntu
growpart /dev/vda 1                  # grow partition 1 into the free space after it
resize2fs /dev/vda1                  # ext4 (online, while mounted)
# xfs_growfs /                       # XFS: pass the mount point instead

Device names differ between servers — /dev/sda, /dev/vda, /dev/nvme0n1 — so always use the names lsblk prints. On an LVM layout, grow the partition, then run pvresize on it and lvextend -r on the logical volume.

What decides block storage performance?

  • IOPS — operations per second, what databases with many small random reads and writes live on.
  • Throughput — MB/s for large sequential transfers, what backups and media need.
  • Latency — how long one operation takes; networked and replicated storage adds round trips that local disks do not.
  • Queue depth — how many operations are in flight; fast devices only reach their numbers with many parallel requests.

Which medium is underneath matters most for IOPS and latency: an NVMe SSD handles far more parallel requests than a SATA SSD, which in turn is orders of magnitude ahead of a spinning disk for random I/O. Measure rather than trust a label — fio with direct I/O gives honest numbers for each pattern. The disk speed testing guide has the fio recipes.

Snapshots are not backups

Block storage systems can snapshot a volume — freeze its state in an instant, keeping only changed blocks afterwards. That is ideal before an upgrade. But a snapshot lives on the same storage system as the volume, so it shares its fate. Real backups copy the data elsewhere: a file-level backup with restic or Borg to another server, or object storage. And a snapshot of a running database is only safe if the database can recover from it like from a power cut, or was flushed and paused first.

When is block storage the right choice?

  • Yes: boot disks, databases, VM disks, mail stores, anything that needs a real file system with locking and low latency on one server.
  • Yes, with care: very large data sets — fine, but grow in steps and watch the cost per gigabyte.
  • No: files several servers must write at once — use file storage or a database.
  • No: cold archives and public media — object storage is cheaper and serves over HTTP directly.

Disk full already? No space left on device shows how to find what is using it before you add more.

More block storage on a VMHeaven VPS

Every VMHeaven VPS has a virtual block device as its system disk. With a Storage VPS, more space is added from the panel in fixed blocks while the server keeps running: the virtual disk is enlarged in place, and you grow the partition and file system into the new space with the commands above — or with Disk Management on Windows. It works on all four KVM lines, so you pick the plan for its vCores and RAM and let the disk follow your data.

Frequently asked

What is the difference between block storage and object storage?

Block storage looks like a disk: the server formats it with a file system and reads and writes blocks with low latency. Object storage stores whole objects by key over an HTTP API; it is cheaper per gigabyte and suits backups and media, but not databases or operating systems.

Can two servers use the same block storage volume?

Not with an ordinary file system such as ext4 or XFS — both would cache and write independently and corrupt it. Shared access needs a cluster file system, or file storage such as NFS instead.

Is a VPS disk block storage?

Yes. The hypervisor presents a virtual block device to the VPS, which the operating system partitions and formats like a physical disk, whether the data underneath sits on local drives or networked storage.

Related articles

All guides