> For the complete documentation index, see [llms.txt](https://docs.trilio.io/openstack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trilio.io/openstack/admin-guide/backup-targets/delete_dynamic_s3_backup_target.md).

# Delete a backup target

Follow the steps below to remove a backup target.

{% hint style="info" %}
**6.2 simplifies the delete flow.** Trilio for OpenStack 6.2 deploys a single [Dynamic Mount Service](/openstack/about-trilio-for-openstack/triliovault-for-openstack-architecture.md#dynamic-mount-service-dms) server per host instead of one `triliovault-object-store-<bt-name>` pod per backup target. As a result, deleting a backup target in 6.2 no longer requires deleting per-BT control-plane CRs (`tvobackuptarget`) or running per-BT data-plane teardown deployments. The procedure below covers the 6.2 flow; the legacy 6.1 steps are preserved at the bottom for reference.
{% endhint %}

***

## 1. Clean Workloads and Backups (Optional)

* All data related to workloads and the cloud resides on the backup target. The administrator can clean this data from the backup target before deletion, but this step is optional and should not prevent the user from deleting the backup target.
* Before cleaning up workloads or snapshots, log in to the correct OpenStack project, as each backup target and its workloads belong to that specific project. Select the right project you need before proceeding.
* Delete all backups stored on the required dynamically added S3 backup target using the UI (Horizon) or Trilio CLI.

### Delete Snapshots

Refer to [this documentation](/openstack/user-guide/snapshots.md#delete-snapshots) for detailed steps.

### Delete a Workload

Refer to [this documentation](/openstack/user-guide/workloads.md#delete-a-workload) for detailed steps.

**Note:** Repeat this procedure for each backup and workload that needs to be deleted from the S3 backup target created earlier.

***

## 2. Remove the Backup Target Record

Deleting a backup target removes it from the TrilioVault database. Make sure you do not need this backup target anymore before you delete it.

### Using Horizon Dashboard

* Log in to the **OpenStack Horizon Dashboard** as an **Admin** user.
* Navigate to **Admin → Backups-Admin → Backup Targets**.
* Click the <img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-67aafe6af9aa0d6f65fd8edc1c69964f5e86a0b9%2Fimage%20(13).png?alt=media" alt="" data-size="line"> button next to the target, and confirm the deletion when prompted.
* Multiple targets can be deleted by selecting their checkboxes and clicking the <img src="https://1827348953-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2ForlTBnmtYCfO7jjPr0BM%2Fuploads%2Fgit-blob-cccea290030d932bea326596f0bb36e156b5fc4c%2Fimage%20(14).png?alt=media" alt="" data-size="line"> button at the top right.

### Using CLI

#### RHOSO18

1. Identify the WLM API pod in the `trilio-openstack` namespace:

   ```
   oc get pods -n trilio-openstack | grep wlm-api
   ```
2. Exec into the pod and source the admin RC file:

   ```
   oc exec -n trilio-openstack -it <trilio-wlm-api-pod-name> bash
   source <admin-rc-file>
   ```

#### Kolla

1. Exec into the wlm-api container and source the admin RC file:

   ```
   docker exec -it triliovault_wlm_api bash
   source <admin-rc-file>
   ```

#### Common Steps

3. List the backup targets to find the ID of the one you want to delete:

   ```
   workloadmgr backup-target-list -c ID -c "Backend Endpoint" -c "Secret Ref"
   ```

   Note the **Backup Target ID** and the **Secret Ref** URL (for S3 targets) — you will need the secret ref to clean up the Barbican secret in step 3.
4. Delete the backup target:

   ```
   workloadmgr backup-target-delete <backup_target_id>
   ```
5. Verify deletion:

   ```
   workloadmgr backup-target-list -c ID -c "Backend Endpoint"
   ```

***

## 3. Delete the Barbican Secret (S3 only)

In 6.2, the S3 access/secret keys for each backup target are stored in an OpenStack Barbican secret. Once the backup target record is gone, the corresponding Barbican secret is no longer referenced and can be removed.

From inside the WLM API pod/container:

```
openstack secret list --name secret-key-<btt-name>
openstack secret delete <Secret href from previous list>
```

Or use the `Secret Ref` URL captured from `workloadmgr backup-target-list` in section 2 directly:

```
openstack secret delete <secret_ref>
```

***

## 4. Verify

DMS unmounts the backup target automatically when the last in-flight job releases it; no manual unmount is required. You can confirm that:

* The deleted backup target no longer appears in `workloadmgr backup-target-list`.

### RHOSO18

* The DMS server pods on the controller and compute nodes are still `Running`:

  ```
  oc -n trilio-openstack get pods | grep trilio-dms-server
  oc -n openstack get pods | grep trilio-dms-server
  ```
* No per-BT `triliovault-object-store-<bt-name>-*` pods remain in the `trilio-openstack` namespace (in 6.2 they should never be present):

  ```
  oc -n trilio-openstack get pods | grep object-store
  ```

### Kolla

* The DMS server containers on the controller and compute nodes are still `Running`:

  ```
  docker ps | grep triliovault_dms
  ```

***

<details>

<summary>Deprecated (6.1) — per-BT data-plane teardown and <code>tvobackuptarget</code> CR delete</summary>

In Trilio for OpenStack 6.1 and earlier, deleting a backup target also required tearing down a per-BT object-store container on every node. This procedure is preserved for reference; **do not run any of these steps on 6.2 or later — there are no per-BT containers or CRs to remove.**

### 3.1] Unmount Backup Target from Data Plane

#### Delete the per-BT data-plane deployment

* List `OpenStackDataPlaneDeployment` resources matching the backup target name:

  ```
  oc -n openstack get osdpd | grep trilio
  ```
* Delete the deployment:

  ```
  oc -n openstack delete osdpd <DEPLOYMENT_NAME>
  ```

#### Delete the per-BT data-plane service

* List the per-BT `OpenStackDataPlaneService`:

  ```
  oc -n openstack get osdps | grep trilio
  ```
* Delete it:

  ```
  oc -n openstack delete osdps <OpenStackDataPlaneService_NAME>
  ```

#### Run the cleanup playbook

* Generate the cleanup YAMLs:

  ```
  cd dataplane-scripts/
  chmod +x create-templates-delete-backup-target.sh
  ./create-templates-delete-backup-target.sh <BACKUP_TARGET_NAME> <BACKUP_TARGET_TYPE>
  cd <BACKUP_TARGET_NAME>/
  ```
* Edit `trilio-delete-backup-target-service.yaml` and set `openStackAnsibleEERunnerImage:`. Apply:

  ```
  oc -n openstack apply -f trilio-delete-backup-target-service.yaml
  ```
* Edit `trilio-delete-backup-target-deployment.yaml` and add the compute `nodeSets` where this BT was added. Apply:

  ```
  oc -n openstack apply -f trilio-delete-backup-target-deployment.yaml
  ```
* Tail the runner pod logs:

  ```
  oc -n openstack get pods | grep trilio-delete-backup-target
  oc logs -f <ANSIBLE_RUNNER_POD_NAME> -n openstack
  ```

### 3.2] Unmount Backup Target from Control Plane

* List the `tvobackuptarget` CRs added dynamically:

  ```
  oc -n trilio-openstack get tvobackuptarget
  ```
* Delete the selected one:

  ```
  oc delete tvobackuptarget <TVO_BACKUP_TARGET_NAME>
  ```
* Verify the deletion and confirm that the per-BT object-store pods have been cleaned:

  ```
  oc -n trilio-openstack get tvobackuptarget | grep <TVO_BACKUP_TARGET_NAME>
  oc -n trilio-openstack get pods | grep object-store
  ```

***

In 6.2, none of the resources referenced above (`OpenStackDataPlaneDeployment`/`OpenStackDataPlaneService` per BT, `create-templates-delete-backup-target.sh`, `tvobackuptarget` CR, per-BT object-store pods) exist — DMS handles unmount on demand and the only steps required are sections 1–3 of this page.

</details>
