Complete markdown files cleanup and organization
- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
This commit is contained in:
342
docs/03-deployment/BACKUP_AND_RESTORE.md
Normal file
342
docs/03-deployment/BACKUP_AND_RESTORE.md
Normal file
@@ -0,0 +1,342 @@
|
||||
# Backup and Restore Procedures
|
||||
|
||||
**Last Updated:** 2025-01-20
|
||||
**Document Version:** 1.0
|
||||
**Status:** Active Documentation
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document provides detailed procedures for backing up and restoring Proxmox VMs, containers, and configuration.
|
||||
|
||||
---
|
||||
|
||||
## Backup Strategy
|
||||
|
||||
### Backup Types
|
||||
|
||||
1. **VM/Container Backups:**
|
||||
- Full VM snapshots
|
||||
- Container backups
|
||||
- Application data backups
|
||||
|
||||
2. **Configuration Backups:**
|
||||
- Proxmox host configuration
|
||||
- Network configuration
|
||||
- Storage configuration
|
||||
|
||||
3. **Data Backups:**
|
||||
- Database backups
|
||||
- Application data
|
||||
- Configuration files
|
||||
|
||||
---
|
||||
|
||||
## Backup Procedures
|
||||
|
||||
### Proxmox VM/Container Backups
|
||||
|
||||
#### Using Proxmox Backup Server (PBS)
|
||||
|
||||
**Setup:**
|
||||
|
||||
1. **Install PBS** (if not already installed)
|
||||
2. **Add PBS to Proxmox:**
|
||||
- Datacenter → Storage → Add → Proxmox Backup Server
|
||||
- Enter PBS server details
|
||||
- Test connection
|
||||
|
||||
**Scheduled Backups:**
|
||||
|
||||
1. **Create Backup Job:**
|
||||
- Datacenter → Backup → Add
|
||||
- Select VMs/containers
|
||||
- Set schedule (daily, weekly, etc.)
|
||||
- Choose retention policy
|
||||
|
||||
2. **Backup Options:**
|
||||
- **Mode:** Snapshot (recommended for running VMs)
|
||||
- **Compression:** ZSTD (recommended)
|
||||
- **Storage:** Proxmox Backup Server
|
||||
|
||||
**Manual Backup:**
|
||||
|
||||
```bash
|
||||
# Backup single VM
|
||||
vzdump <vmid> --storage <storage-name> --mode snapshot
|
||||
|
||||
# Backup multiple VMs
|
||||
vzdump 100 101 102 --storage <storage-name> --mode snapshot
|
||||
|
||||
# Backup all VMs
|
||||
vzdump --all --storage <storage-name> --mode snapshot
|
||||
```
|
||||
|
||||
#### Using vzdump (Direct)
|
||||
|
||||
**Backup to Local Storage:**
|
||||
|
||||
```bash
|
||||
# Backup VM to local storage
|
||||
vzdump <vmid> --storage local --mode snapshot --compress zstd
|
||||
|
||||
# Backup with retention
|
||||
vzdump <vmid> --storage local --mode snapshot --maxfiles 7
|
||||
```
|
||||
|
||||
**Backup to NFS:**
|
||||
|
||||
```bash
|
||||
# Add NFS storage first
|
||||
# Datacenter → Storage → Add → NFS
|
||||
|
||||
# Backup to NFS
|
||||
vzdump <vmid> --storage nfs-backup --mode snapshot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Configuration Backups
|
||||
|
||||
#### Proxmox Host Configuration
|
||||
|
||||
**Backup Configuration Files:**
|
||||
|
||||
```bash
|
||||
# Backup Proxmox configuration
|
||||
tar -czf /backup/proxmox-config-$(date +%Y%m%d).tar.gz \
|
||||
/etc/pve/ \
|
||||
/etc/network/interfaces \
|
||||
/etc/hosts \
|
||||
/etc/hostname
|
||||
```
|
||||
|
||||
**Restore Configuration:**
|
||||
|
||||
```bash
|
||||
# Extract configuration
|
||||
tar -xzf /backup/proxmox-config-YYYYMMDD.tar.gz -C /
|
||||
|
||||
# Restart services
|
||||
systemctl restart pve-cluster
|
||||
systemctl restart pve-daemon
|
||||
```
|
||||
|
||||
#### Network Configuration
|
||||
|
||||
**Backup Network Config:**
|
||||
|
||||
```bash
|
||||
# Backup network configuration
|
||||
cp /etc/network/interfaces /backup/interfaces-$(date +%Y%m%d)
|
||||
cp /etc/hosts /backup/hosts-$(date +%Y%m%d)
|
||||
```
|
||||
|
||||
**Version Control:**
|
||||
|
||||
- Store network configuration in Git
|
||||
- Track changes over time
|
||||
- Easy rollback if needed
|
||||
|
||||
---
|
||||
|
||||
### Application Data Backups
|
||||
|
||||
#### Database Backups
|
||||
|
||||
**PostgreSQL:**
|
||||
|
||||
```bash
|
||||
# Backup PostgreSQL database
|
||||
pg_dump -U <user> <database> > /backup/db-$(date +%Y%m%d).sql
|
||||
|
||||
# Restore
|
||||
psql -U <user> <database> < /backup/db-YYYYMMDD.sql
|
||||
```
|
||||
|
||||
**MySQL/MariaDB:**
|
||||
|
||||
```bash
|
||||
# Backup MySQL database
|
||||
mysqldump -u <user> -p <database> > /backup/db-$(date +%Y%m%d).sql
|
||||
|
||||
# Restore
|
||||
mysql -u <user> -p <database> < /backup/db-YYYYMMDD.sql
|
||||
```
|
||||
|
||||
#### Application Files
|
||||
|
||||
```bash
|
||||
# Backup application directory
|
||||
tar -czf /backup/app-$(date +%Y%m%d).tar.gz /path/to/application
|
||||
|
||||
# Restore
|
||||
tar -xzf /backup/app-YYYYMMDD.tar.gz -C /
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Restore Procedures
|
||||
|
||||
### Restore VM/Container from Backup
|
||||
|
||||
#### From Proxmox Backup Server
|
||||
|
||||
**Via Web UI:**
|
||||
|
||||
1. **Select VM/Container:**
|
||||
- Datacenter → Backup → Select backup
|
||||
- Click "Restore"
|
||||
|
||||
2. **Restore Options:**
|
||||
- Select target storage
|
||||
- Choose new VMID (or keep original)
|
||||
- Set network configuration
|
||||
|
||||
3. **Start Restore:**
|
||||
- Click "Restore"
|
||||
- Monitor progress
|
||||
|
||||
**Via Command Line:**
|
||||
|
||||
```bash
|
||||
# Restore from PBS
|
||||
vzdump restore <backup-id> <vmid> --storage <storage>
|
||||
|
||||
# Restore with new VMID
|
||||
vzdump restore <backup-id> <new-vmid> --storage <storage>
|
||||
```
|
||||
|
||||
#### From vzdump Backup
|
||||
|
||||
```bash
|
||||
# Restore from vzdump file
|
||||
vzdump restore <backup-file.vma.gz> <vmid> --storage <storage>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Restore Configuration
|
||||
|
||||
#### Restore Proxmox Configuration
|
||||
|
||||
```bash
|
||||
# Stop Proxmox services
|
||||
systemctl stop pve-cluster
|
||||
systemctl stop pve-daemon
|
||||
|
||||
# Restore configuration
|
||||
tar -xzf /backup/proxmox-config-YYYYMMDD.tar.gz -C /
|
||||
|
||||
# Start services
|
||||
systemctl start pve-cluster
|
||||
systemctl start pve-daemon
|
||||
```
|
||||
|
||||
#### Restore Network Configuration
|
||||
|
||||
```bash
|
||||
# Restore network config
|
||||
cp /backup/interfaces-YYYYMMDD /etc/network/interfaces
|
||||
cp /backup/hosts-YYYYMMDD /etc/hosts
|
||||
|
||||
# Restart networking
|
||||
systemctl restart networking
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Backup Verification
|
||||
|
||||
### Verify Backup Integrity
|
||||
|
||||
**Check Backup Files:**
|
||||
|
||||
```bash
|
||||
# List backups
|
||||
vzdump list --storage <storage>
|
||||
|
||||
# Verify backup
|
||||
vzdump verify <backup-id>
|
||||
```
|
||||
|
||||
**Test Restore:**
|
||||
|
||||
- Monthly restore test
|
||||
- Verify VM/container starts
|
||||
- Test application functionality
|
||||
- Document results
|
||||
|
||||
---
|
||||
|
||||
## Backup Retention Policy
|
||||
|
||||
### Retention Schedule
|
||||
|
||||
- **Daily Backups:** Keep 7 days
|
||||
- **Weekly Backups:** Keep 4 weeks
|
||||
- **Monthly Backups:** Keep 12 months
|
||||
- **Yearly Backups:** Keep 7 years
|
||||
|
||||
### Cleanup Old Backups
|
||||
|
||||
```bash
|
||||
# Remove backups older than retention period
|
||||
vzdump prune --storage <storage> --keep-last 7
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Backup Monitoring
|
||||
|
||||
### Backup Status Monitoring
|
||||
|
||||
**Check Backup Jobs:**
|
||||
|
||||
- Datacenter → Backup → Jobs
|
||||
- Review last backup time
|
||||
- Check for errors
|
||||
|
||||
**Automated Monitoring:**
|
||||
|
||||
- Set up alerts for failed backups
|
||||
- Monitor backup storage usage
|
||||
- Track backup completion times
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Test Restores Regularly:**
|
||||
- Monthly restore tests
|
||||
- Verify data integrity
|
||||
- Document results
|
||||
|
||||
2. **Multiple Backup Locations:**
|
||||
- Local backups (fast restore)
|
||||
- Remote backups (disaster recovery)
|
||||
- Offsite backups (complete protection)
|
||||
|
||||
3. **Document Backup Procedures:**
|
||||
- Keep procedures up to date
|
||||
- Document restore procedures
|
||||
- Maintain backup inventory
|
||||
|
||||
4. **Monitor Backup Storage:**
|
||||
- Check available space regularly
|
||||
- Clean up old backups
|
||||
- Plan for storage growth
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- **[DISASTER_RECOVERY.md](DISASTER_RECOVERY.md)** - Disaster recovery procedures
|
||||
- **[OPERATIONAL_RUNBOOKS.md](OPERATIONAL_RUNBOOKS.md)** - Operational procedures
|
||||
- **[../../04-configuration/SECRETS_KEYS_CONFIGURATION.md](../../04-configuration/SECRETS_KEYS_CONFIGURATION.md)** - Secrets backup
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2025-01-20
|
||||
**Review Cycle:** Monthly
|
||||
Reference in New Issue
Block a user