# Network-attached Storage or Local Storage

- Updated on May 1, 2025
- Published on Sep 17, 2024
- 1 minute(s) read

## Network-attached storage or local storage setup

The location of the file store should be specified in the ".env" file:

```bash
FORMS_STORAGE_MODE=<FILE OR FILE_EX OR FILE_LEGACY>
HS_PATH=/mnt/hs/
```

In order for the media storage to be visible across the cluster, _${HS_PATH}/media_ should be a network storage mount (and not a local folder).

> **Value of _FORMS_STORAGE_MODE_**  
> In v36.0.6+ and v37 and later, file stores have a six-level directory structure. This structure minimizes the number of files in each directory, allowing for faster data retrieval and improving performance in high-volume instances.
>  
> The value of _FORMS_STORAGE_MODE_ depends on the version of Hyperscience you're running:
>  
> - v36.0.6 + or v37 or later: _FILE_EX_  
> - v36.0.5 or earlier: _FILE_
>  
> If you are upgrading to v36.0.6+ or v37 or later, your file store will use the optimized directory structure by default. If you want to continue using the older directory structure, set _FORMS_STORAGE_MODE_ to _FILE_LEGACY_.

### **Samba/CIFS share**  
If you are using a Samba/CIFS mount, in the mount options, specify for the mounted network share to use user 1000 and group ID 1000 (i.e., `uid=1000`, `gid=1000`).

### **SELinux verification**
To check if you are running SELinux on your RHEL machine run, the following command:

```bash
sudo sestatus
# Sample Output
# SELinux status:     enabled / disabled
# Current mode:       enforcing / permissive
```

SELinux operates on the principle of default denial: anything not explicitly allowed is denied. When enabled, SELinux can operate in two global modes:

- _Permissive mode_, in which permission denials are logged but not enforced.
- _Enforcing mode_, in which permission denials are both logged and enforced.

If SELinux is enabled in permissive mode or disabled, no further action is needed.

If SELinux is enabled in enforcing mode, you also need to give your application containers access to the media directory.

When SELinux is enabled in enforcing mode, you need to configure an additional setting to allow access from within a Docker container. The configuration depends on the type of networked file store you are using.

- For an NFS share:
  
  ```bash
  setsebool -P virt_use_nfs 1
  ```

- For a CIFS share:
  
  ```bash
  setsebool -P virt_use_samba 1
  ```

In addition, when SELinux is enabled in enforcing mode, you need to add the following exception:

```bash
chcon -t container_file_t /mnt/hs/media
```
