# Backup

{% hint style="danger" %}
**Note**: In version **2020.2.XXX**, the backup functionality has been moved to a separate module and is not included in the core package. The module can be installed via the [Module Management section](https://docs.mikopbx.com/mikopbx/english/modules/miko/broken-reference).
{% endhint %}

### Creating a Backup <a href="#sozdanie_arxivnoj_kopii" id="sozdanie_arxivnoj_kopii"></a>

1. Go to the **"Modules"** -> **"Marketplace of modules section"** tab.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FXEvaWOcPhIPzfpuMZTOo%2FMoMSection.png?alt=media&#x26;token=86d06f78-cf62-4e87-92a8-192899a7c9c0" alt=""><figcaption><p>Marketplace of modules section</p></figcaption></figure>

Make sure that the **Backup Module** is installed and enabled.

2. Go to the module settings.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FMav4v2aJzTow6ndtUz7L%2FeditModule.png?alt=media&#x26;token=4bffeee5-5a22-4905-a222-f4c0303ba4cc" alt=""><figcaption><p>Module settings</p></figcaption></figure>

3. Click on **"Create backup copy"**.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fv59WM80PvgWBsbwe693p%2FcreateBackupCopy.png?alt=media&#x26;token=46c9c966-0aa9-4cf8-80c7-fcd2cec3b61d" alt=""><figcaption><p>"Create backup copy" button</p></figcaption></figure>

4. Select the data that should be included in the backup:

* **PBX Settings** - all **configuration settings** of MikoPBX made in the web interface.
* **Call History** - saves the **cdr.db** database (location: **/storage/usbdisk1/mikopbx/astlogs/asterisk/cdr.db**). This setting does not save actual call recordings, only the information on the **Telephony** → **Call History** (Documentation) tab without playback/download functionality.
* **Call Recording Files** - saves all call recordings in \*.mp3 format.
* **Sound Files** - saves sound files uploaded to the PBX in the **Telephony** → **Sound Files** (Documentation) section.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FM9VhRk3o250l9LAXodM8%2FsettingsOfBackup.png?alt=media&#x26;token=3e7f4e74-7c05-4178-b2e5-01abd61c051a" alt=""><figcaption></figcaption></figure>

5. Click on **"Create a backup"**.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FP3iUYkuC4hSeRlazrng2%2FCreateBackupCopyButton.png?alt=media&#x26;token=89f47310-3361-4338-b3b3-35609eeaa3a1" alt=""><figcaption></figcaption></figure>

Once the process is complete, the backup will appear in the list of backups:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FJqBSMo37OxOP7NLROBLG%2Fcopy.png?alt=media&#x26;token=d879f214-a940-4afc-9601-2a1815456e85" alt=""><figcaption><p>Created copy</p></figcaption></figure>

### Managing Backup Files <a href="#upravlenie_fajlami" id="upravlenie_fajlami"></a>

In the backup list, you can perform the following actions:

* Restore from a backup.
* Download the backup archive.
* Delete the backup.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FFXb6Oq7Pwl9PwkVQfp1s%2Foptions.png?alt=media&#x26;token=66fc9ecf-1100-40f1-9078-41bccfa1d12d" alt=""><figcaption><p>Options </p></figcaption></figure>

### Restore from Backup <a href="#vosstanovlenie_iz_arxiva" id="vosstanovlenie_iz_arxiva"></a>

{% hint style="info" %}
The process of upgrading from **Askozia 4, 5 ME** to **MikoPBX** is described in this <mark style="color:red;">guide</mark>.
{% endhint %}

1. In the list of backups, select the desired one and click "**Restore from backup"**.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FekcovIAkbhbww2yuKVT5%2Fbutton.png?alt=media&#x26;token=d97c0479-1c23-4007-b4b5-7020e6f848db" alt=""><figcaption></figcaption></figure>

2. Select the categories of data to restore.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FxlSJMRLmv2wUSSFjDLFB%2FobjectsToRestoree.png?alt=media&#x26;token=169f7f3e-6dcc-4c2a-944c-3a91ad33646d" alt=""><figcaption></figcaption></figure>

3. Click on **"Restore from a backup"**.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fxu8KMw7kotJd752Ssr8z%2FrestoreFromBackupBtn.png?alt=media&#x26;token=4ad056e2-6441-4a1c-9520-4c187e10f90f" alt=""><figcaption><p>"Restore from a backup" button</p></figcaption></figure>

The restoration process will start, and once completed, the PBX will be rebooted.

The progress of data restoration will be displayed on the current page.

{% hint style="danger" %}
We recommend restoring the data in two stages:

1. Restore **Sound Files**, **PBX Settings**, and **Call History**.
2. Restore **Call Recording Files** - this is the longest stage.
   {% endhint %}

### Scheduled Backups <a href="#rezervnoe_kopirovanie_po_raspisaniju" id="rezervnoe_kopirovanie_po_raspisaniju"></a>

{% hint style="warning" %}

* **FTP Mode** - creates a **ZIP** archive. For this mode, an *FTP server* is required.
* **SFTP Mode** - creates an **IMG** container. This mode only requires *MikoPBX*.
* **WebDav Mode** - creates an **IMG** container.

**The fastest backup options** are **SFTP** and **WebDav**. FTP is outdated, and the ability to use this protocol will eventually be removed from the backup module.
{% endhint %}

1. Click the "**Backup schedule**" button to configure automatic backups.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FYGni39dmikmO4mb6mlCy%2FbackupScheduleBtn.png?alt=media&#x26;token=762745c2-c340-4362-ad5f-3c1535596366" alt=""><figcaption><p>"Backup schedule" button</p></figcaption></figure>

2. To enable scheduled backups, activate the switch "**Scheduled Backup**."

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FjivLpwTDRukEU7lYvdrn%2FschBackupBtn.png?alt=media&#x26;token=963a405b-cbba-4e3f-be96-b917641049df" alt=""><figcaption></figcaption></figure>

3. Fill in the required information:

* **Server Address** - IP address of MikoPBX or the address of the SFTP \ FTP server.
* **Port** - for **SFTP** mode, the port is **22**. Disabling the "SFTP Mode" switch activates **FTP** mode with port **21**.
* **Username** - the username for server authentication.
* **Password** - the password for server authentication.
* **Server Path** - the directory where the backups will be saved. Recommended directory on MikoPBX: **/storage/usbdisk1/mikopbx/backup/**.

{% hint style="warning" %}
When using **WebDav**, the directory in the "Server Path" field must be created manually in advance.
{% endhint %}

* **Schedule** - specify the day and time for the backup operation.
* **Keep Last X Versions** - specify how many backup versions should be retained.
* **PBX Settings** - all **configuration settings** of MikoPBX made in the web interface.
* **Call History** - saves the **cdr.db** database (location: **/storage/usbdisk1/mikopbx/astlogs/asterisk/cdr.db**). This does not save actual call recordings, only the information on the **Telephony** → **Call History** tab without playback/download functionality.
* **Call Recording Files** - saves all call recordings in \*.mp3 format.
* **Sound Files** - saves sound files uploaded to the PBX in the **Telephony** → **Sound Files** section.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fhzj2DngsQAsAVNliA5Eo%2FoptionsInMenu.png?alt=media&#x26;token=6735c9b2-ed81-4e15-b57f-540cd2c51bdc" alt=""><figcaption></figcaption></figure>

4. Click "**Save**."

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FzIEIOjVFZi0p3YmKBuwr%2FsaveSettingsButton.png?alt=media&#x26;token=f2bba5ce-1b12-4dba-ba3c-7162522c376a" alt=""><figcaption></figcaption></figure>
