Skip to main content

UniFi MCP Server - Disaster Recovery Guide

Last Updated: 2025-11-28 Version: 0.2.0 This guide provides comprehensive instructions for backup, restore, and disaster recovery operations using the UniFi MCP Server.

Table of Contents

  1. Overview
  2. Backup Types
  3. Backup Best Practices
  4. Creating Backups
  5. Downloading Backups
  6. Validating Backups
  7. Restoring from Backup
  8. Disaster Recovery Scenarios
  9. Cross-Controller Migration
  10. Troubleshooting

Overview

The UniFi MCP Server provides enterprise-grade backup and restore capabilities with built-in safety mechanisms:
  • ✅ Automatic Pre-Restore Backups - Safety backup created before every restore
  • ✅ Mandatory Confirmation - All destructive operations require explicit confirmation
  • ✅ Dry-Run Mode - Test operations without execution
  • ✅ Backup Validation - Integrity checks before restore
  • ✅ Audit Logging - Complete audit trail of all operations
  • ✅ SHA-256 Checksums - File integrity verification

Backup Types

Network Backup (.unf files)

  • Contents: Network settings and device configurations only
  • Size: Typically 5-10 MB
  • Creation Time: 1-2 minutes
  • Use Cases:
    • Daily automated backups
    • Quick configuration snapshots
    • Network-only changes
  • Restores: Networks, VLANs, firewall rules, WiFi configs, device settings

System Backup (.unifi files)

  • Contents: Complete OS, application, and device configurations
  • Size: Typically 50-100 MB
  • Creation Time: 5-10 minutes
  • Use Cases:
    • Before major upgrades
    • Complete system snapshots
    • Controller migrations
  • Restores: Everything including OS settings, certificates, user accounts
Recommendation: Use network backups for regular snapshots, system backups for major changes.

Backup Best Practices

Retention Strategy

3-2-1 Backup Rule:
  • 3 copies of your data (original + 2 backups)
  • 2 different storage media (local + cloud)
  • 1 offsite backup
Recommended Schedule:

Before Major Operations

Always create a backup before:
  • ✅ Firmware upgrades
  • ✅ Network reconfigurations
  • ✅ Firewall rule changes
  • ✅ Adding/removing devices
  • ✅ Controller migrations
  • ✅ Configuration imports

Storage Recommendations

  • Local Storage: Keep 3-5 recent backups on controller
  • Network Storage: Archive to NAS weekly
  • Cloud Storage: Enable cloud backup for critical sites
  • Off-Site: Monthly backup to external location

Creating Backups

Network Backup (Daily)

System Backup (Monthly)

Dry-Run Mode

Test backup creation without executing:

Downloading Backups

List Available Backups

Download to Local Storage

Automated Backup Script


Validating Backups

ALWAYS validate backups before restore operations.

Restoring from Backup

Pre-Restore Checklist

Before restoring a backup:
  • Validate the backup file using validate_backup
  • Notify users of potential downtime
  • Document current state (screenshots, configs)
  • Verify backup age - is it recent enough?
  • Check controller version compatibility
  • Ensure network access for download after restart
  • Enable pre-restore backup (automatic safety backup)

Safe Restore Procedure

Emergency Rollback

If restore fails or causes issues:

Disaster Recovery Scenarios

Scenario 1: Controller Hardware Failure

Situation: Controller hardware fails, need to recover to new hardware. Recovery Steps:
  1. Install new controller with same UniFi OS version
  2. Complete initial setup (don’t configure anything)
  3. Restore from last system backup:
  4. Wait for controller restart (5-10 minutes)
  5. Verify all devices reconnect
  6. Test critical functionality
Recovery Time: 30-60 minutes

Scenario 2: Bad Configuration Change

Situation: Configuration change breaks network, need to rollback. Recovery Steps:
  1. List recent backups:
  2. Validate backup:
  3. Restore with safety backup:
Recovery Time: 5-15 minutes

Scenario 3: Firmware Upgrade Failure

Situation: Firmware upgrade causes issues, need to revert. Recovery Steps:
  1. Use pre-upgrade backup (created before upgrade)
  2. Restore and downgrade:
  3. Wait for downgrade (may take 10-15 minutes)
  4. Verify device functionality
Recovery Time: 20-30 minutes

Scenario 4: Accidental Deletion

Situation: Critical firewall rule or network accidentally deleted. Recovery Steps:
  1. Find most recent backup (hourly/daily)
  2. Restore specific backup:
Recovery Time: 5-10 minutes

Cross-Controller Migration

Migrating to New Controller

Scenario: Moving from old controller to new hardware or location. Steps:
  1. Create final backup on old controller:
  2. Download backup file:
  3. Setup new controller:
    • Install UniFi OS (same or newer version)
    • Complete initial setup (minimal config)
    • Connect to MCP Server
  4. Upload and restore backup on new controller
    • Copy backup file to new controller
    • Restore using MCP tools
  5. Inform devices of new controller IP:
    • Option A: DHCP Option 43
    • Option B: DNS override for unifi
    • Option C: Manual SSH adoption
  6. Monitor device adoption (may take 5-30 minutes)

Migration Checklist

  • Verify UniFi OS versions compatible
  • Document current device count
  • Backup SSL certificates
  • Note custom port configurations
  • Export any external integrations
  • Update DNS/DHCP for new controller IP
  • Test with 1-2 devices first
  • Keep old controller running during migration
  • Verify all devices adopted
  • Test all critical functionality
  • Update documentation with new controller info

Troubleshooting

Backup Creation Fails

Symptoms: Backup operation returns error Solutions:
  1. Check disk space: df -h
  2. Verify controller health: Check system logs
  3. Retry with dry-run mode first
  4. Try network backup instead of system backup
  5. Check retention days value (must be -1 or >0)

Restore Fails to Complete

Symptoms: Restore initiated but doesn’t finish Solutions:
  1. Wait 10-15 minutes (controller restart takes time)
  2. Check controller accessibility
  3. Review system logs for errors
  4. If hung, power cycle controller
  5. Restore again from pre-restore backup

Pre-Restore Backup Not Created

Symptoms: Restore proceeds without safety backup Solutions:
  1. Ensure create_pre_restore_backup: True
  2. Check disk space for backup
  3. Manually create backup before restore
  4. Document current config as fallback

Backup File Corrupted

Symptoms: Validation fails with checksum errors Solutions:
  1. Re-download backup file
  2. Use older backup
  3. Check backup storage for issues
  4. Verify backup was fully written
  5. Check for disk errors on backup storage

Devices Don’t Reconnect After Restore

Symptoms: Devices show offline after restore Solutions:
  1. Wait 5-10 minutes for auto-reconnect
  2. Power cycle devices
  3. Check network connectivity
  4. Verify controller IP accessible
  5. Force adoption via SSH if needed
  6. Check if firewall rules blocking management

Version Mismatch Warning

Symptoms: Backup from different UniFi version Solutions:
  1. Check compatibility: backup version vs. current version
  2. Upgrade/downgrade controller if needed
  3. Review changelog for breaking changes
  4. Test restore in lab environment first
  5. Consider manual configuration instead

Support

For backup/restore issues:
Last Updated: 2025-11-28 Version: 0.2.0 Maintained By: UniFi MCP Server Team
Last modified on October 24, 2026