← ClaudeAtlas

backup-patternslisted

Backup patterns for Linux servers and applications covering the 3-2-1 rule, rsync file backups, PostgreSQL dumps with pg_dump, encrypted backups with restic, retention policies, and restore testing. Use whenever the project contains shell scripts using pg_dump, rsync, or restic, a Brewfile or requirements file with restic or pgbackup tooling, cron job definitions for backups, or backup-related systemd units, OR the user asks about backups, disaster recovery, data retention, pg_dump, rsync, or restic, even if "backup" is not mentioned by name.
ku5ic/dotfiles · ★ 0 · API & Backend · score 72
Install: claude install-skill ku5ic/dotfiles
# Backup Patterns ## When to load this skill - User asks about backups, data retention, or disaster recovery - Project uses PostgreSQL and needs a dump strategy - User asks about rsync, restic, pg_dump, or pg_restore - User is setting up a cron job for automated backups ## When not to load this skill - Database replication or high-availability (separate from backup) - Cloud provider snapshot configuration (AWS EBS, GCP PD) --- ## The 3-2-1 rule Keep **3** copies of data, on **2** different storage media, with **1** copy offsite. | Copy | Example | | -------------- | ----------------------------------------------------- | | Primary | Application data on the server | | Local backup | Second disk, attached NAS | | Offsite backup | Object storage (S3, Backblaze B2), restic remote repo | A backup that lives only on the same server as the data is not a backup. --- ## PostgreSQL backups ### pg_dump (single database) The custom format (`-F c`) is the most versatile: smaller than plain SQL, supports parallel restore, and supports selective restore. ```bash pg_dump -F c -f /backups/mydb_$(date +%Y%m%d).dump mydb ``` Restore: ```bash pg_restore -d mydb /backups/mydb_20260502.dump ``` Overwrite an existing database (drops objects before recreating): ```bash pg_restore -d mydb --clean /backups/mydb_20260502.dump ``` ### Flags reference | Flag