# Cache Configuration Requirements

To successfully implement the Cache Configuration, the system must support two primary features:

1. **Data Archiving**
2. **Scan LTFS Tape**

The caching system should function as a block device accessible via the `/dev/` directory, or any supported mounted filesystem. Possible configurations include:

* Internal RAID on local disks
* Internal RAID on JBOD setups
* SCSI Attached Storage
* iSCSI Attached Storage
* Linux-based block replication (e.g., DRBD, GlusterFS)

### Cache configuration

To proceed when the cache disk is unready, initialize it by running these commands.

<figure><img src="https://1946775891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgzbGsZqZH8Ro8zxRYgwn%2Fuploads%2FyihAm2lmHzatnWsGTRIN%2Fimage.png?alt=media&#x26;token=f47ccde2-d877-4724-8973-daea66e24a4c" alt=""><figcaption></figcaption></figure>

To set up the CACHE Disk, follow these steps:

1. Create the CACHE Disk:

   ```bash
   /opt/nodeum/bin/core/cache_disk_format.sh /dev/sdX
   ```

{% hint style="info" %}
Replace `sdX` with the correct device identifier, likely `sdb`.
{% endhint %}

1. Select the CACHE Disk:

   ```bash
   /opt/nodeum/bin/core/cache_disk_select.sh /dev/sdX
   ```

{% hint style="info" %}
Use the same device identifier as in the previous step.
{% endhint %}

The process will then begin.

After configuration, the disk functions as a cache. You can then check its status.

<figure><img src="https://1946775891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgzbGsZqZH8Ro8zxRYgwn%2Fuploads%2Fh3rQDXxPg2gX4WoU24k6%2Fimage.png?alt=media&#x26;token=fede04d8-e498-40e4-ab8b-a52d94655f4a" alt=""><figcaption></figcaption></figure>

### Extend your cache

To enhance the cache size, adjust the solution according to the server type.

{% hint style="warning" %}
**Backup Your Data:** Before extending the cache, ensure all cache data is copied to secondary storage.
{% endhint %}

#### Increasing Disk Volume Capacity

**RAID**

1. **Add New Disk(s):** Introduce new disk(s) to the existing RAID volume serving as Nodeum Cache.
2. **Wait for RAID Reconstruction:** Allow time for the RAID reconstruction to complete, which may take several days depending on the disk size.

**Virtual Machine Datastore**

1. **Shutdown the Nodeum Server:** Ensure the Nodeum server is safely shut down.
2. **Edit Server Settings:** Adjust the Nodeum server settings by selecting the appropriate disk and expanding its size.
3. **Save Configurations:** Apply and save the new configurations.

#### **Extend the volume partition** <a href="#cacheconfiguration-extendthevolumepartition" id="cacheconfiguration-extendthevolumepartition"></a>

{% hint style="warning" %}
When creating a new disk partition larger than 16TB, the `resize2fs` command (version <1.43) will fail with the error: **"resize2fs: New size too large to be expressed in 32 bits"**. To resolve this, use the latest version of Gparted, which supports the 64-bit version of this command. Below is a guide on how to use Gparted.
{% endhint %}

#### Using GParted Live ISO to Graphically Edit Disk Size

1. **Download the GParted ISO:**
   * Visit: [GParted Download Page](https://gparted.org/download.php)
2. **Create a Bootable USB:**
   * Follow the instructions on the [GParted Live CD/USB Creation Page](https://gparted.org/livecd.php).
3. **Boot from Live ISO:**
   * **For Physical Servers:** Use a CD/USB or a Remote Management Server interface to boot.
   * **For Virtual Servers:** Boot the VM using the downloaded GParted ISO.
4. **Resize Partition Graphically:**
   * After booting, you will see the GParted graphical interface.
   * **Note:** For disks larger than 16 TB, ensure a 64-bit file system. Convert using:

     ```bash
     sudo resize2fs -b /dev/sdb1
     ```
   * Select your Nodeum cache disk (typically `/dev/sdb1`).
   * Click 'Resize/Move'.
   * Drag the vertical bar to adjust partition size.
   * Click 'Resize/Move' again.
   * Apply changes.
5. **Finish Up:**
   * Reboot the server to utilize the new, larger cache size.

#### Command Line Interface Procedure

* Stopping the Nodeum services

```bash
// /usr/mtc/bin>./core_stop all
[core_stop] core_watchdog has stopped successfully (CORE_STOP/cstop_stop_watchdog)
[core_stop] Trying umount (CORE_STOP/cstop_stop_fuse).
[core_stop] Trying umount force (CORE_STOP/cstop_stop_fuse).
[core_stop] Trying umount lazy (CORE_STOP/cstop_stop_fuse).
umount: /mnt/FUSE: not mounted
[core_stop] core_fuse has stopped successfully (CORE_STOP/cstop_stop_fuse).
[core_stop] data_mining has stopped successfully (CORE_STOP/cstop_stop_data_mining)
[core_stop] core_manager has stopped successfully (CORE_STOP/cstop_stop_manager)
[core_stop] library_manager has stopped successfully (CORE_STOP/cstop_stop_library)
[core_stop] core_superv has stopped successfully (CORE_STOP/cstop_stop_superv)
```

* Identify the disk mounted at `/mnt/CACHE` to determine if it needs to be expanded.

```bash
$ /usr/mtc/bin>df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       146G   88G   52G  64% /
tmpfs           1,9G   40K  1,9G   1% /dev/shm
/dev/sda1       465M   39M  402M   9% /boot
/dev/sdb1       886G  7,4G  834G   1% /mnt/CACHE


```

* Umount the Cache disk

```bash
$ /usr/mtc/bin>umount /mnt/CACHE
$ /usr/mtc/bin>mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
```

* Check the disk

Ensure functionality works correctly; stop to address any unfixed errors before proceeding.

```bash
$ /usr/mtc/bin>e2fsck -f -y -v -C 0 /dev/sdb1
e2fsck 1.41.12 (17-May-2010)
Le bitmap de bloc du groupe 707 n'est pas initialisé
alors que le bitmap d'i-noeud est en cours d'utilisation.
Corriger ? oui
 
Le bitmap de bloc du groupe 708 n'est pas initialisé
alors que le bitmap d'i-noeud est en cours d'utilisation.
Corriger ? oui
 
Le bitmap de bloc du groupe 709 n'est pas initialisé
alors que le bitmap d'i-noeud est en cours d'utilisation.
Corriger ? oui
 
Le bitmap de bloc du groupe 710 n'est pas initialisé
alors que le bitmap d'i-noeud est en cours d'utilisation.
Corriger ? oui
 
Le bitmap de bloc du groupe 711 n'est pas initialisé
alors que le bitmap d'i-noeud est en cours d'utilisation.
Corriger ? oui
 
Passe 1 : vérification des i-noeuds, des blocs et des tailles
Passe 2 : vérification de la structure des répertoires
Passe 3 : vérification de la connectivité des répertoires
Passe 4 : vérification des compteurs de référence
Passe 5 : vérification de l'information du sommaire de groupe
 
   63944 inodes used (0.11%)
      98 non-contiguous files (0.2%)
       3 non-contiguous directories (0.0%)
         nombre d'i-noeuds avec des blocs ind/dind/tind : 0/0/0
         Histogramme des profondeurs d'extents : 63863/71
 5658831 blocks used (2.40%)
       0 bad blocks
       1 large file
 
   63702 regular files
     233 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
       0 symbolic links (0 fast symbolic links)
       0 sockets
```

* use parted to extend the partition size

```bash
$ /usr/mtc/bin>parted /dev/sdb
(parted) unit s
(parted) print free
Modèle: VMware Virtual disk (scsi)
Disque /dev/sdb : 2097152000s
Taille des secteurs (logiques/physiques): 512B/512B
Table de partitions : gpt
 
Numéro  Début        Fin          Taille       Système de fichiers  Nom      Fanions
        34s          2047s        2014s        Espace libre
 1      2048s        1887434751s  1887432704s  ext4                 primary
        1887434752s  2097151966s  209717215s   Espace libre
 
(parted) rm 1
(parted) mkpart primary 2048s 2097151966s
(parted) print free
Modèle: VMware Virtual disk (scsi)
Disque /dev/sdb : 2097152000s
Taille des secteurs (logiques/physiques): 512B/512B
Table de partitions : gpt
 
Numéro  Début  Fin          Taille       Système de fichiers  Nom      Fanions
        34s    2047s        2014s        Espace libre
 1      2048s  2097151966s  2097149919s  ext4                 primary
 
(parted) quit
```

* Check the disk again

```bash
$ /usr/mtc/bin>e2fsck -f -y -v -C 0 /dev/sdb1
e2fsck 1.41.12 (17-May-2010)
Passe 1 : vérification des i-noeuds, des blocs et des tailles
Passe 2 : vérification de la structure des répertoires
Passe 3 : vérification de la connectivité des répertoires
Passe 4 : vérification des compteurs de référence
Passe 5 : vérification de l'information du sommaire de groupe
 
   63944 inodes used (0.11%)
      98 non-contiguous files (0.2%)
       3 non-contiguous directories (0.0%)
         nombre d'i-noeuds avec des blocs ind/dind/tind : 0/0/0
         Histogramme des profondeurs d'extents : 63863/71
 5658831 blocks used (2.40%)
       0 bad blocks
       1 large file
 
   63702 regular files
     233 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
       0 symbolic links (0 fast symbolic links)
       0 sockets
--------
   63935 files
```

* Extend the disk size

```bash
$ /usr/mtc/bin>resize2fs -p /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
En train de retailler le système de fichiers sur /dev/sdb1 à 262143739 (4k) blocs.
Début de la passe 1 (max = 800)
Extension de la table d'i-noeudsXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Le système de fichiers /dev/sdb1 a maintenant une taille de 262143739 blocs.
```

{% hint style="warning" %}
If the operation fails, refer to Cautions 1 above.
{% endhint %}

* Mount the disk

```bash
$ /usr/mtc/bin>mount /dev/sdb1 /mnt/CACHE/ -o user_xattr
$ /usr/mtc/bin>df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       146G   88G   52G  64% /
tmpfs           1,9G   32K  1,9G   1% /dev/shm
/dev/sda1       465M   39M  402M   9% /boot
/dev/sdb1       985G  7,4G  927G   1% /mnt/CACHE
```

* Start the Nodeum services

```bash
/usr/mtc/bin>./core_start all
[core_start] core_superv has started successfully (CORE_START/cstart_start_superv)
[core_start] library_manager has started successfully (CORE_START/cstart_start_library)
[core_start] core_manager has started successfully (CORE_START/cstart_start_manager)
[core_start] data_mining has started successfully (CORE_START/cstart_start_data_mining
[core_start] core_fuse has started successfully (CORE_START/cstart_start_fuse).
[core_start] core_watchdog has started successfully (CORE_START/cstart_start_watchdog)
```
