Interview Prep/Linux/Disk, Capacity & Backups

How do you take a consistent snapshot of a running database volume?

AdvancedProductionDisk, Capacity & Backups
Answer

A plain snapshot is crash-consistent at best (like pulling the power). For application consistency:

  1. Flush and pause writes: FLUSH TABLES WITH READ LOCK (MySQL), pg_backup_start() (PostgreSQL 15+), or fsfreeze -f /data at the filesystem level.
  2. Take the snapshot (EBS, LVM) immediately.
  3. Release: UNLOCK TABLES / pg_backup_stop() / fsfreeze -u /data.

Multi-volume databases need multi-volume crash-consistent snapshots (EBS supports this). Usually native tools (pg_basebackup + WAL archiving, Percona XtraBackup) are better for point-in-time recovery.

All Linux questions Roadmap: Linux

More on Disk, Capacity & Backups