Snapshotting
What is a snapshot?
A snapshot is a point-in-time view of data. Depending on the tech, it may be:
- copy-on-write (space efficient)
- crash-consistent by default, application-consistent with coordination
Where snapshots exist
- LVM snapshots
- Filesystem snapshots (ZFS, btrfs)
- Storage array / cloud volume snapshots
LVM snapshot example (conceptual)
Create snapshot LV:
sudo lvcreate -s -n lv_app_snap -L 5G /dev/vg_data/lv_app
sudo lvs
Mount snapshot read-only:
sudo mount -o ro /dev/vg_data/lv_app_snap /mnt/snap
Remove snapshot when done:
sudo lvremove /dev/vg_data/lv_app_snap
Tips
- Coordinate with apps/databases (flush, lock, or use native backup tooling)
- Monitor snapshot space; if it fills, the snapshot can become invalid