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

# How Nidhi Works

## The cloud drive

XProtect archives only to a drive. So on each recording server Nidhi shows a folder in your bucket as a drive, normally **X:** (named *Nidhi Cloud*). In XProtect you add that drive as the **archive** of a storage profile, the same way you would add a local disk.

<figure><img src="https://1044727958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOkTZH1L3AaRU2hwQk4Ve%2Fuploads%2Fgit-blob-8231f3f659e044e6c4a2d63e46a495051a33bfb5%2Fstorage-tiers.svg?alt=media" alt="Live recordings on a local disk, an optional archive on a local disk, then the archive on the cloud drive X:"><figcaption><p>Where XProtect keeps the footage</p></figcaption></figure>

XProtect plays footage back from the cloud drive like from any other archive. Searching, exporting, evidence locks and bookmarks work as usual.

## The local cache

Files XProtect writes to the cloud drive land first in a **local cache** on the recording server and are uploaded from there, a few seconds after XProtect finishes writing them. Footage played back from the cloud is cached too, so it plays smoothly the second time.

The cache must hold what XProtect archives in about **two archive runs**, so that one run can upload while the next one is written. The setup suggests a size from your cameras and archive schedule (at least 10 GB). Put the cache on a disk other than the one XProtect records to, if you can. See [The local cache](https://docs.vega365.com/nidhi/management-client/setting-up-a-recording-server.md#cache).

## Uploads

Uploads run as fast as the connection allows, unless you set an [Upload Bandwidth Schedule](https://docs.vega365.com/nidhi/management-client/recording-server-settings.md#upload-bandwidth-schedule) to slow them down or pause them at busy times. Footage waits in the cache meanwhile. **Playback from the cloud is never slowed.**

The Dashboard shows whether the upload keeps up. The **headroom** is how much faster the connection is than the recordings it has to carry. Aim for 2× or more.

## Only XProtect deletes

XProtect deletes footage from the cloud drive when the storage profile's retention ends, as it does on a local disk. Nidhi itself **never deletes footage in the cloud**, and sets **no lifecycle or expiry rules** on the bucket.

{% hint style="danger" %}
**Don't add lifecycle (expiry) rules to the bucket.** XProtect keeps evidence-locked footage past its retention. A rule in the cloud that deletes "old" files would delete that evidence.
{% endhint %}

When footage stays in the cloud after its retention (for example after an archive was removed in XProtect), Nidhi lists it in [Cloud Cleanup](https://docs.vega365.com/nidhi/management-client/recording-server-settings.md#cloud-cleanup) and [Cloud Archives](https://docs.vega365.com/nidhi/management-client/site-settings.md#cloud-archives) for you to check, and you decide what to delete in the provider's console.

## When the cloud is down

When the internet connection or the provider is down, XProtect can't archive to the cloud drive. The footage waits on the recording server's local disks and is archived when the cloud is back. Nothing is lost as long as the local storage can hold it.

If the live storage reaches its **Maximum size** in XProtect before the cloud is back, XProtect deletes the oldest live footage to make room, and that footage never reaches the cloud. The Dashboard's **Outage cover** says how long each recorder can be without the cloud before that happens, and the [Outlook](https://docs.vega365.com/nidhi/management-client/recording-server-page/outlook.md) tab says what to change to cover longer.

## Restarts and power cuts

Nidhi is built so that a restart never takes the archive away from XProtect:

* **The drive outlives the service.** When the Nidhi Recorder Service stops, restarts, crashes or is updated, the cloud drive stays mounted and the new service takes it over. The drive is unmounted only when Nidhi is removed or the drive's settings are changed.
* **Boot order.** At start-up, Nidhi holds the XProtect Recording Server until the cloud drive is mounted, for at most 3 minutes (longer while the cache is reloaded after a large upload). Then the Recording Server starts anyway, and the cloud archive comes online when the drive mounts. Nidhi sets the Recording Server service to *Automatic (Delayed Start)* for this, and puts it back when Nidhi is removed.
* **Self-repair.** If XProtect's archive index on the drive is found empty after a power cut, Nidhi puts back the copy from the cloud.

## Where the footage goes in the bucket

Each site has a folder in the bucket, and each recording server a folder in it:

```
<bucket>/<site folder>/<RECORDING SERVER>/...
```

The site folder is made from the [site's name](https://docs.vega365.com/nidhi/management-client/site-settings.md#name-this-site) plus four characters that keep it unique, and is fixed once the site is named. Several sites can share one bucket. Inside a recording server's folder, XProtect keeps one folder per archive, named in the [XProtect archive settings](https://docs.vega365.com/nidhi/management-client/setting-up-a-recording-server.md#archive).
