# Backup and Restore

https://docs.wisecp.com/ar/backup-and-restore

Back up the database, files and uploads on demand or on a schedule, and restore them when you need to.

## Opening the Screen

In the left menu, click **Settings**, then **Security**, then **Backup** in the tab row.

Address: `{admin}/settings/security?general=backup`

The screen has four sub-tabs: **Settings**, **Backups**, **Schedules**, **Remote Storage**. Add `&backup=backups`, `&backup=schedules` or `&backup=storage` to open one directly.

## What Is on the Screen

### Settings

**System Compatibility** checks the PHP features backups need and opens a details list if something is missing. **Disk Usage** shows free and used server space as a bar. Below them sit the **Backup Settings** card and a two-tab **Exclusions** card.

### Backups

Lists every backup with **Backup**, **Destination**, **Created** and **Status** columns. Each row badges its contents (Database/Files/Uploads). A running backup shows its current stage and how long it has been running. If no progress signal arrives for 5 minutes, a **Stalled** badge appears next to it. The **Create Backup** button above starts one on demand.

### Schedules

Lists backups that run on their own, with **Name**, **Frequency**, **Destination**, **Next Run** and **Status** columns. The **Create Schedule** button above opens a new one.

### Remote Storage

Lists the destinations backups can upload to, with **Name**, **Type**, **Created** and **Status** columns. The **Add Destination** button above connects a new provider.

## Fields

### Settings Tab

- **Backup System**: Turns backups on or off. Turning it off asks for confirmation. While off, no backups run and existing ones stay.
- **Backup Directory**: A path relative to the installation root, empty defaults to `backups`. The box checks the path as you type. If the folder cannot be written to or protected from web access, the backup fails and names the folder.
- **Excluded Paths**: Check the folders and files to leave out of file backups from the tree.
- **Excluded Tables**: Check tables to leave out of database backups; structure stays, data does not. The list starts with the largest table, so the ones actually inflating your backup sit at the top.

### Create Backup Window

- **Remote Destination**: Defaults to **Local Only**. Only validated destinations appear in the list.
- **Contents**: **Database**, **Files**, **Uploads** cards, all checked by default. With Files selected, Uploads is bundled into it. Database views are included, and parts larger than 4 GiB are supported.
- **Keep local copy after upload**: Appears once you pick a remote destination. Turn it on and the file also stays on the server.

### Schedule Window

- **Name**: Required. Identifies the schedule in the list and in the backup history.
- **Enabled**: On by default. Off means it never runs; use Create Backup for a one-off.
- **Notify when finished**: On by default. Emails the default recipient — usually the oldest admin, not you. The finished backup also shows up in that admin's panel bell; its View button opens the Backups tab.
- **Remote Destination**: Defaults to **Local Only**; same list as the Create Backup window.
- **Frequency**: **Hourly**, **Daily**, **Weekly** or **Monthly**; fields below change with your choice.
- **Time**: Appears for every frequency except Hourly, defaults to 03:00.
- **Day of Week**: Appears for Weekly.
- **Day of Month**: Appears for Monthly, between 1 and 31.
- **Retention Count**: Required, at least 1, defaults to 7. Older copies beyond this number are removed automatically.
- **Keep local copy after upload**: Appears once you pick a remote destination; turn it on and the file also stays on the server.

### Add Destination Window

- **Provider**: FTP, SFTP, Google Drive, OneDrive, Yandex Disk or Bunny Storage; shown when adding, not when editing.
- **Name**: Required. Identifies the destination in the list and pickers.
- **Connection Details**: Vary by provider: host, username and password for FTP/SFTP, an authorization window for cloud providers.

### Restore Window

- **What to Restore**: Shows only the parts the backup holds, all checked by default.
- **Enter your account password to confirm**: Required. Confirms that you are the one starting this action.

## Tasks

### Turning On and Configuring Backups

1. On the **Settings** sub-tab, switch on **Backup System**.
2. Change **Backup Directory** if needed, and check paths or tables to skip under **Exclusions**.
3. Click **Save** below the card. Every backup after this uses these settings.

### Creating and Downloading a Backup

1. On the **Backups** sub-tab, click **Create Backup** — disabled if the system is off or busy.
2. Pick a **Remote Destination** if you want one, check the **Contents** cards, and click **Create Backup** below.
3. Once the row reaches **Ready**, open its menu and choose **Download**. Enter your password and click **Download** below it; it starts in a new tab.
4. If it fails instead, choose **Retry** from its row menu to try again.

### Restoring From a Backup

1. Open the menu of a **Ready** row and choose **Restore**.
2. Check what to restore, enter your password, and click **Restore** below it.
3. The request queues and starts on the next cron run; track it on the same row. Cancel one that has not started with **Cancel Restore** from the row menu. A damaged or cut-short database dump is refused before anything is restored.
4. When it finishes, the row shows **Restored** and a **Restore Completed** notification arrives. If the archive holds a row twice, the restore keeps the archive's copy and continues. The notification counts the replaced rows; a count above zero means the backup was taken while data was still changing.

### Creating a Schedule

1. On the **Schedules** sub-tab, click **Create Schedule**.
2. Enter a **Name** and pick a **Frequency**, filling the time/day fields it shows. Choose **Contents** and a **Remote Destination** if you want one.
3. Click **Create Schedule** below. To change one, choose **Edit schedule** from its row menu.

### Adding a Remote Storage Destination

1. On the **Remote Storage** sub-tab, click **Add Destination** and pick a provider.
2. Enter a **Name** and the connection details it asks for, then test them with **Validate**.
3. Once it passes, click the **Add Destination** button that opens. To change one, choose **Edit destination** from its row menu (only folder/path edits re-test it).
4. To re-check an existing destination later, choose **Validate** from its row menu.

### Deleting a Backup, Schedule or Destination

1. From the row menu, choose **Delete backup**, **Delete schedule** or **Delete destination**.
2. Enter your password and confirm. A backup that still sends progress signals cannot be deleted, and neither can a destination that an active schedule uses.
3. A running backup whose last progress signal is 30 minutes old counts as abandoned. **Delete backup** then works for it, and **Create Backup** opens again once the row is gone. The **Stalled** badge is only a warning.
4. If the remote destination cannot delete its copy, the backup stays with the reason; fix or delete the destination, then retry.

## Things to Watch

> **Restoring overwrites what is there now**
> 
> A safety backup is taken first when possible (the restore window warns if not), and the site stays in maintenance mode until the restore finishes. Restoring the database may end your session. Scheduled tasks pause during a database restore and resume afterwards. Jobs that were waiting inside the backup are cleared, not run again. If the restore fails, the row shows **Restore Failed**, the safety backup stays in the list and you can retry right away.

> **Deletion is permanent**
> 
> Deleting a backup, schedule or remote destination cannot be undone. Only active schedules block it — old backups can then lose their destination and Download.

> **Schedules depend on cron**
> 
> If cron is not running, scheduled backups do not start and queued restores stall.

> **A stuck backup or restore closes itself**
> 
> When the next backup job starts, a running backup silent for 30 minutes is marked failed. A backup that keeps signalling is never touched. A step that runs past 30 minutes (dump, archiving or packaging) is stopped. The backup then fails with a time limit error; retry it from the row menu. Servers that back up without system tools have no such limit. A restore whose worker dies or goes silent for 30 minutes is closed as **Restore Failed**, and maintenance mode switches back.

> **A ready backup can still carry a warning**
> 
> When the web server user cannot read a file (for example a licence file owned by another system user), the backup skips that file instead of failing. The row stays **Ready** and a yellow warning icon next to the status lists the skipped paths. Grant read access to those files or add them to **Excluded Paths**, then take the backup again.

## Required Privileges

Viewing the **Backup** tab and every action on it (create, download, restore, schedule, manage destinations) needs the **SECURITY_BACKUP** privilege.

## Related Articles

- [Security Settings Overview](https://docs.wisecp.com/en/security-settings-overview)
- [General Security Options](https://docs.wisecp.com/en/general-security-options)
