# Plans

> Choose what a plan backs up on a server, where it uploads it and how it is packed.

A plan backs up one kind of data on one server. It also sets when it runs, how long its backups stay and where they go.

## Prerequisites

- A Clokeep account with the Admin or Operator role. A Viewer can open plans but not change them.
- A server with the agent installed. See [Install the agent](/docs/servers/install-agent).
- At least one storage. See [S3](/docs/storage/s3), [SFTP](/docs/storage/sftp) or [FTP](/docs/storage/ftp).

## Create a plan

<Steps>
<Step title="Pick the server">
Open **Plans** and click **New plan**. Under **Server & template**, pick the **Server**.

A **Plan template** is optional. It fills in the name, type, schedule, compression profile and the type's options, which you can still change. It does not set retention or storages.
</Step>
<Step title="Name the plan and pick a type">
Under **Plan**, enter a **Name** and pick a **Type**. The fields under **What to back up** change with the type, as described below.

<Frame caption="The Type list of a plan on a Plesk server.">
![The Plan section of a new plan, with the Type list open on Files, Database, Email and Plesk server](/images/docs/plans-type.png)
</Frame>
</Step>
<Step title="Choose when it runs and how long backups stay">
Under **Schedule & retention**, pick a **Schedule** and set retention. See [Schedules and retention](/docs/backups/schedules-retention).
</Step>
<Step title="Choose the storage">
Under **Storages**, pick a **Storage**. A second storage is only for failover. See [Failover between storages](/docs/storage/failover).

A line at the top of **Storages** says whether the plan's new backups are encrypted. See [Encryption](/docs/backups/encryption).
</Step>
<Step title="Save">
Click **Create**. The plan's page opens. To run it now, see [Run and stop a backup](/docs/backups/run-stop).
</Step>
</Steps>

## Plan types

### Files

A Files plan backs up folders on the server. List them on the server first: open the server's page, choose the **Backup Paths** tab and click **New backup path**.

- **Path**: an absolute path, such as `/var/www`.
- **Label**: an optional name.
- **Excluded folders and files**: paths to leave out, relative to **Path** and without a leading `/`. An entry such as `cache` or `site/tmp` leaves out that file or folder and everything in it. Wildcards such as `*.log` are not supported.

On the plan, **Backup paths** picks which of the server's paths it backs up. Left empty, the plan backs up every path of the server, including paths you add later.

A path missing on the server is skipped with a warning in the run's **Logs**, and the rest are backed up. When every path is missing, the run fails with "none of the configured backup paths exist on this server" and the paths it looked for. A wrong path or a disk that is not mounted then fails the run instead of storing an empty backup. This needs agent 3.2.0 or later.

**Separate archive per path** stores one archive per path. Off, all paths go into one archive. It cannot be combined with **Incremental**. See [Incremental backups](/docs/backups/incremental).

### Database

A Database plan dumps one database. Add its connection on the server's page, in the **Database Connections** tab: a **Label**, the **Driver** (**MySQL** or **PostgreSQL**), **Host**, **Port**, **Database**, **Username** and **Password**. The agent connects from the server, so enter the host as the server reaches it, such as `127.0.0.1`.

The password is stored encrypted. On edit, leave **Password** blank to keep it.

On the plan, pick the **Database connection**. **Tables** limits the dump to the tables you list. Left empty, the whole database is dumped. Every run dumps the database in full.

### Email

An Email plan backs up Maildir folders. Enter each folder under **Mail paths**, such as `/var/vmail/example.com/user`.

On a Plesk or cPanel server where Clokeep has read the hosting accounts' mailboxes, you pick instead: **All mail domains**, some **Mail domains** or single **Mailboxes**. A domain includes mailboxes created later, once the agent has read them from the control panel, which it does every hour. **Other paths** takes Maildir folders outside the control panel.

### Plesk server and cPanel server

These types back up hosting accounts one by one. They appear only when Clokeep has switched Plesk or cPanel support on for your [client](/docs/access/users-roles), your organisation in Clokeep.

**Plesk server** is listed while Plesk support is on, but can only be picked for a server whose **Control panel** is **Plesk**. **cPanel server** is listed only for a server whose **Control panel** is **cPanel**. See [Plesk servers](/docs/servers/plesk) and [cPanel servers](/docs/servers/cpanel).

## Compression profiles

**Compression profile**, under **Server & template**, sets the archive format and the compression. Left empty, the plan uses the default profile: your own default first, then the one Clokeep shares with every client. Without either, it uses tar with zstd at level 3, and archives end in `.tar.zst`.

To make your own, open **Compression Profiles** and click **New compression profile**. Pick an **Archive format** (**tar** or **zip**), a **Compressor** (**None**, **gzip** or **zstd**) and a **Level** from 0 to 9, and enter the **File extension**, such as `.tar.gz`.

Switch on **Default profile** to make it the one plans without a profile use. Only one of your profiles is the default: switching it on clears it from the others.

## Shared schedules, templates and profiles

Your lists of schedules, plan templates and compression profiles can include items Clokeep shares with every client. Such items carry a **Platform** badge in the list and "(Platform)" after their name on the plan form. You can use them but not change or delete them.

## Encryption

The **Plans** list has an **Encrypted** column: a closed lock for a plan whose next backups will be encrypted, an open one for the others. Hover over it to see which setting decides. An Admin turns encryption on for your client under **Settings** > **Encryption**. See [Encryption](/docs/backups/encryption).

## When a plan will not run

The **Plans** list shows "Will not run:" and the reason under an enabled plan that cannot run, such as **no active storage**. The plan's page and the tooltip on **Run now** give the same reason in full, after "This plan will not run:". See [Run and stop a backup](/docs/backups/run-stop).

## Switch a plan off

Turn off **Plan enabled** and click **Save changes**. The plan keeps its backups and no longer runs on its schedule. **Run now** still starts it by hand. Retention still deletes its old backups.

## Delete a plan

On the plan's page, click **More actions** > **Delete**. The dialog says how many backups the plan has on storage. Tick **Also delete the backups from storage** to remove them too. The plan and its run history are deleted.

Backups you keep stay on your storage and show under **Browse Backups** as **Orphaned backups**. You can still browse, download and share them, but not restore them to a server, and retention no longer deletes them. See [Browse a backup](/docs/restores/browse#orphaned-backups).

## Plan limits

If your client has a plan limit, **New plan** is greyed out once you reach it, and hovering over it shows the limit.

## Next steps

<CardGroup cols="2">
<Card title="Schedules and retention" href="/docs/backups/schedules-retention" icon="layers">
Run the plan on a timetable and choose how long its backups stay.
</Card>
<Card title="Run and stop a backup" href="/docs/backups/run-stop" icon="play">
Start a backup by hand and follow it on the run page.
</Card>
</CardGroup>
