---
name: backup-manager
description: Automated backups for your files, databases, and configurations.
  Local, network, or cloud storage.
---

# Backup Manager

Automated backups for your files, databases, and configurations. Local, network, or cloud storage.

**Category:** home, security
**API Key Required:** No (unless using cloud storage)

## What It Does

Sets up and manages automated backups using rsync, cron, and optional cloud sync (rclone). Back up important files to another drive, NAS, or cloud provider (Google Drive, S3, Dropbox). Your agent handles scheduling, monitoring, and restoration.

## Setup

### Install dependencies
```bash
sudo apt install rsync -y
# For cloud backups:
sudo apt install rclone -y
```

## Agent Commands

### Simple backup (local to local)
```bash
# Backup home directory to external drive
rsync -avh --progress /home/USER/ /mnt/backup/home/ --delete --exclude='.cache' --exclude='node_modules' --exclude='.local/share/Trash'
```

### Backup to another machine (SSH)
```bash
rsync -avhz --progress /home/USER/ user@BACKUP_SERVER:/backups/$(hostname)/ --delete
```

### Create a backup script
```bash
cat > ~/backup.sh << 'EOF'
#!/bin/bash
TIMESTAMP=$(date +%Y-%m-%d_%H%M)
BACKUP_DIR="/mnt/backup"
LOG="/var/log/backup.log"

echo "[$TIMESTAMP] Backup starting..." >> $LOG

# Backup home directory
rsync -avh --delete \
  --exclude='.cache' \
  --exclude='node_modules' \
  --exclude='.local/share/Trash' \
  --exclude='*.tmp' \
  /home/ $BACKUP_DIR/home/ 2>&1 >> $LOG

# Backup system configs
rsync -avh /etc/ $BACKUP_DIR/etc/ 2>&1 >> $LOG

echo "[$TIMESTAMP] Backup complete." >> $LOG
EOF
chmod +x ~/backup.sh
```

### Schedule automatic backups
```bash
# Daily at 2am
(crontab -l 2>/dev/null; echo "0 2 * * * /home/USER/backup.sh") | crontab -
```

### Cloud backup with rclone

```bash
# Configure (interactive, one-time)
rclone config

# Backup to Google Drive
rclone sync /home/USER/Documents remote:Backups/Documents --progress

# Backup to S3
rclone sync /home/USER/Documents s3:mybucket/backups/ --progress

# List configured remotes
rclone listremotes
```

### Database backup (PostgreSQL)
```bash
pg_dump DATABASE_NAME > /mnt/backup/db/$(date +%Y%m%d)_database.sql
```

### Database backup (MySQL)
```bash
mysqldump -u root DATABASE_NAME > /mnt/backup/db/$(date +%Y%m%d)_database.sql
```

### Check backup status
```bash
# Last backup time
ls -lht /mnt/backup/ | head -5

# Backup size
du -sh /mnt/backup/*/

# Check cron is set up
crontab -l | grep backup
```

### Compare backup with source
```bash
rsync -avhn --delete /home/USER/ /mnt/backup/home/ | head -20
# -n = dry run, shows what WOULD change
```

### Restore from backup
```bash
# Restore specific file
cp /mnt/backup/home/USER/Documents/important.doc /home/USER/Documents/

# Restore entire directory
rsync -avh /mnt/backup/home/USER/ /home/USER/ --dry-run
# Remove --dry-run when ready to actually restore
```

### Snapshot backup (with versions)
```bash
# Create timestamped snapshots using hard links (space efficient)
DEST="/mnt/backup/snapshots/$(date +%Y-%m-%d)"
LATEST="/mnt/backup/snapshots/latest"
rsync -avh --delete --link-dest=$LATEST /home/USER/ $DEST/
ln -snf $DEST $LATEST
```

### Check backup integrity
```bash
# Compare checksums
find /home/USER/Documents -type f -exec md5sum {} \; | sort > /tmp/source.md5
find /mnt/backup/home/USER/Documents -type f -exec md5sum {} \; | sort > /tmp/backup.md5
diff /tmp/source.md5 /tmp/backup.md5
```

### Clean old backups
```bash
# Remove snapshots older than 30 days
find /mnt/backup/snapshots/ -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
```

## The 3-2-1 Rule

For important data, follow 3-2-1:
- **3** copies of your data
- **2** different storage types (e.g. SSD + external drive)
- **1** off-site copy (cloud or remote server)

## Examples

**User:** "Back up my stuff"
→ Run rsync to backup destination, report what was copied

**User:** "Set up automatic daily backups"
→ Create backup script + cron job, confirm schedule

**User:** "When was my last backup?"
→ Check backup directory timestamps and cron logs

**User:** "I accidentally deleted a file"
→ Find it in the backup, restore it

## Constraints

- rsync --delete removes files from backup that no longer exist in source — be careful
- First backup takes longest (copies everything), subsequent are incremental
- Cloud backups depend on upload speed
- Always test restores — a backup you can't restore is worthless
- Database backups should happen before file backups (consistency)


---
Source attribution: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/backup-manager/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025 skill-library-mcp contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/backup-manager/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Operations
Roles: Backend Developer, DevOps / SRE, IT Operations
Specialties: Backend, DevOps
Tools: MySQL, Rclone, Rsync, PostgreSQL
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: b29db5dc4566c5a06ec702252b3141fb4508a52ec93e274068f7d363d1e1767b
