# Backup and Restore CE

{% hint style="danger" %}
**Community Edition is not for production workloads.** Use it for labs, evaluation, and learning only.
{% endhint %}

## Community Edition backup & restore process

### Scope

This procedure backs up and restores the **Community Edition management plane** on the CE host.

It does not back up VM disks, external storage, or anything outside the CE host.

### Before you begin

* Run as a user with `sudo` access on the CE host.
* Ensure `/tmp` has enough free space for the backup file.
* Plan for downtime during restore. `unconfigure-du` stops the CE management plane.

{% hint style="warning" %}
The backup can include secrets (tokens, passwords, certificates). Store it securely and restrict file permissions.
{% endhint %}

The backup process for Community Edition is:

* Create a backup using `airctl backup`. The resulting backup file will be saved in the `/tmp` directory on the CE host.
* Save backup copies of the `k3s.yaml` and `airctl-config.yaml` configuration files as well.
* Move the backup file, and copy the other files to another directory to prevent unintentional overwrite.

The restore process for Community Edition is:

* `airctl unconfigure-du` will stop the Community Edition management plane, including all of its Kubernetes pods, but will leave the Kubernetes install in place.
* `airctl restore` uses the backup file to rebuild & restore your Community Edition installation.

The full command list is outlined below:

{% stepper %}
{% step %}

### Create a backup (saves to /tmp)

```bash
/opt/pf9/airctl/airctl backup --config /opt/pf9/airctl/conf/airctl-config.yaml
```

{% endstep %}

{% step %}

### Create a backup directory, and move the backup file

```bash
mkdir backups
mv /tmp/backup_* backups
```

{% endstep %}

{% step %}

### Save a copy of k3s and airctl configuration files

```bash
cp /opt/pf9/airctl/conf/airctl-config.yaml backups/
cp /etc/rancher/k3s/k3s.yaml backups/
```

{% endstep %}

{% step %}

### (Recommended) Lock down backup permissions

```bash
chmod 700 backups
chmod 600 backups/*
```

{% endstep %}

{% step %}

### Verify the backup files exist

```bash
ls -lh backups/
```

{% endstep %}

{% step %}

### Unconfigure the CE deployment unit

```bash
/opt/pf9/airctl/airctl unconfigure-du --config /opt/pf9/airctl/conf/airctl-config.yaml --force
```

{% endstep %}

{% step %}

### Restore the deployment unit from the backup

```bash
/opt/pf9/airctl/airctl restore --config /opt/pf9/airctl/conf/airctl-config.yaml --backupdir backups
```

{% endstep %}

{% step %}

### Verify the restore

Your deployment is healthy when regions show `Ready` and ready services match desired services.

```bash
/opt/pf9/airctl/airctl status --config /opt/pf9/airctl/conf/airctl-config.yaml
```

{% endstep %}
{% endstepper %}
