# Backup & Restore

# Backup & Restore

Protecting your server data is critical. The KyuubiSoft Panel provides comprehensive backup functionality.

## Backup Overview

Backups include:
- World data (all worlds)
- Server configuration
- Player data
- Plugin configurations

Backups are stored as compressed `.tar.gz` archives.

## Creating Backups

### Manual Backup

1. Go to **Backups**
2. Click **Create Backup**
3. Wait for completion
4. Backup appears in list

### Scheduled Backups

Set up automatic backups:

1. Go to **Scheduler**
2. Click **Add Task**
3. Select **Backup** type
4. Configure schedule:
   ```
   # Daily at 4 AM
   0 4 * * *

   # Every 6 hours
   0 */6 * * *
   ```
5. Save task

### Pre-Update Backups

Configure automatic backup before updates:

1. Go to **Settings** → **Updates**
2. Enable **Backup Before Update**
3. Enable **Backup Config Before Update**

## Backup Storage

### Location

Backups are stored in:
```
/opt/hytale/backups/
```

### Naming Convention

```
hytale_backup_YYYYMMDD_HHMMSS.tar.gz
hytale_manual_YYYYMMDD_HHMMSS.tar.gz
```

### Storage Management

- Monitor backup folder size
- Old backups are NOT auto-deleted
- Manually remove old backups or set up cleanup

## Restoring Backups

### From Panel

1. Go to **Backups**
2. Find the backup to restore
3. Click **Restore**
4. Confirm the action
5. Server restarts automatically

:::warning
Restoring overwrites current server data. Create a backup of current state first.
:::

### Manual Restore

```bash
# Stop the server
docker-compose stop hytale

# Extract backup
cd /opt/hytale/data
tar -xzf /opt/hytale/backups/hytale_backup_20260130_040000.tar.gz

# Start the server
docker-compose start hytale
```

## Downloading Backups

Download backups for off-site storage:

1. Go to **Backups**
2. Click **Download** on desired backup
3. Save the `.tar.gz` file

## Backup Best Practices

### Frequency

| Server Type | Recommended |
|-------------|-------------|
| Development | Daily |
| Small Server | Every 6 hours |
| Large Server | Every 2-4 hours |
| Before Updates | Always |

### Retention

Keep backups for:
- Last 7 days: All backups
- Last 30 days: Daily backups
- Older: Weekly backups

### Off-Site Storage

Don't keep all backups on the same server:
- Download important backups
- Use cloud storage (S3, Google Drive)
- Set up automated sync

### Testing Restores

Regularly test your backups:
1. Create a test environment
2. Restore a backup
3. Verify data integrity
4. Document the process

## Disaster Recovery

### Complete Data Loss

If all data is lost:

1. Install fresh KyuubiSoft Panel
2. Configure same environment variables
3. Restore from off-site backup
4. Verify server functionality

### Corrupted World

If world data is corrupted:

1. Stop the server
2. Identify last known good backup
3. Restore that backup
4. Accept data loss since backup

### Configuration Issues

If configuration is broken:

1. Restore only config files from backup
2. Or manually fix configuration
3. Keep config backups separate

## Backup Contents

### What's Included

```
backup/
├── worlds/           # All world data
├── config.json       # Server config
├── panel-config.json # Panel settings
├── players/          # Player data
├── whitelist.json    # Whitelist
└── plugins/          # Plugin configs
```

### What's NOT Included

- Server JAR file
- Assets
- Mods/Plugins (binaries)
- Panel users/roles
- Backup files themselves

## Troubleshooting

### Backup Fails

1. Check disk space:
   ```bash
   df -h /opt/hytale/backups
   ```
2. Check permissions:
   ```bash
   ls -la /opt/hytale/backups
   ```
3. Review container logs

### Restore Fails

1. Verify backup file integrity:
   ```bash
   tar -tzf backup.tar.gz
   ```
2. Check available disk space
3. Ensure server is stopped

### Large Backups

For large worlds:
- Increase container memory
- Use compression: `tar -czf`
- Consider incremental backups
- Exclude unnecessary files