[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6NXNBT7PQ67RW8YTHTPF5CN":3,"skill-same:01M6NXNBT7PQ67RW8YTHTPF5CN":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":29,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6NXNBT7PQ67RW8YTHTPF5CN","backup-recovery",null,"Implement backup and recovery strategies. Configure rsync, Restic, and cloud backups. Use when designing data protection solutions.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fbackup-recovery\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"backup","recovery","backup recovery","community","relevant","rsync","scripts","critical","os","platform","strategies","main","security","only","configure","access","devops-security","data","license","recovery strategies","2026-11-10 10:12:30",false,"---\nname: backup-recovery\ndescription: Implement backup and recovery strategies. Configure rsync, Restic, and\n  cloud backups. Use when designing data protection solutions.\ncategory: devops\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant OS\u002Fplatform tooling and privileged access where\n  noted. Docs-only; helper scripts and templates not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# Backup and Recovery\n\nImplement comprehensive backup and recovery strategies using rsync, Restic, and cloud storage backends. Covers the 3-2-1 rule, automated scheduling, S3\u002FB2 backends, encryption, restore procedures, and verification testing.\n\n## When to Use\n\n- Designing a backup strategy for servers, databases, or application data\n- Setting up Restic for encrypted, deduplicated backups to local or cloud storage\n- Automating backups with systemd timers or cron\n- Restoring data after accidental deletion, corruption, or disaster\n- Migrating data between environments using backup\u002Frestore workflows\n- Verifying backup integrity and testing recovery procedures\n\n## Prerequisites\n\n- `rsync` installed (included in most Linux distributions)\n- `restic` installed (v0.16+ recommended)\n- Cloud CLI configured for the backend: AWS CLI for S3, `b2` CLI for Backblaze B2\n- Sufficient storage at the backup destination (2-3x source size for retention)\n- SSH access for remote rsync targets\n- `systemd` or `cron` for scheduling\n\n## The 3-2-1 Backup Rule\n\n- **3** copies of your data (1 primary + 2 backups)\n- **2** different storage media or types (e.g., local disk + cloud)\n- **1** copy offsite (cloud storage, remote datacenter)\n\n## rsync Backups\n\n### Basic Operations\n\n```bash\n# Sync a local directory to a backup location\nrsync -avz --delete \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Flags explained:\n# -a  archive mode (preserves permissions, ownership, timestamps, symlinks)\n# -v  verbose output\n# -z  compress data during transfer\n# --delete  remove files at destination that no longer exist at source\n\n# Sync to a remote server over SSH\nrsync -avz -e \"ssh -i ~\u002F.ssh\u002Fbackup_key\" \u002Fdata\u002F backup@remote:\u002Fbackups\u002Fserver01\u002F\n\n# Exclude patterns\nrsync -avz --delete \\\n  --exclude='*.tmp' \\\n  --exclude='*.log' \\\n  --exclude='.cache\u002F' \\\n  --exclude='node_modules\u002F' \\\n  \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Use an exclude file for complex patterns\nrsync -avz --delete --exclude-from=\u002Fetc\u002Fbackup-excludes.txt \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Dry run (preview what would change)\nrsync -avzn --delete \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Limit bandwidth to 50 MB\u002Fs and show progress\nrsync -avz --bwlimit=50000 --progress \u002Fdata\u002F backup@remote:\u002Fbackups\u002F\n```\n\n### Incremental Backups with Hard Links\n\n```bash\n# Incremental: unchanged files hard-linked to previous backup (saves space)\nrsync -avz --delete \\\n  --link-dest=\u002Fbackup\u002Fdaily\u002Flatest \\\n  \u002Fdata\u002F \u002Fbackup\u002Fdaily\u002F$(date +%Y-%m-%d)\u002F\n\n# Update the 'latest' symlink\nln -snf \u002Fbackup\u002Fdaily\u002F$(date +%Y-%m-%d) \u002Fbackup\u002Fdaily\u002Flatest\n\n# Remove backups older than 30 days\nfind \u002Fbackup\u002Fdaily -maxdepth 1 -type d -name \"20*\" -mtime +30 -exec rm -rf {} \\;\n```\n\n## Restic Backup\n\n### Installation\n\n```bash\n# Debian \u002F Ubuntu\napt install -y restic\n\n# RHEL \u002F CentOS\ndnf install -y restic\n\n# Or download the latest binary\ncurl -L https:\u002F\u002Fgithub.com\u002Frestic\u002Frestic\u002Freleases\u002Flatest\u002Fdownload\u002Frestic_0.17.3_linux_amd64.bz2 \\\n  | bunzip2 > \u002Fusr\u002Flocal\u002Fbin\u002Frestic\nchmod +x \u002Fusr\u002Flocal\u002Fbin\u002Frestic\n\n# Verify installation\nrestic version\n```\n\n### Initialize a Repository\n\n```bash\n# Local repository\nrestic init --repo \u002Fbackup\u002Frestic-repo\n\n# AWS S3 backend\nexport AWS_ACCESS_KEY_ID=\"AKIAEXAMPLE\"\nexport AWS_SECRET_ACCESS_KEY=\"secretkey\"\nrestic init --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket\n\n# S3-compatible (MinIO)\nexport AWS_ACCESS_KEY_ID=\"minioadmin\"\nexport AWS_SECRET_ACCESS_KEY=\"miniosecret\"\nrestic init --repo s3:http:\u002F\u002Fminio.example.com:9000\u002Fbackup-bucket\n\n# Backblaze B2 backend\nexport B2_ACCOUNT_ID=\"accountid\"\nexport B2_ACCOUNT_KEY=\"accountkey\"\nrestic init --repo b2:my-backup-bucket:server01\n\n# SFTP backend\nrestic init --repo sftp:backup@remote:\u002Fbackups\u002Fserver01\n\n# Restic will prompt for a repository password -- store it securely\n# Use a password file for automation\necho \"my-secure-repo-password\" > \u002Fetc\u002Frestic\u002Fpassword.txt\nchmod 600 \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Backup Operations\n\n```bash\n# Basic backup\nrestic backup \u002Fdata --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup multiple directories\nrestic backup \u002Fdata \u002Fetc \u002Fvar\u002Flib\u002Fpostgresql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup with exclusions\nrestic backup \u002Fdata \\\n  --exclude='*.tmp' \\\n  --exclude='*.log' \\\n  --exclude-file=\u002Fetc\u002Frestic\u002Fexcludes.txt \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup with tags (useful for filtering snapshots later)\nrestic backup \u002Fdata \\\n  --tag server01 --tag production --tag daily \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup stdin (e.g., database dump)\npg_dump -U postgres mydb | restic backup --stdin --stdin-filename mydb.sql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Verbose output showing files processed\nrestic backup \u002Fdata -v \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Snapshot Management\n\n```bash\n# List all snapshots (add --tag \u003Ctag> to filter)\nrestic snapshots --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Browse files in the latest snapshot\nrestic ls latest --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Compare two snapshots\nrestic diff abc123 def456 --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Retention Policy (forget + prune)\n\n```bash\n# Apply retention policy and reclaim space\nrestic forget \\\n  --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 3 \\\n  --prune \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Dry run to preview what would be removed\nrestic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 \\\n  --dry-run --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Restore Procedures\n\n```bash\n# Restore the latest snapshot to a target directory\nrestic restore latest --target \u002Frestore \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore a specific snapshot by ID\nrestic restore abc123 --target \u002Frestore \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore only specific files or directories\nrestic restore latest --target \u002Frestore --include \"\u002Fdata\u002Fconfig\" \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Mount a snapshot as a FUSE filesystem (browse and copy individual files)\nmkdir -p \u002Fmnt\u002Frestic\nrestic mount \u002Fmnt\u002Frestic --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt &\n# Browse: ls \u002Fmnt\u002Frestic\u002Fsnapshots\u002Flatest\u002F\n# Unmount when done: umount \u002Fmnt\u002Frestic\n```\n\n### Verification\n\n```bash\n# Verify repository integrity (checks all data and metadata)\nrestic check --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Full data verification (reads all pack files -- slow but thorough)\nrestic check --read-data --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Verify a random subset of data (faster than full read)\nrestic check --read-data-subset=5% --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n## Automated Backup with Environment File\n\n### \u002Fetc\u002Frestic\u002Fenv\n\n```bash\n# Repository configuration\nexport RESTIC_REPOSITORY=\"s3:s3.amazonaws.com\u002Fmy-backup-bucket\"\nexport RESTIC_PASSWORD_FILE=\"\u002Fetc\u002Frestic\u002Fpassword.txt\"\nexport AWS_ACCESS_KEY_ID=\"AKIAEXAMPLE\"\nexport AWS_SECRET_ACCESS_KEY=\"secretkey\"\n\n# Optional: set cache directory\nexport RESTIC_CACHE_DIR=\"\u002Fvar\u002Fcache\u002Frestic\"\n```\n\n### Backup Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# \u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\nset -euo pipefail\nsource \u002Fetc\u002Frestic\u002Fenv\nLOG=\"\u002Fvar\u002Flog\u002Frestic-backup.log\"\n\necho \"$(date): Starting backup\" >> \"$LOG\"\n\nrestic backup \u002Fdata \u002Fetc \u002Fvar\u002Flib\u002Fpostgresql \\\n  --exclude-file=\u002Fetc\u002Frestic\u002Fexcludes.txt \\\n  --tag \"$(hostname)\" --tag daily \\\n  --verbose >> \"$LOG\" 2>&1\n\nrestic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 \\\n  --prune >> \"$LOG\" 2>&1\n\n# Weekly integrity check (Sundays)\n[ \"$(date +%u)\" -eq 7 ] && restic check --read-data-subset=10% >> \"$LOG\" 2>&1\n\necho \"$(date): Backup completed\" >> \"$LOG\"\n```\n\n```bash\nchmod +x \u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\n```\n\n## Scheduled Backups\n\n### Systemd Timer (Recommended)\n\n```ini\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Frestic-backup.service\n[Unit]\nDescription=Restic backup\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=oneshot\nUser=root\nExecStart=\u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\nNice=10\nIOSchedulingClass=idle\n```\n\n```ini\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Frestic-backup.timer\n[Unit]\nDescription=Run Restic backup daily at 2 AM\n\n[Timer]\nOnCalendar=*-*-* 02:00:00\nPersistent=true\nRandomizedDelaySec=900\n\n[Install]\nWantedBy=timers.target\n```\n\n```bash\n# Enable and start the timer\nsystemctl daemon-reload\nsystemctl enable --now restic-backup.timer\n\n# Check timer status\nsystemctl list-timers restic-backup.timer\n\n# Run manually for testing\nsystemctl start restic-backup.service\njournalctl -u restic-backup.service -f\n```\n\n## Database Backups with Restic\n\n```bash\n# PostgreSQL: stream dump directly into restic (no temp file)\npg_dump -U postgres -Fc mydb | restic backup --stdin --stdin-filename mydb.dump \\\n  --tag postgres --tag mydb \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# MySQL \u002F MariaDB: stream dump into restic\nmysqldump --all-databases --single-transaction | \\\n  restic backup --stdin --stdin-filename all-databases.sql \\\n  --tag mysql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore PostgreSQL from restic\nrestic dump latest mydb.dump \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt \\\n  | pg_restore -U postgres -d mydb --clean --if-exists\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| \"repository not initialized\" | `restic cat config --repo \u003Crepo>` | Run `restic init --repo \u003Crepo>` first |\n| \"wrong password\" | Check env vars \u002F password file | Verify RESTIC_PASSWORD_FILE contents and permissions |\n| Backup is slow | `restic backup -v` for progress | Check network bandwidth; exclude large unneeded dirs |\n| S3 permission denied | `aws s3 ls s3:\u002F\u002Fbucket\u002F` | Check IAM policy includes s3:GetObject, s3:PutObject |\n| \"unable to create lock\" | `restic unlock --repo \u003Crepo>` | A previous backup crashed; unlock the repository |\n| Restore shows empty dirs | `restic ls \u003Csnapshot-id>` | Verify correct snapshot ID; check --include path syntax |\n| Repository growing too large | `restic stats --repo \u003Crepo>` | Run `restic forget --prune` with stricter retention |\n| Check fails with pack errors | `restic check --read-data` | Rebuild index: `restic rebuild-index`; restore from another copy |\n\n## Related Skills\n\n- `linux-administration` -- Server maintenance and log management\n- `systemd-services` -- Scheduling backups with systemd timers\n- `object-storage` -- S3 and MinIO as backup destinations\n- `block-storage` -- LVM snapshots for consistent backups\n- `nfs-storage` -- Backing up NFS-shared data\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n","# Backup and Recovery\n\nImplement comprehensive backup and recovery strategies using rsync, Restic, and cloud storage backends. Covers the 3-2-1 rule, automated scheduling, S3\u002FB2 backends, encryption, restore procedures, and verification testing.\n\n## When to Use\n\n- Designing a backup strategy for servers, databases, or application data\n- Setting up Restic for encrypted, deduplicated backups to local or cloud storage\n- Automating backups with systemd timers or cron\n- Restoring data after accidental deletion, corruption, or disaster\n- Migrating data between environments using backup\u002Frestore workflows\n- Verifying backup integrity and testing recovery procedures\n\n## Prerequisites\n\n- `rsync` installed (included in most Linux distributions)\n- `restic` installed (v0.16+ recommended)\n- Cloud CLI configured for the backend: AWS CLI for S3, `b2` CLI for Backblaze B2\n- Sufficient storage at the backup destination (2-3x source size for retention)\n- SSH access for remote rsync targets\n- `systemd` or `cron` for scheduling\n\n## The 3-2-1 Backup Rule\n\n- **3** copies of your data (1 primary + 2 backups)\n- **2** different storage media or types (e.g., local disk + cloud)\n- **1** copy offsite (cloud storage, remote datacenter)\n\n## rsync Backups\n\n### Basic Operations\n\n```bash\n# Sync a local directory to a backup location\nrsync -avz --delete \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Flags explained:\n# -a  archive mode (preserves permissions, ownership, timestamps, symlinks)\n# -v  verbose output\n# -z  compress data during transfer\n# --delete  remove files at destination that no longer exist at source\n\n# Sync to a remote server over SSH\nrsync -avz -e \"ssh -i ~\u002F.ssh\u002Fbackup_key\" \u002Fdata\u002F backup@remote:\u002Fbackups\u002Fserver01\u002F\n\n# Exclude patterns\nrsync -avz --delete \\\n  --exclude='*.tmp' \\\n  --exclude='*.log' \\\n  --exclude='.cache\u002F' \\\n  --exclude='node_modules\u002F' \\\n  \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Use an exclude file for complex patterns\nrsync -avz --delete --exclude-from=\u002Fetc\u002Fbackup-excludes.txt \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Dry run (preview what would change)\nrsync -avzn --delete \u002Fdata\u002F \u002Fbackup\u002Fdata\u002F\n\n# Limit bandwidth to 50 MB\u002Fs and show progress\nrsync -avz --bwlimit=50000 --progress \u002Fdata\u002F backup@remote:\u002Fbackups\u002F\n```\n\n### Incremental Backups with Hard Links\n\n```bash\n# Incremental: unchanged files hard-linked to previous backup (saves space)\nrsync -avz --delete \\\n  --link-dest=\u002Fbackup\u002Fdaily\u002Flatest \\\n  \u002Fdata\u002F \u002Fbackup\u002Fdaily\u002F$(date +%Y-%m-%d)\u002F\n\n# Update the 'latest' symlink\nln -snf \u002Fbackup\u002Fdaily\u002F$(date +%Y-%m-%d) \u002Fbackup\u002Fdaily\u002Flatest\n\n# Remove backups older than 30 days\nfind \u002Fbackup\u002Fdaily -maxdepth 1 -type d -name \"20*\" -mtime +30 -exec rm -rf {} \\;\n```\n\n## Restic Backup\n\n### Installation\n\n```bash\n# Debian \u002F Ubuntu\napt install -y restic\n\n# RHEL \u002F CentOS\ndnf install -y restic\n\n# Or download the latest binary\ncurl -L https:\u002F\u002Fgithub.com\u002Frestic\u002Frestic\u002Freleases\u002Flatest\u002Fdownload\u002Frestic_0.17.3_linux_amd64.bz2 \\\n  | bunzip2 > \u002Fusr\u002Flocal\u002Fbin\u002Frestic\nchmod +x \u002Fusr\u002Flocal\u002Fbin\u002Frestic\n\n# Verify installation\nrestic version\n```\n\n### Initialize a Repository\n\n```bash\n# Local repository\nrestic init --repo \u002Fbackup\u002Frestic-repo\n\n# AWS S3 backend\nexport AWS_ACCESS_KEY_ID=\"AKIAEXAMPLE\"\nexport AWS_SECRET_ACCESS_KEY=\"secretkey\"\nrestic init --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket\n\n# S3-compatible (MinIO)\nexport AWS_ACCESS_KEY_ID=\"minioadmin\"\nexport AWS_SECRET_ACCESS_KEY=\"miniosecret\"\nrestic init --repo s3:http:\u002F\u002Fminio.example.com:9000\u002Fbackup-bucket\n\n# Backblaze B2 backend\nexport B2_ACCOUNT_ID=\"accountid\"\nexport B2_ACCOUNT_KEY=\"accountkey\"\nrestic init --repo b2:my-backup-bucket:server01\n\n# SFTP backend\nrestic init --repo sftp:backup@remote:\u002Fbackups\u002Fserver01\n\n# Restic will prompt for a repository password -- store it securely\n# Use a password file for automation\necho \"my-secure-repo-password\" > \u002Fetc\u002Frestic\u002Fpassword.txt\nchmod 600 \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Backup Operations\n\n```bash\n# Basic backup\nrestic backup \u002Fdata --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup multiple directories\nrestic backup \u002Fdata \u002Fetc \u002Fvar\u002Flib\u002Fpostgresql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup with exclusions\nrestic backup \u002Fdata \\\n  --exclude='*.tmp' \\\n  --exclude='*.log' \\\n  --exclude-file=\u002Fetc\u002Frestic\u002Fexcludes.txt \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup with tags (useful for filtering snapshots later)\nrestic backup \u002Fdata \\\n  --tag server01 --tag production --tag daily \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Backup stdin (e.g., database dump)\npg_dump -U postgres mydb | restic backup --stdin --stdin-filename mydb.sql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Verbose output showing files processed\nrestic backup \u002Fdata -v \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Snapshot Management\n\n```bash\n# List all snapshots (add --tag \u003Ctag> to filter)\nrestic snapshots --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Browse files in the latest snapshot\nrestic ls latest --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Compare two snapshots\nrestic diff abc123 def456 --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Retention Policy (forget + prune)\n\n```bash\n# Apply retention policy and reclaim space\nrestic forget \\\n  --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 3 \\\n  --prune \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Dry run to preview what would be removed\nrestic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 \\\n  --dry-run --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n### Restore Procedures\n\n```bash\n# Restore the latest snapshot to a target directory\nrestic restore latest --target \u002Frestore \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore a specific snapshot by ID\nrestic restore abc123 --target \u002Frestore \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore only specific files or directories\nrestic restore latest --target \u002Frestore --include \"\u002Fdata\u002Fconfig\" \\\n  --repo \u002Fbackup\u002Frestic-repo \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Mount a snapshot as a FUSE filesystem (browse and copy individual files)\nmkdir -p \u002Fmnt\u002Frestic\nrestic mount \u002Fmnt\u002Frestic --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt &\n# Browse: ls \u002Fmnt\u002Frestic\u002Fsnapshots\u002Flatest\u002F\n# Unmount when done: umount \u002Fmnt\u002Frestic\n```\n\n### Verification\n\n```bash\n# Verify repository integrity (checks all data and metadata)\nrestic check --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Full data verification (reads all pack files -- slow but thorough)\nrestic check --read-data --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Verify a random subset of data (faster than full read)\nrestic check --read-data-subset=5% --repo \u002Fbackup\u002Frestic-repo --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n```\n\n## Automated Backup with Environment File\n\n### \u002Fetc\u002Frestic\u002Fenv\n\n```bash\n# Repository configuration\nexport RESTIC_REPOSITORY=\"s3:s3.amazonaws.com\u002Fmy-backup-bucket\"\nexport RESTIC_PASSWORD_FILE=\"\u002Fetc\u002Frestic\u002Fpassword.txt\"\nexport AWS_ACCESS_KEY_ID=\"AKIAEXAMPLE\"\nexport AWS_SECRET_ACCESS_KEY=\"secretkey\"\n\n# Optional: set cache directory\nexport RESTIC_CACHE_DIR=\"\u002Fvar\u002Fcache\u002Frestic\"\n```\n\n### Backup Script\n\n```bash\n#!\u002Fbin\u002Fbash\n# \u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\nset -euo pipefail\nsource \u002Fetc\u002Frestic\u002Fenv\nLOG=\"\u002Fvar\u002Flog\u002Frestic-backup.log\"\n\necho \"$(date): Starting backup\" >> \"$LOG\"\n\nrestic backup \u002Fdata \u002Fetc \u002Fvar\u002Flib\u002Fpostgresql \\\n  --exclude-file=\u002Fetc\u002Frestic\u002Fexcludes.txt \\\n  --tag \"$(hostname)\" --tag daily \\\n  --verbose >> \"$LOG\" 2>&1\n\nrestic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 \\\n  --prune >> \"$LOG\" 2>&1\n\n# Weekly integrity check (Sundays)\n[ \"$(date +%u)\" -eq 7 ] && restic check --read-data-subset=10% >> \"$LOG\" 2>&1\n\necho \"$(date): Backup completed\" >> \"$LOG\"\n```\n\n```bash\nchmod +x \u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\n```\n\n## Scheduled Backups\n\n### Systemd Timer (Recommended)\n\n```ini\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Frestic-backup.service\n[Unit]\nDescription=Restic backup\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=oneshot\nUser=root\nExecStart=\u002Fusr\u002Flocal\u002Fbin\u002Frestic-backup.sh\nNice=10\nIOSchedulingClass=idle\n```\n\n```ini\n# \u002Fetc\u002Fsystemd\u002Fsystem\u002Frestic-backup.timer\n[Unit]\nDescription=Run Restic backup daily at 2 AM\n\n[Timer]\nOnCalendar=*-*-* 02:00:00\nPersistent=true\nRandomizedDelaySec=900\n\n[Install]\nWantedBy=timers.target\n```\n\n```bash\n# Enable and start the timer\nsystemctl daemon-reload\nsystemctl enable --now restic-backup.timer\n\n# Check timer status\nsystemctl list-timers restic-backup.timer\n\n# Run manually for testing\nsystemctl start restic-backup.service\njournalctl -u restic-backup.service -f\n```\n\n## Database Backups with Restic\n\n```bash\n# PostgreSQL: stream dump directly into restic (no temp file)\npg_dump -U postgres -Fc mydb | restic backup --stdin --stdin-filename mydb.dump \\\n  --tag postgres --tag mydb \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# MySQL \u002F MariaDB: stream dump into restic\nmysqldump --all-databases --single-transaction | \\\n  restic backup --stdin --stdin-filename all-databases.sql \\\n  --tag mysql \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt\n\n# Restore PostgreSQL from restic\nrestic dump latest mydb.dump \\\n  --repo s3:s3.amazonaws.com\u002Fmy-backup-bucket \\\n  --password-file \u002Fetc\u002Frestic\u002Fpassword.txt \\\n  | pg_restore -U postgres -d mydb --clean --if-exists\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| \"repository not initialized\" | `restic cat config --repo \u003Crepo>` | Run `restic init --repo \u003Crepo>` first |\n| \"wrong password\" | Check env vars \u002F password file | Verify RESTIC_PASSWORD_FILE contents and permissions |\n| Backup is slow | `restic backup -v` for progress | Check network bandwidth; exclude large unneeded dirs |\n| S3 permission denied | `aws s3 ls s3:\u002F\u002Fbucket\u002F` | Check IAM policy includes s3:GetObject, s3:PutObject |\n| \"unable to create lock\" | `restic unlock --repo \u003Crepo>` | A previous backup crashed; unlock the repository |\n| Restore shows empty dirs | `restic ls \u003Csnapshot-id>` | Verify correct snapshot ID; check --include path syntax |\n| Repository growing too large | `restic stats --repo \u003Crepo>` | Run `restic forget --prune` with stricter retention |\n| Check fails with pack errors | `restic check --read-data` | Rebuild index: `restic rebuild-index`; restore from another copy |\n\n## Related Skills\n\n- `linux-administration` -- Server maintenance and log management\n- `systemd-services` -- Scheduling backups with systemd timers\n- `object-storage` -- S3 and MinIO as backup destinations\n- `block-storage` -- LVM snapshots for consistent backups\n- `nfs-storage` -- Backing up NFS-shared data\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n",{"name":5,"risk":25,"source":43,"license":14,"category":44,"metadata":45,"date_added":48,"description":7,"source_repo":49,"source_type":21,"compatibility":50,"license_source":51},"https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills","devops",{"author":46,"version":47},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant OS\u002Fplatform tooling and privileged access where noted. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fbackup-recovery","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill backup-recovery",{"tool":63,"command":64},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill backup-recovery",{"tool":66,"command":67},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill backup-recovery","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fbackup-recovery\u002FSKILL.md",true,[],[72,89,113,137,154,174],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[],[79,80,81,82,83,84,74,85,34,33,32,31,21,29,86,25,87,24,22,88],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","active","scope","implementing",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[96,97,98,99,100,101,102,103,104,105,106,107,108,31,109,21,110,111,25,112],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[120,121,122,123,124,125,126,36,127,128,129,130,131,21,29,132,133,134,135,136],"transcript","youtube transcript","youtube","safe","github","codex","research","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[],[120,121,122,144,123,145,124,125,36,146,147,148,149,129,150,21,29,151,152,153],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[],[122,161,162,100,123,163,164,165,166,36,148,167,168,169,170,29,171,132,172,173],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[],[181,122,182,183,123,145,146,184,185,147,148,149,129,186,150,21,29,151,187,135],"youtube full","full","google","server","dlp","credits","automatic"]