# Deleting a KOTS snapshot in an embedded kURL cluster does not reclaim space on the disk

**URL:** <https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553>\
**Category:** Supporting your customers\
**Created:** [July 8, 2021, 1:18am UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553 "2021-07-08T01:18:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethanm](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/ethanm/32/11_2.png) [@ethanm](https://community.replicated.com/u/ethanm)\
**Post date:** [July 8, 2021, 1:18am UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/1 "2021-07-08T01:18:55Z")

</div>

After I delete a KOTS snapshot in an embedded kURL cluster it does not seem to reclaim space on the disk. How can I reclaim the space?

---

<div class="post-metadata">

**Author:** ![ethanm](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/ethanm/32/11_2.png) [@ethanm](https://community.replicated.com/u/ethanm)\
**Post date:** [July 8, 2021, 1:29am UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/2 "2021-07-08T01:29:39Z")

</div>

After deleting a snapshot, the Velero Restic data will remain until the maintenance cron prunes data. This happens once every 7 days. It is scheduled this infrequently because it holds an exclusive lock on the repo making snapshots unavailable while pruning.

It is possible to force Restic to prune the data with the following hack. This will make Restic prune the repos within 5 minutes the next time the cron runs.

```auto
kubectl -n velero get resticrepositories -oname \
  | xargs -I{} kubectl -n velero patch {} \
  --type='json' \
  -p '[{"op":"replace", "path":"/status/lastMaintenanceTime", "value":"2020-01-01T00:00:00Z"}]'

```

---

<div class="post-metadata">

**Author:** ![ethanm](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/ethanm/32/11_2.png) [@ethanm](https://community.replicated.com/u/ethanm)\
**Post date:** [May 26, 2022, 4:16am UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/3 "2022-05-26T04:16:22Z")

</div>

It is also possible to run the restic prune command manually.

Run this command if ceph is backing restic:

```auto
kubectl -n velero exec -it deploy/velero -- \
  restic -r s3:http://rook-ceph-rgw-rook-ceph-store.rook-ceph/velero/restic/default prune

```

Or if minio is backing restic:

```auto
kubectl -n velero exec -it deploy/velero -- \
  restic -r s3:http://minio.minio/velero/restic/default prune

```

You will be prompted for a password. You can find the password by running the command:

```auto
kubectl -n velero get secret velero-restic-credentials \
  -ojsonpath='{ .data.repository-password }' | base64 --decode

```

---

<div class="post-metadata">

**Author:** ![craig](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@craig](https://community.replicated.com/u/craig)\
**Post date:** [February 3, 2023, 2:09pm UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/4 "2023-02-03T14:09:41Z")

</div>

As of kURL v2023.01.31-0, the latest version of the [Velero add-on](https://kurl.sh/docs/add-ons/velero) has a `serverFlags` field where additional flags can be passed to the `velero server` command that runs in the container. The Restic prune frequency can be configured within this field:

```auto
spec:
    velero:
        version: 1.9.5
        serverFlags:
        - --default-restic-prune-frequency=48h

```

---

<div class="post-metadata">

**Author:** ![craig](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@craig](https://community.replicated.com/u/craig)\
**Post date:** [September 12, 2023, 1:38pm UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/5 "2023-09-12T13:38:48Z")

</div>

If using a HostPath or NFS storage destination:

Use the following command if the minio add-on is enabled:

```bash
kubectl -n velero exec -it deploy/velero -- \
  restic -r s3:http://kotsadm-fs-minio.default:9000/velero/restic/default prune

```

Or use the following if the minio add-on is _not_ enabled:

```bash
export RESTIC_REPO_PREFIX=$(kubectl get bsl default -n velero -o jsonpath='{.spec.config.resticRepoPrefix}')

kubectl -n velero exec -it deploy/velero -- \
  restic -r $RESTIC_REPO_PREFIX/default --cache-dir=/scratch/.cache/restic prune

```

**Note:** In more recent versions of Velero where node-agent is used (1.10 and newer), the repository password is stored in a secret named `velero-repo-credentials`, so the following should be used to obtain it:

```auto
kubectl -n velero get secret velero-repo-credentials \
  -ojsonpath='{ .data.repository-password }' | base64 --decode

```

---

<div class="post-metadata">

**Author:** ![salahalsaleh](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/salahalsaleh/32/464_2.png) [@salahalsaleh](https://community.replicated.com/u/salahalsaleh)\
**Post date:** [September 28, 2023, 5:13pm UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/6 "2023-09-28T17:13:36Z")

</div>

The same steps need to be done for all restic repositories. For example, in an embedded cluster installation, a `kurl` restic repository will exist as well. To prune the `kurl` repository, run the same commands but replace `default` with `kurl`. For example:

```auto
export RESTIC_REPO_PREFIX=$(kubectl get bsl default -n velero -o jsonpath='{.spec.config.resticRepoPrefix}')

kubectl -n velero exec -it deploy/velero -- \
  restic -r $RESTIC_REPO_PREFIX/kurl --cache-dir=/scratch/.cache/restic prune

```

The list of available restic repositories can be retrieved by running the following command:

```auto
kubectl get resticrepositories -n velero

```

---

<div class="post-metadata">

**Author:** ![Xav\_Paice](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/xav_paice/32/472_2.png) [@Xav\_Paice](https://community.replicated.com/u/Xav_Paice)\
**Post date:** [July 2, 2026, 3:27am UTC](https://community.replicated.com/t/deleting-a-kots-snapshot-in-an-embedded-kurl-cluster-does-not-reclaim-space-on-the-disk/553/7 "2026-07-02T03:27:20Z")

</div>

Some updated notes here:

- The `--default-restic-prune-frequency` flag was replaced with `--default-repo-maintain-frequency`.
- Velero versions prior up to and including 1.16.x do not purge hostpath storage. This was fixed in 1.17+
