{"slug":"vps-snapshots","title":"VPS Snapshots","description":"Complete guide to creating, managing, and restoring VPS snapshots for backup and cloning purposes.","section":"Features","url":"https://docs.danubedata.ro/vps-snapshots","markdown_url":"https://docs.danubedata.ro/vps-snapshots.md","breadcrumbs":[{"title":"Features","slug":null},{"title":"VPS Instances","slug":"vps-overview"},{"title":"Snapshots","slug":"vps-snapshots"}],"headings":[{"level":1,"title":"VPS Snapshots","id":"vps-snapshots"},{"level":2,"title":"What are Snapshots?","id":"what-are-snapshots"},{"level":3,"title":"Snapshots vs Backups","id":"snapshots-vs-backups"},{"level":2,"title":"Why Use Snapshots?","id":"why-use-snapshots"},{"level":3,"title":"Backup Before Changes","id":"backup-before-changes"},{"level":3,"title":"Disaster Recovery","id":"disaster-recovery"},{"level":3,"title":"Cloning & Scaling","id":"cloning-scaling"},{"level":3,"title":"Migration","id":"migration"},{"level":2,"title":"Automated Snapshots","id":"automated-snapshots"},{"level":3,"title":"Offsite Backups (3-2-1)","id":"offsite-backups-3-2-1"},{"level":2,"title":"Creating Snapshots","id":"creating-snapshots"},{"level":3,"title":"Via Dashboard","id":"via-dashboard"},{"level":3,"title":"Snapshot Naming Best Practices","id":"snapshot-naming-best-practices"},{"level":3,"title":"Naming Convention","id":"naming-convention"},{"level":2,"title":"Snapshot Details","id":"snapshot-details"},{"level":3,"title":"What's Included","id":"whats-included"},{"level":3,"title":"What's NOT Included","id":"whats-not-included"},{"level":3,"title":"Best Practices Before Snapshot","id":"best-practices-before-snapshot"},{"level":2,"title":"Managing Snapshots","id":"managing-snapshots"},{"level":3,"title":"View Snapshots","id":"view-snapshots"},{"level":3,"title":"Snapshot Statuses","id":"snapshot-statuses"},{"level":3,"title":"Delete Snapshot","id":"delete-snapshot"},{"level":2,"title":"Restoring from Snapshots","id":"restoring-from-snapshots"},{"level":3,"title":"Restore to Existing Instance","id":"restore-to-existing-instance"},{"level":3,"title":"Create New Instance from Snapshot (Clone)","id":"create-new-instance-from-snapshot-clone"},{"level":2,"title":"Centralized Snapshots Page","id":"centralized-snapshots-page"},{"level":3,"title":"After Restore","id":"after-restore"},{"level":2,"title":"Snapshot Use Cases","id":"snapshot-use-cases"},{"level":3,"title":"Use Case 1: Safe System Updates","id":"use-case-1-safe-system-updates"},{"level":3,"title":"Use Case 2: Application Deployment","id":"use-case-2-application-deployment"},{"level":3,"title":"Use Case 3: Development Environment","id":"use-case-3-development-environment"},{"level":3,"title":"Use Case 4: Horizontal Scaling","id":"use-case-4-horizontal-scaling"},{"level":3,"title":"Use Case 5: Migration","id":"use-case-5-migration"},{"level":2,"title":"Automation with API","id":"automation-with-api"},{"level":3,"title":"Create Snapshot","id":"create-snapshot"},{"level":3,"title":"List Snapshots","id":"list-snapshots"},{"level":3,"title":"Automated Daily Backup Script","id":"automated-daily-backup-script"},{"level":2,"title":"Snapshot Pricing","id":"snapshot-pricing"},{"level":3,"title":"Storage Costs","id":"storage-costs"},{"level":3,"title":"Cost Examples","id":"cost-examples"},{"level":3,"title":"Cost Optimization","id":"cost-optimization"},{"level":2,"title":"Best Practices","id":"best-practices"},{"level":3,"title":"Regular Snapshots","id":"regular-snapshots"},{"level":3,"title":"Naming Strategy","id":"naming-strategy"},{"level":3,"title":"Testing Restores","id":"testing-restores"},{"level":3,"title":"Documentation","id":"documentation"},{"level":2,"title":"Troubleshooting","id":"troubleshooting"},{"level":3,"title":"Snapshot Creation Fails","id":"snapshot-creation-fails"},{"level":3,"title":"Restore Fails","id":"restore-fails"},{"level":3,"title":"Slow Snapshot Creation","id":"slow-snapshot-creation"},{"level":2,"title":"Limitations","id":"limitations"},{"level":3,"title":"Size Limits","id":"size-limits"},{"level":3,"title":"Quantity Limits","id":"quantity-limits"},{"level":3,"title":"Region","id":"region"},{"level":3,"title":"Time Limits","id":"time-limits"},{"level":2,"title":"Security Considerations","id":"security-considerations"},{"level":3,"title":"Data Protection","id":"data-protection"},{"level":3,"title":"Sensitive Data","id":"sensitive-data"},{"level":2,"title":"Next Steps","id":"next-steps"}],"format":"markdown","word_count":2030,"content":"# VPS Snapshots\n\nComplete guide to creating, managing, and restoring VPS snapshots for backup and cloning purposes.\n\n## What are Snapshots?\n\nSnapshots are point-in-time copies of your VPS instance, including:\n\n- **Operating system** and all files\n- **Applications** and configurations\n- **Data** stored on the instance\n- **Complete system state** at capture time\n\n### Snapshots vs Backups\n\n| Feature | Snapshots | Traditional Backups |\n|---------|-----------|-------------------|\n| **Speed** | Very fast (minutes) | Slower (hours) |\n| **Downtime** | None required | May require downtime |\n| **Restore** | Complete system restore | File-level restore |\n| **Use Case** | System cloning, migrations | Data recovery |\n| **Storage** | Block-level | File-level |\n\n## Why Use Snapshots?\n\n### Backup Before Changes\nTake a snapshot before:\n- System updates\n- Application upgrades\n- Configuration changes\n- Installing new software\n- Database migrations\n\n### Disaster Recovery\n- Quick recovery from failures\n- Protection against mistakes\n- Rollback bad deployments\n- Restore corrupted systems\n\n### Cloning & Scaling\n- Create identical instances\n- Scale horizontally\n- Test environments\n- Development copies\n\n### Migration\n- Move to a different host\n- Upgrade instance size\n- Change configurations\n- Platform migration\n\n## Automated Snapshots\n\nEvery running VPS is snapshotted **automatically on a daily schedule** — no setup required. Automated snapshots:\n\n- Run only while the instance is **running**, so you're never charged for wasted backups of stopped instances\n- Are kept for a rolling **retention window** and cleaned up automatically once they age out\n- Appear alongside your manual snapshots (tagged **automated**) and can be restored or cloned the same way\n- Are additionally copied **offsite** for 3-2-1-compliant backups (see below)\n\nYou can still take **manual** snapshots anytime before risky changes — those are kept until you delete them.\n\n### Offsite Backups (3-2-1)\n\nBeyond the primary snapshot stored with your instance, snapshots are exported to **offsite storage**, giving you a 3-2-1-compliant backup — multiple copies, on separate storage, one off-site. That offsite export is also what makes **cloning a snapshot into a brand-new instance** possible. If an export fails, you can retry it from the Snapshots page.\n\n## Creating Snapshots\n\n### Via Dashboard\n\n1. **Navigate** to **Pods** (VPS)\n2. **Click** on your instance name\n3. **Go to** **Snapshots** tab\n4. **Click** **Create Snapshot**\n5. **Enter** snapshot details:\n   - **Name**: Descriptive name\n   - **Description**: Purpose and context\n6. **Click** **Create**\n\n**Creation Time**: 2-5 minutes depending on disk size\n\n### Snapshot Naming Best Practices\n\n**Good Names**:\n```\npre-update-2024-10-11\nbefore-nginx-upgrade\nproduction-backup-daily\nstaging-clone-v2\nmigration-source\n```\n\n**Poor Names**:\n```\nsnapshot1\nbackup\ntest\nmy-snapshot\n```\n\n### Naming Convention\n\n```\n[environment]-[purpose]-[date]\nprod-pre-deploy-2024-10-11\nstaging-backup-2024-10-11\ndev-clone-2024-10-11\n```\n\n## Snapshot Details\n\n### What's Included\n\n✅ **Operating System**: All OS files  \n✅ **Applications**: Installed software  \n✅ **Configurations**: All config files  \n✅ **Data**: Application data, databases  \n✅ **Users**: User accounts and permissions  \n✅ **Logs**: System and application logs  \n\n### What's NOT Included\n\n❌ **RAM Contents**: Active memory state  \n❌ **Network Connections**: Active connections  \n❌ **Temporary Files**: /tmp contents may vary  \n❌ **Process State**: Running processes  \n\n### Best Practices Before Snapshot\n\n1. **Stop Services** (optional but recommended):\n   ```bash\n   # Stop database\n   sudo systemctl stop mysql\n   \n   # Stop application\n   sudo systemctl stop nginx\n   ```\n\n2. **Flush Caches**:\n   ```bash\n   # Sync filesystem\n   sync\n   \n   # Drop caches\n   sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'\n   ```\n\n3. **Database Backup**:\n   ```bash\n   # MySQL\n   mysqldump -u root -p --all-databases > backup.sql\n   \n   # PostgreSQL\n   pg_dumpall > backup.sql\n   ```\n\n4. **Document State**:\n   - Running services\n   - Important processes\n   - Configuration details\n\n## Managing Snapshots\n\n### View Snapshots\n\n1. Go to VPS instance page\n2. Click **Snapshots** tab\n3. See all snapshots:\n   - Name and description\n   - Creation date\n   - Size\n   - Status\n\n### Snapshot Statuses\n\n- **Creating**: Snapshot in progress\n- **Available**: Ready to use\n- **Restoring**: Being restored\n- **Deleting**: Being removed\n- **Error**: Failed creation/restore\n\nSnapshot status and progress update **live** on the page — no refresh needed — including offsite export progress.\n\n### Delete Snapshot\n\n**Warning**: Deletion is permanent!\n\n1. Go to **Snapshots** tab\n2. Click **Delete** next to snapshot\n3. Confirm deletion\n4. Snapshot removed immediately\n\n**Note**: You're charged for snapshot storage until deleted.\n\n## Restoring from Snapshots\n\n### Restore to Existing Instance\n\n**Warning**: This will overwrite your current instance!\n\nYou can restore from either the per-instance **Snapshots** tab or the centralized **Snapshots** page at `/snapshots`.\n\n1. **Backup current data** if needed\n2. Go to **Snapshots** tab on the instance page, or navigate to **Snapshots** in the sidebar\n3. Click the **Restore** button (rotate icon) next to the snapshot\n4. Confirm the action in the warning dialog\n5. Wait 5-10 minutes\n\n**What Happens**:\n- The VM is stopped if running\n- Disk data is replaced with the snapshot contents\n- The VM is restarted automatically\n- Any data created after the snapshot will be lost\n\n### Create New Instance from Snapshot (Clone)\n\n**Safer option** - doesn't affect the existing instance.\n\nCloning a VPS from a snapshot uses the **export-based clone** workflow, which requires an offsite backup to be completed first (3-2-1 compliant).\n\n**Prerequisites**:\n- Snapshot status must be **Ready**\n- Export (offsite backup) must be **Completed**\n- No other clone operation in progress for this snapshot\n\n**Steps**:\n1. Go to the **Snapshots** tab on the instance page, or navigate to **Snapshots** in the sidebar\n2. Click the **Clone** button (copy icon) next to an eligible snapshot\n3. Enter a **name** for the new VPS instance (lowercase letters, numbers, and hyphens; 3-32 characters)\n4. Click **Clone Instance**\n\n**Clone Process**:\nThe clone operation downloads the snapshot data from offsite storage, decompresses it, and deploys a new VPS. You can track progress through these stages:\n- **Preparing** - Setting up the clone operation\n- **Downloading** - Retrieving snapshot data from S3 storage\n- **Decompressing** - Extracting the disk image\n- **Importing** - Creating the new disk volume\n- **Deploying** - Launching the new VPS instance\n\n**What the New VPS Inherits**:\n- Operating system and all files from the snapshot\n- Disk size and resource profile from the original instance\n\n**What's New**:\n- New IPv4 (and optionally IPv6) address\n- New MAC address\n- New instance name\n\n**Duration**: 10-30 minutes depending on disk size.\n\n## Centralized Snapshots Page\n\nNavigate to **Snapshots** in the sidebar to access the centralized snapshots page at `/snapshots`. This page shows all snapshot types (VPS, Cache, Database) in a single view.\n\n**Features**:\n- **Filter** by instance type (VPS, Cache, Database), status, and automated/manual\n- **Search** by instance name\n- **Restore** any snapshot to its parent instance\n- **Clone** to create a new instance from a snapshot\n- **Delete** snapshots that are no longer needed\n- **Retry** failed offsite backups\n\n### After Restore\n\n1. **Verify System**:\n   ```bash\n   # Check system status\n   uptime\n   df -h\n   free -h\n   \n   # Verify services\n   sudo systemctl status nginx\n   sudo systemctl status mysql\n   ```\n\n2. **Update Configurations**:\n   - Update IP addresses\n   - Update DNS records\n   - Update environment variables\n   - Update API endpoints\n\n3. **Start Services**:\n   ```bash\n   sudo systemctl start nginx\n   sudo systemctl start mysql\n   sudo systemctl start your-app\n   ```\n\n## Snapshot Use Cases\n\n### Use Case 1: Safe System Updates\n\n**Scenario**: Ubuntu system update\n\n```bash\n# 1. Create snapshot via dashboard\n# Name: \"pre-update-2024-10-11\"\n\n# 2. Perform update\nsudo apt update\nsudo apt upgrade -y\nsudo apt dist-upgrade -y\n\n# 3. Test system\n# If problems occur, restore from snapshot\n# If all good, keep running\n\n# 4. Delete old snapshot after confirmed working\n```\n\n### Use Case 2: Application Deployment\n\n**Scenario**: Deploy new application version\n\n```bash\n# 1. Create snapshot\n# Name: \"pre-deploy-v2.0\"\n\n# 2. Deploy new version\ngit pull origin main\nnpm install\nnpm run build\nsudo systemctl restart app\n\n# 3. Test thoroughly\n# If issues, restore snapshot\n# If successful, keep and delete old snapshot\n```\n\n### Use Case 3: Development Environment\n\n**Scenario**: Create dev copy of production\n\n1. **Create snapshot** of production instance\n2. **Restore** to new instance\n3. **Rename** new instance to \"dev-environment\"\n4. **Update configurations**:\n   - Change database credentials\n   - Update API keys (use test keys)\n   - Disable production integrations\n   - Update application URLs\n\n### Use Case 4: Horizontal Scaling\n\n**Scenario**: Add more web servers\n\n1. **Prepare** one server perfectly:\n   - Install all software\n   - Configure everything\n   - Test thoroughly\n\n2. **Create snapshot** \"web-server-template\"\n\n3. **Create multiple instances** from snapshot:\n   - web-server-01\n   - web-server-02\n   - web-server-03\n\n4. **Configure load balancer** to distribute traffic\n\n### Use Case 5: Migration\n\n**Scenario**: Move to larger instance\n\n1. **Create snapshot** of current instance\n2. **Create new instance** from snapshot\n   - Choose a larger profile\n3. **Test** new instance\n4. **Update DNS** to point to new instance\n5. **Delete** old instance\n6. **Delete** old snapshot\n\n## Automation with API\n\n### Create Snapshot\n\n```python\nimport requests\n\nheaders = {\n    \"Authorization\": \"Bearer YOUR_TOKEN\",\n    \"Content-Type\": \"application/json\"\n}\n\ndata = {\n    \"name\": f\"auto-backup-{datetime.now().strftime('%Y-%m-%d')}\",\n    \"description\": \"Automated daily backup\"\n}\n\nresponse = requests.post(\n    \"https://api.danubedata.ro/v1/vps/vps-abc123/snapshots\",\n    headers=headers,\n    json=data\n)\n\nsnapshot = response.json()\nprint(f\"Snapshot created: {snapshot['data']['id']}\")\n```\n\n### List Snapshots\n\n```python\nresponse = requests.get(\n    \"https://api.danubedata.ro/v1/vps/vps-abc123/snapshots\",\n    headers=headers\n)\n\nsnapshots = response.json()[\"data\"]\nfor snap in snapshots:\n    print(f\"{snap['name']}: {snap['created_at']}\")\n```\n\n### Automated Daily Backup Script\n\n```python\n#!/usr/bin/env python3\nimport requests\nimport os\nfrom datetime import datetime, timedelta\n\nAPI_TOKEN = os.environ['DANUBEDATA_API_TOKEN']\nVPS_ID = \"vps-abc123\"\nRETENTION_DAYS = 7\n\nheaders = {\n    \"Authorization\": f\"Bearer {API_TOKEN}\",\n    \"Content-Type\": \"application/json\"\n}\n\n# Create new snapshot\ndata = {\n    \"name\": f\"daily-backup-{datetime.now().strftime('%Y-%m-%d')}\",\n    \"description\": f\"Automated backup - {datetime.now()}\"\n}\n\nresponse = requests.post(\n    f\"https://api.danubedata.ro/v1/vps/{VPS_ID}/snapshots\",\n    headers=headers,\n    json=data\n)\n\nif response.status_code == 201:\n    print(f\"Snapshot created successfully\")\nelse:\n    print(f\"Error: {response.json()}\")\n    exit(1)\n\n# Delete old snapshots\nresponse = requests.get(\n    f\"https://api.danubedata.ro/v1/vps/{VPS_ID}/snapshots\",\n    headers=headers\n)\n\nsnapshots = response.json()[\"data\"]\ncutoff_date = datetime.now() - timedelta(days=RETENTION_DAYS)\n\nfor snap in snapshots:\n    snap_date = datetime.fromisoformat(snap['created_at'].replace('Z', '+00:00'))\n    if snap_date < cutoff_date and snap['name'].startswith('daily-backup'):\n        print(f\"Deleting old snapshot: {snap['name']}\")\n        requests.delete(\n            f\"https://api.danubedata.ro/v1/vps/{VPS_ID}/snapshots/{snap['id']}\",\n            headers=headers\n        )\n```\n\n**Schedule with Cron**:\n```bash\n# Add to crontab\n0 2 * * * /usr/local/bin/backup-vps.py\n```\n\n## Snapshot Pricing\n\n### Storage Costs\n\n- **Price**: €0.073 per GB per month\n- **Billed**: Hourly (prorated)\n- **Size**: Based on used disk space\n\n### Cost Examples\n\n| Instance Size | Used Space | Monthly Cost |\n|---------------|------------|--------------|\n| 20 GB disk | 10 GB used | €0.73 |\n| 40 GB disk | 25 GB used | €1.83 |\n| 80 GB disk | 40 GB used | €2.92 |\n| 160 GB disk | 80 GB used | €5.84 |\n\n### Cost Optimization\n\n1. **Delete old snapshots** regularly\n2. **Clean disk** before snapshot:\n   ```bash\n   sudo apt clean\n   sudo journalctl --vacuum-time=7d\n   docker system prune -a\n   ```\n3. **Keep only necessary snapshots**\n4. **Use compression** before snapshot\n5. **Remove unused files**\n\n## Best Practices\n\n### Regular Snapshots\n\n**Daily Production**:\n- Before any changes\n- Automated nightly backups\n- Keep 7 days\n\n**Weekly Development**:\n- End of sprint\n- Before major updates\n- Keep 4 weeks\n\n**Pre-Change Always**:\n- Before system updates\n- Before deployments\n- Before configuration changes\n\n### Naming Strategy\n\n```\n[frequency]-[environment]-[date]\ndaily-prod-2024-10-11\nweekly-staging-2024-10-11\npre-deploy-prod-2024-10-11\n```\n\n### Testing Restores\n\n**Monthly**: Test restore process\n1. Create test instance from snapshot\n2. Verify all services work\n3. Confirm data integrity\n4. Document restore time\n5. Delete test instance\n\n### Documentation\n\nKeep a snapshot log:\n```\nDate       | Name              | Purpose           | Retention\n-----------|-------------------|-------------------|----------\n2024-10-11 | pre-update-v2     | Before Ubuntu 24  | 30 days\n2024-10-11 | daily-prod        | Daily backup      | 7 days\n2024-10-10 | pre-deploy-api    | Before API v3     | 14 days\n```\n\n## Troubleshooting\n\n### Snapshot Creation Fails\n\n**Check**:\n1. Disk space available\n2. Instance is running\n3. No other operations in progress\n4. Account limits not exceeded\n\n**Solution**:\n```bash\n# Free up space\nsudo apt clean\nsudo journalctl --vacuum-time=7d\nrm -rf /tmp/*\n\n# Check disk\ndf -h\n```\n\n### Restore Fails\n\n**Possible Causes**:\n- Insufficient resources\n- Snapshot corrupted\n- Network issues\n\n**Solution**:\n1. Try again\n2. Contact support\n3. Use different snapshot\n4. Check system logs\n\n### Slow Snapshot Creation\n\n**Factors**:\n- Disk size\n- Data amount\n- Disk activity\n- Network speed\n\n**Optimization**:\n- Stop services temporarily\n- Reduce disk I/O\n- Schedule during low-traffic\n- Clean disk before snapshot\n\n## Limitations\n\n### Size Limits\n- Maximum snapshot size: Based on disk size\n- Storage per account: Check account limits\n\n### Quantity Limits\n- Snapshots per instance: 50 (default)\n- Request increase if needed\n\n### Region\n- Snapshots are stored redundantly in the same region (Falkenstein, Germany)\n- For offsite copies, download or export the snapshot\n\n### Time Limits\n- Creation time: 2-10 minutes\n- Restore time: 5-15 minutes\n- Depends on size\n\n## Security Considerations\n\n### Data Protection\n\n✅ **Encrypted at Rest**: All snapshots encrypted  \n✅ **Access Control**: Only account members can access  \n✅ **Isolated Storage**: Separate from instance storage  \n✅ **Backup Redundancy**: Multiple copies maintained  \n\n### Sensitive Data\n\n**Before Snapshot**:\n1. Review for sensitive data\n2. Remove temporary secrets\n3. Clear logs with sensitive info\n4. Document included credentials\n\n**After Restore**:\n1. Rotate credentials\n2. Update API keys\n3. Change passwords\n4. Verify access controls\n\n## Next Steps\n\n- [VPS Management](https://docs.danubedata.ro/vps-managing)\n- [VPS SSH Access](https://docs.danubedata.ro/vps-ssh)\n- [Backup Strategies](https://docs.danubedata.ro/databases-backups)\n- [Disaster Recovery](https://docs.danubedata.ro/vps-managing)\n\nNeed help with snapshots? Contact support through the dashboard.\n\n","prev":{"title":"SSH Access","slug":"vps-ssh","url":"https://docs.danubedata.ro/vps-ssh","markdown_url":"https://docs.danubedata.ro/vps-ssh.md","json_url":"https://docs.danubedata.ro/vps-ssh.json"},"next":{"title":"Databases","slug":"databases-overview","url":"https://docs.danubedata.ro/databases-overview","markdown_url":"https://docs.danubedata.ro/databases-overview.md","json_url":"https://docs.danubedata.ro/databases-overview.json"},"index_url":"https://docs.danubedata.ro/index.json"}