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:
- Flush and pause writes:
FLUSH TABLES WITH READ LOCK(MySQL),pg_backup_start()(PostgreSQL 15+), orfsfreeze -f /dataat the filesystem level. - Take the snapshot (EBS, LVM) immediately.
- 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.
More on Disk, Capacity & Backups
How do you lay out filesystems on a production server?IntermediateHow do you do capacity planning for disk?IntermediateWhat disk usage alert thresholds do you use?BeginnerA disk is 100% full in production. What do you do first?BeginnerHow do you clean up disk space safely on Docker hosts?IntermediateWhat is the 3-2-1 backup rule?Beginner