> For the complete documentation index, see [llms.txt](https://docs.storware.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.storware.eu/backup-destinations.md).

# Backup Destinations

## Overview

A **backup destination** is the storage location where Storware Backup & Recovery retains backup data for later recovery. It holds the backup copies created from protected workloads, such as virtual machines, containers, cloud instances, applications, and file systems.

Configuring a backup destination tells Storware Backup & Recovery **where to store backups and how to access that storage**. A backup policy selects the destination to use, while retention settings determine how long its backup copies are kept.

The **Storware Node** performs storage operations, including writing backups, reading data for restore, and removing backups according to retention rules. Each destination must be assigned to the appropriate **Node Configuration** and accessible to the Nodes using that configuration.

#### Backup Destination and Staging Space

These locations serve different purposes:

| Location               | Purpose                                                                                                           |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Staging space**      | Working space used by the Node while processing backup and restore data, where required by the selected workflow. |
| **Backup destination** | Storage that retains completed backup copies for recovery.                                                        |

Preparing staging space alone does not configure a backup destination. The destination must also be added to Storware Backup & Recovery and selected in the backup policy.

## Backup Destination Types

Choose a destination type that matches your storage infrastructure and protection requirements.

| Type                        | Purpose                                                                           |
| --------------------------- | --------------------------------------------------------------------------------- |
| File System                 | Stores backups in a directory on a file system accessible to the Node.            |
| Deduplication Appliances    | Stores backups on a supported appliance that provides deduplication capabilities. |
| Object Storage              | Stores backups in a supported object storage service.                             |
| Enterprise Backup Providers | Integrates with a supported enterprise backup system to store backup data.        |
| Tape Pools                  | Stores backup copies on tape through a configured tape pool.                      |

Refer to the chapter for each destination type for its configuration, requirements, and available features.

## Configure and Use a Backup Destination

1. **Prepare the storage.** Ensure that the required storage, credentials, and network connectivity are available.
2. **Create the backup destination.** Select its type and provide the storage location and access settings.
3. **Assign it to a Node Configuration.** Ensure that the Nodes using that configuration can access the destination.
4. **Select it in a backup policy.** Configure retention for the backup copies stored there.
5. **Verify operation.** Run a backup and a test restore to confirm that data can be written and recovered.

Assigning a destination to a Node Configuration makes it available to those Nodes. Selecting it in a policy determines which backups are stored there.

## Retention

Retention controls how long backup copies remain on a destination. Configure it in the backup policy under **Backup SLAs → Policy → Rule**.

Where both backup-count and age limits are configured, a backup becomes eligible for removal when either limit is reached. Retention is configured separately for each destination assigned to the policy.

For details, refer to **Backup SLAs → Policy → Rule**.

## Remove a Backup Destination

Removing a backup destination deletes its configuration from Storware Backup & Recovery, but **does not delete the backup data from the underlying storage**.

> **Important:** Data left on the storage cannot subsequently be reattached as an existing backup destination. Before removing a destination, ensure that its backup copies are no longer required for recovery through Storware Backup & Recovery.

## Pre- and Post-Access Commands

Pre- and post-access scripts automate actions required before and after the Node accesses a backup destination. For example, a pre-access script can prepare and mount a remote volume.

| Script          | Execution point                                                 |
| --------------- | --------------------------------------------------------------- |
| **Pre-access**  | Before each access to the backup destination.                   |
| **Post-access** | After the Node finishes a store, restore, or cleanup operation. |

#### Configure the Scripts

1. Prepare the scripts required for the destination.
2. Place them on every Node that will access the destination, using consistent paths.
3. Ensure that the `vprotect` user can access and execute them.
4. Configure the pre- and post-access commands in the backup destination settings.
5. If a script requires elevated privileges, grant access only to the required command.

#### Available Environment Variables

Storware Backup & Recovery sets the following variables before executing the scripts. VM-related values depend on the workload and operation being processed.

| Variable            | Description                                                                                                                                                       |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `VP_VM_GUID`        | VM identifier in Storware Backup & Recovery.                                                                                                                      |
| `VP_VM_UUID`        | VM identifier assigned by the hypervisor or hypervisor manager.                                                                                                   |
| `VP_VM_NAME`        | VM name.                                                                                                                                                          |
| `VP_VM_TMP_DIR`     | Path to the directory containing the workload’s files in staging space.                                                                                           |
| `VP_BD_GUID`        | Identifier of the backup destination being accessed.                                                                                                              |
| `VP_BD_NAME`        | Name of the backup destination being accessed.                                                                                                                    |
| `VP_CONTAINER_NAME` | Generated storage container name in the format `<VM-NAME>__<PART-OF-UUID>`, for example `Centos 7__8d3ef6f1`. The value may contain spaces or special characters. |
| `VP_EXPORT_PATH`    | Export path from the Node Configuration. It can be used as the mount root for backup destination volumes.                                                         |
| `VP_TASK_TYPE`      | Operation type, such as `STORE`, `RESTORE`, `DELETE_VM`, or `OLD_BACKUPS_REMOVAL`.                                                                                |

Quote variable values when using them as shell arguments, particularly names and paths that may contain spaces or special characters.

#### Privileged Script Execution

If a script needs root privileges, configure a dedicated rule under `/etc/sudoers.d/`. For example:

```sudoers
vprotect ALL=(root) NOPASSWD: /opt/vprotect/scripts/myscripts/privileged.sh
```

This rule allows the `vprotect` user to execute the specified script as root through `sudo` without a password. The script and its parent directories must be protected from modification by unprivileged users.

Use `visudo` to create and validate the rule:

```bash
visudo -f /etc/sudoers.d/vprotect-backup-destination
```
