# Storage

Server storage configuration includes storage directories, size and duration quotas, optional encryption, cleanup time settings and storage differentiation by name for further flexible allocation of the recorded streams.

To access the storage settings for the server via Macula Console, choose the *Configuration* section, then select Servers from the menu on the left, double-click your target server and then click the *Storage* tab. Click the Open *storage* *properties* button to open the configuration dialog box.

There are also several settings in server settings dialog box itself. These are explained in the end of this chapter.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FnlJ4eDgub6iQarAf6sVU%2Fimage.png?alt=media&#x26;token=628e46b7-966f-4c6e-998b-12e8907206ac" alt=""><figcaption></figcaption></figure>

To save the changes after you have finished with storage configuration, hit the *Apply* button beneath the storage settings, then hit *OK* to close the storage configuration dialog box, and then click *OK* to finally save the storage settings together with the server configuration. Pressing *Cancel* on the last step will revoke the changes in the storage configuration.

#### Directories

All available **local disks** will be automatically listed after the first installation (with empty configuration) and enabled for recording with default archive directories using the Default storage label. By default, system disk (C:) is not listed if other disks are available, as we strongly do not recommend recording to the system disk.

If you are upgrading, re-installing the software, restoring an earlier database configuration, or inserting new local disks into the server after the software has been installed, the local disks will not be listed automatically so you need to **add** them as **new storages**. You can also add network paths to remote storage locations.

Use UP and DOWN arrows on the right to change the disk order (priority); use the recycle bin button in the top panel to remove any local or network directory from the storage configuration.

{% hint style="info" %}
Mapped network shares that appear as drives in Windows Explorer will not be listed automatically because Macula operates as Windows Service and therefore is unable to access these (due to Windows API peculiarities). You are welcome to add these as network directories in storage settings.
{% endhint %}

For each storage location, the following information will be displayed:

* storage priority: determined by the item position in the list
* storage label (see description below)
* current quota size
* free space on disk (except network storages)
* total disk size (except network storages)

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FRnqhk6ekts0yIUrVpJfL%2Fimage.png?alt=media&#x26;token=93b7ab78-cf9b-40fa-aead-38f1e964269e" alt=""><figcaption></figcaption></figure>

Each directly attached storage location will be automatically assigned a quota of 90%; each storage will have 20GB quota by default. We strongly advise that you review all the settings and make sure that all the storage locations have sufficient free space, and, if necessary, free up some space. It is recommended that every recording location has 10-15% of free space: this helps avoid fragmentation effect and also allows highly loaded software to effectively enforce recording quotas.

{% hint style="danger" %}
**Minimum quota** per each storage location for any storage type is 20GB.
{% endhint %}

{% hint style="info" %}
We advise against recording to the system drive because it is often used by other processes like defragmentation and system backup, not to mention the operating system itself, and thus doing so may affect recording efficiency and stability. As a result, disk C: is not selected for recording by default.
{% endhint %}

{% hint style="info" %}
Total size and free space on the network storages is not displayed here. You can check these in the Monitoring section of Macula Console, under Storages.
{% endhint %}

To change the disk quota, simply highlight the desired location for storage from the item list, then enter the quota size in GB and click *Apply changes*.

{% hint style="danger" %}
If you plan to **protect** some footage from being erased (this functionality is available via Macula Monitor application), keep in mind that **protected archive** areas will be **ignored when forcing quotas**. Make sure there is enough free space on the disk(s) and set lower quotas, if necessary.

To review and/or **un-protect** such areas, go to the *Monitoring* section of Macula Console, choose *Archive statistics* on the left, highlight one or more target channels, and press the Protected intervals button on the top panel.
{% endhint %}

#### Storages

You can either use the Default storage category for all locations, or create multiple different **storage** profiles (types, names, labels). These can be used for manually distributed streaming between storage directories:

* storage directories are marked with corresponding storage tags
* each channel is assigned to a recording location

To choose a storage profile different from the *Default*, select the storage location from the *Directories* list and click the *Change* button.

<div align="center"><figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FBn1CSWXEKGJGulz82o0C%2Fimage.png?alt=media&#x26;token=87150619-ab92-48d1-956b-e2417714d045" alt="" width="279"><figcaption></figcaption></figure></div>

Select one of the built-in storage profiles or create and edit a new one.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2F2G9XslnapwUWx0CL4rjc%2Fimage.png?alt=media&#x26;token=119feb12-ad52-4cbe-9600-9009d9caab0e" alt=""><figcaption></figcaption></figure>

The built-in storage types are:

* **Disabled**: storage location will not be used
* **Default**: default storage tag
* **Fallback**: storage destination to be used if all the storage units with specified tags have failed
* **Readonly**: existing data will be available for reading and will not be erased; no new recordings will be appended to this location

These profiles cannot be edited or removed. Fallback storage settings are available in the corresponding tab of the *Storage* *properties*.

{% hint style="info" %}
Readonly storage type can be used, for example, in the following cases:

* it is necessary to view the old data from a different Macula server when you need to insert the disks originating from another computer and you do not wish that these data are erased
* some storage unit contains important footage that has been requested to be kept for a longer time so that the recordings are not erased over time while still allowing access to the footage
  {% endhint %}

Click *+ New storage* button to create a new storage profile or select an existing one and click the *Edit* button in the upper-right-hand corner to change its name.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FzHTkVblIdB7LbQflauid%2Fimage.png?alt=media&#x26;token=9c7bb7fa-bc77-4f47-a854-978edf2f7f77" alt=""><figcaption></figcaption></figure>

Enter the storage profile title and click *OK* to save and exit.

The storage tag you have selected or just created will appear as selected. Click the *Apply* button below to **confirm** storage configuration settings before proceeding.

#### Add Storage

In order to add a new local disk or a network storage (NAS, SAN, network share), click + New button on the upper panel, select *New local directory* or *New shared directory*, and then enter the setup details.

{% hint style="danger" %}
If you are using a NAS, make sure to disable the *Recycle Bin* feature (for some NAS models, it is called *trashbox* or similar). This will ensure that the erased files (e.g., when reaching quota) are actually deleted permanently
{% endhint %}

{% hint style="danger" %}
If you are adding a previously encrypted storage (e.g., it has been used on another server), make sure to provide the same password. You can track the storage status in the *Monitoring* section of Macula Console, under *Storages*.
{% endhint %}

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2F8ERYWZJMvjynICqio6qF%2Fimage.png?alt=media&#x26;token=0d374ba6-11be-4b7f-a54f-9e707ec7e1cd" alt=""><figcaption></figcaption></figure>

The table below details the available settings for a shared directory. Enter the settings for the target storage and click *Create* below: the storage will be validated immediately.

| Setting  | Description                                                                            | Default Value                        |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------------ |
| Path     | Full network path to the storage directory                                             | \\\Server\Share\Macula\Archive Files |
| Username | User name to connect to the storage                                                    | \[empty]                             |
| Password | Define storage access password, if applicable                                          | \[empty]                             |
| Quota    | Maximum amount of storage in gigabytes to be used for recording; 85-90% is recommended | 20GB                                 |
| Storage  | Storage label to be assigned to the target storage directory                           | Disabled                             |

When adding a **local directory**, you are first offered to choose the disk from the list of detected ones. If there is just one disk left available, it will be chosen automatically.

| Setting | Description                                                                            | Default Value           |
| ------- | -------------------------------------------------------------------------------------- | ----------------------- |
| Path    | Full path to the archive directory                                                     | X:\Macula\Archive Files |
| Quota   | Maximum amount of storage in gigabytes to be used for recording; 85-90% is recommended | 20GB                    |
| Storage | Storage label to be assigned to the target storage directory                           | Disabled                |

#### Storage Encryption

Once you have added all the necessary storages, you can enable encryption and set a password for each storage separately.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2F4ETRlm4aM0d5UAfIvFNB%2Fimage.png?alt=media&#x26;token=5e88c253-4755-47fa-b9b7-fed7d336a889" alt=""><figcaption></figcaption></figure>

Mark the *Enable encryption* option and specify the password you want. You can change the password at any point, and there is also an additional field that lets you add a hint that may help remembering the password in future: it will appear either as regular text or a tooltip when hovering your mouse cursor over the password prompt field.

The currently available encryption options:

* None: no encryption
* AES-128 or AES-256: choose the one you need

{% hint style="info" %}
When assigning a new password for the storage, make sure to remember it or store in a secure place: you will require it, should you need to access the storage contents in the following scenarios:

* when accessing the archive with the Portable Player tool
* when adding the same disk as a storage unit for another server
* when adding a disk containing archive backup as a storage unit
* if you delete the encrypted disk from the storage configuration and then add it anew

There is a field that allows you to enter a password hint, which will be displayed in these situations.

You will not be prompted for the password when accessing the archive from the Macula Monitor application connected to a server with encrypted archive: Macula server will decrypt it automatically.
{% endhint %}

{% hint style="danger" %}
There is no option to recover the password if you have forgotten it.
{% endhint %}

Starting from the moment you set the password, all footage recorded to the target storage becomes encrypted; retroactive encryption for the previously recorded archive is not supported.

When the storage password is changed, the new password is used for encryption from then on. If storage encryption is disabled for some time and then enabled back, that part of the archive will remain unencrypted.

#### Duration Quota

Set the global recording duration limit for your server here: enable quota management and then enter desired number of days. All recordings older than the number of days specified will be erased.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2F6OSzDbEvS3onGP74yIoR%2Fimage.png?alt=media&#x26;token=69b12a67-a505-47af-b1b5-27a9775a27d9" alt=""><figcaption></figcaption></figure>

Note that the global duration quota has priority over the individual (per-channel) duration quota that is set in the Recording Configurations.

#### Retention

You can set the software erasing mechanism so that it cleans up old recordings only during specific periods of time, e.g., when the recorder is less overloaded or when the quality of recordings are less important.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FBlIx4O2nwO3QX6QRb0AP%2Fimage.png?alt=media&#x26;token=12c46aee-8825-4aa6-9b57-a6b1600bd201" alt=""><figcaption></figcaption></figure>

To do this, enable the cleanup hours setting and specify the time period during which erasing is allowed.

{% hint style="danger" %}
This control has priority over the storage quota. Setting insufficient cleanup time may lead to storage overflow and result in recordings being lost. We strongly recommend that you do not enable any cleanup hours' restrictions unless you absolutely know what you are doing.
{% endhint %}

#### Fallback

You can dedicate a specific recording location to serve as a failover storage, called **fallback storage**. Such storage location will be used for recording only if all specified target storages of the certain type have failed.

Macula server automatically detects when a channel or channels cannot be written onto their normal destination storage and switches to the fallback storage after the specified timeout has been reached. Minimum and also default timeout is thirty seconds, and maximum is five minutes. A default system event is raised when fallback is activated.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2F2yMVyLmloYU24LLANS0T%2Fimage.png?alt=media&#x26;token=9016e450-85c9-4f50-b02f-a89ce40b87b9" alt=""><figcaption></figcaption></figure>

&#x20;After setting the desired timeout, switch to the *Directories* tab and specify, which storage will serve as fallback.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FaPkZXP3xCZkuwmBFloZG%2Fimage.png?alt=media&#x26;token=da7a595e-c91d-4473-8e8d-5c9c08c93da7" alt=""><figcaption></figcaption></figure>

Usage example:

Consider a system where all main streams are recorded to the storage with the tag *Main* and all secondary streams are, in their turn, recorded to the *Substreams* storage. If either or both of these storages fail, recording will automatically proceed to the *Fallback* storage.

{% hint style="danger" %}
The fallback storage must be able to handle the load and have enough free space to keep the recordings until the main storage gets back online.
{% endhint %}

Server checks if the main storage is available if one of the conditions has been fulfilled:

* server has finished and closed a data file (4GB)
* the data file has not reached 4GB in size but six hours have passed
* server was restarted

In other words, the recording mechanism checks if the main storage is available every 6h OR every 4GB of recorded data OR after a restart (upon startup). If the main storage is OK, Macula server continues to record onto it; the recordings made onto the fallback storage stay there and are not transferred anywhere.

To **save the changes**, hit the *Apply* button beneath the storage settings, then hit *OK* to close the storage configuration dialog box, and then click *OK* to finally save the storage settings together with the server configuration. Pressing Cancel on the last step will revoke the changes in the storage configuration.

#### Archive Protection and Deletion

Outdated archive is erased automatically once any of the quotas is reached (storage or duration, server wide or individual). Oldest recordings are removed to free up some space for the newer recordings. However, there are some exceptional cases when the footage is not or may not be erased:

* storage marked as *Readonly* will not be used for writing and no data will be erased from such storages based on quotas (however, footage from such storages can be removed using selective erasing from the Macula Monitor application)
* no erasing will be conducted outside cleanup hours (by default, erasing is allowed 24/7 and this setting is recommended)
* protected archive intervals will be also ignored by the erasing mechanism until you un-protect them

**Archive protection** is a feature available in the Macula Monitor application, in playback mode. You can mark certain footage from being erased if it is important to keep it for longer (e.g., as evidence). To unlock the protected intervals, go to Archive statistics in the Monitoring section of Macula Console.

{% hint style="danger" %}
If there are too many protected recordings on a disk, the storage may be filled up to 100%: this may negatively affect the overall recording operation. Pay attention to the amount of free space on every storage unit in case you are using archive protection:

* set lower recording quotas so that there are always 10-15% of free space on each storage,
* un-protect the archive that no longer needs to be protected from erasing.
  {% endhint %}

{% hint style="danger" %}
When you **protect a short period** of the archive (e.g., several minutes), in fact, the whole file containing this period is protected from erasing. Therefore, intervals adjacent to protected period will also be locked. You can verify the exact protected interval by opening Macula Console >> *Monitoring section >> Archive statistics >> Protected intervals*.

Keep this in mind when protecting too many short intervals: as all files containing them are locked, they will not be erased when forcing quotas, so you may come to a point when there is **not enough free space** on the disk. If you know you will use the archive protection feature a lot, it may be wise to set a **lower disk quota** - for example, 80% instead of 90%.
{% endhint %}

Macula Monitor application allows users with corresponding privileges to delete certain parts of the archive. This mechanism can delete recordings from storages marked as *Readonly* but cannot erase protected archive from any storage unit.

If the footage is not protected, it will be removed as outdated when the server eraser reaches one of the quotas. Also, the **unprotected** footage can be removed manually by someone who has a permission to **delete archive**. However, as such a feature may be may be regarded as a potential threat for the archive integrity, it is **disabled by default**. You can enable it in the server storage settings by marking the *Allow manual deletion* option.

{% hint style="danger" %}
Enabling manual archive deletion will automatically enable the **admin** user to do so, as admin is a root user who has all possible privileges. The same is true for all users belonging to the *Administrators group*. If you are enabling this feature, make sure that no unauthorized personnel have access to the administrative accounts.
{% endhint %}

#### Time Restricted Access to Archive

There is a possibility to grant **archive access** permissions for a **limited time**: for example, for the last N days or M hours. The access permissions are a part of the channel permission set.

Here, in the server settings dialog box > *Storage* tab, you can define the allowed archive access period, starting from the present moment.

<figure><img src="https://412599993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeNXnJx0OpvxnmpWqOBNm%2Fuploads%2FoDAFZyetkjI1hOnGExeq%2Fimage.png?alt=media&#x26;token=87991464-e0d4-4005-9d00-e7b0182b9d5c" alt=""><figcaption></figcaption></figure>

Depending on your needs, the duration can be expressed in **minutes, hours, or days.** The minimum period is 10 minutes and the maximum value is 366 days (1 year).

**Example**: if the recent archive interval is set to 30 minutes, all users having a Restricted video playback permission will be able to browse the last half an hour of the target channel archive in all archive playback modes of the Macula Monitor application.
