Skip to main content

How to attach, mount and expand recording volumes / NAS

Updated this week

Important! Before making any changes to your recording volume, we strongly recommend backing up your data. If you require assistance with these instructions, please contact Teramind Support at [email protected].

Attaching a Recording Volume

Note: These instructions assume you are logged into the Teramind appliance console or an SSH session as the prod user and have switched to the root account using sudo -i. If you are not using the root account, you must prefix commands requiring elevated access with sudo. An SSH session is recommended to allow for copying and pasting disk IDs.

To attach a recording volume to your Teramind appliance, follow these steps:

1. Attach the Disk: Create and attach a disk using your Hypervisor tools. Please refer to the On-Premise Deployment Guide for specific steps on attaching a second virtual disk to the Teramind VM.

2. Stop the Teramind Service:

systemctl stop teramind

3. Identify the New Disk: Run the lsblk command to verify that the OS recognizes the new disk:

lsblk

mceclip0.png

4. Create a New Partition:

fdisk /dev/sdb
mceclip1.png

4a. Press n to create a new partition. Leave the First sector and Last sector options at their default values:

mceclip2.png

4b. Press p again to view the new partition table:

mceclip3.png

4c. Press w to write the changes to the disk.

5. Create a File System: Format the new partition using the following command:

mkfs.ext4 /dev/sdb1
mceclip5.png

6. Verify the Partition: Confirm the new partition is visible:

lsblk
mceclip6.png

7. Retrieve the UUID: Find the ID of the new partition:

blkid /dev/sdb1
uuid.png

Copy the UUID for the next step.

8. Update the File System Table: Edit /etc/fstab and add a mount record using the UUID obtained in Step 7:

mceclip8.png

9. Handle Existing Recordings (Optional): If you do not have existing recordings in your rec directory, proceed to Step 10. Otherwise, follow these steps to keep your recordings intact:

9a. Rename the current directory:

cd /usr/local/teramind
mv rec rec_old

9b. Create a new directory for future recordings:

mkdir rec

10. Mount the Disk:

mount -o remount -a

10a. Verify the mount:

lsblk
df -h
mceclip9.png

11. Update Permissions: Set the correct permissions to allow the Teramind service to write recording files:

chown -R prod. /usr/local/teramind/rec
chmod -R 775 /usr/local/teramind/rec

12. Restart the Service: Start the Teramind service to begin saving data to the new disk:

systemctl start teramind

13. Sync Existing Data (Optional): If you created a backup in Step 9, transfer the data to the newly mounted disk:

rsync -a /usr/local/teramind/rec_old/ /usr/local/teramind/rec

Note: this process may take a significant amount of time depending on the volume of data. Once finished, you may safely delete the old directory:

rm -rf /usr/local/teramind/rec_old

14. Verify in Dashboard: Open the Teramind admin dashboard to confirm the disk is displayed correctly.

Mounting a Recording Volume to a NAS

These instructions assume you are logged into the Teramind appliance console or an SSH session on the master node as the prod user. If you do not have these credentials or the credentials for the tm_onsite database, please contact Teramind Support at [email protected].

To mount a recording volume to Network Attached Storage (NAS), follow these steps:

1. Enable NFS Access: Configure your NAS to allow access within the local network via NFS. This Synology tutorial explains how to access files on Synology NAS within the local network (NFS)*.

Disclaimer: The link above directs to a third-party website and is provided solely for your convenience. Teramind does not verify the accuracy of third-party content and is not liable for any damages resulting from the use of these instructions. Similar documentation for other NAS devices can be found online; for further assistance, please contact your NAS provider’s technical support team.

2. Stop the Teramind Service:

sudo systemctl stop teramind

3. Transfer Data to NAS: Use rsync to move existing recordings to the NAS. For example:

Bash

rsync -av /usr/local/teramind/rec/ 192.168.1.88:mnt/Teramind/

4. Connect to the Database: Access the tm_onsite database:

psql -h 127.0.0.1 -U tm_onsite

5. Configure the NFS Path: Insert the NFS share details into the kv_store table. Adjusted for the actual NFS share IP and path. For example:

insert into kv_store(key,value) values ('nfs.rec_dir','ipaddress:/volumes2/Teramind');

5a. To verify the value was added, you can use this query:

select * from kv_store where key='nfs.rec_dir';

5b. (Optional) If you've made any mistake, you can remove the entry by using this command:

delete from kv_store where key = 'nfs.rec_dir';

6. Restart the Service:

sudo systemctl restart teramind

7. Verify the Mapping: Confirm the appliance is communicating with the NAS using one of the following commands:

df -h

OR

df -HP -t nfs

If your NAS IP and directory appear in the output, the mount is active.

Note: The second command shows only network storage, filtering out local partitions for a cleaner view.

Expanding a Recording Volume

Note: These instructions assume you are logged into the Teramind appliance console or an SSH session as the prod user and have switched to the root account using sudo -i. If you are not using the root account, you must prefix commands requiring elevated access with sudo. An SSH session is recommended to allow for copying and pasting disk IDs.

These steps also apply to the primary disk. Since the primary disk is typically mapped as /dev/sda1, you should replace sdX or sdb1 in the example commands with sda1 when performing these actions on the primary volume.

1. Expand the Virtual Disk: Use your hypervisor management console to increase the disk capacity. Note that you may need to shut down the Teramind appliance first, as many platforms do not support "hot-growing" a disk while the VM is active. Additionally, ensure that any existing snapshots or checkpoints are merged, as their presence typically prevents the hypervisor from modifying the base disk size.

2. Verify Disk Recognition: Confirm that the operating system recognizes the expanded disk capacity by running the lsblk command. If the new size is not reflected in the output, a system reboot may be required to refresh the hardware table.

lsblk
expand-1.png

2. Rescan the Disk: If the OS does not automatically recognize the new size, force a rescan using one of the following commands:

  • Option A (By volume letter):

    echo 1 > /sys/class/block/sdX/device/rescan

    (Replace X with your volume letter, such as sda or sdb.)

  • Option B (By SCSI address):

    echo 1 > /sys/class/scsi_device/X:X:X:X/device/block/device/rescan

    (Replace X:X:X:X with the specific SCSI address of your device. For example, 2:0:1:0).

3. View the Partition Table:

fdisk -l /dev/sdX

Replace /dev/sdX with your disk (e.g., /dev/sdb):

mceclip15.png

4. Edit the Partition:

fdisk /dev/sdX

Replace /dev/sdX with your disk (e.g., /dev/sdb):

mceclip16.png

4a. Type d at the prompt to delete the primary partition:

expand-2.png

4b. Type n at the Command prompt to create a new partition:

mceclip18.png

4c. Type p for primary. Press Enter at the partition number, first sector, and last sector prompts to accept default values. IMPORTANT: When asked "Do you want to remove the signature?", answer No:

sig.png

4d. Type p to view the table and ensure settings are correct:

4e. Type w to write the table to the disk:

expand-3.png

5. Update the Kernel: Update the OS kernel’s table to recognize new disk size by executing the following commands:

partx --update /dev/sdX
partx --update /dev/sdX1

Replace /dev/sdX and /dev/sdX1 with with your own volumes. (e.g., /dev/sdb and /dev/sdb1):

mceclip23.png


6. Check Size: Execute the lsblk command to ensure the OS can recognize the new partition size. If the size hasn't updated, reboot the OS.

expand-4.png

7. Expand the File System: If everything looks good, execute the resize2fs command to expand the file system. For example:

resize2fs /dev/sdX1

Replace /dev/sdX1 with your volume (e.g., sdb1):

mceclip25.png

8. Final Confirmation: Execute the following command to verify if the changes have been applied successfully:

df -h

Expanding a Recording Volume Greater Than 2TB (Secondary Volumes Only)

Warning! This procedure is strictly for secondary volumes. Do not attempt these steps on a primary volume or root partition, as it will render the server unbootable.

While these instructions follow a similar logic to the previous section, they include the creation of a GPT (GUID Partition Table). This is required to support volume sizes exceeding 2TB, which standard MBR partition tables cannot accommodate.

These instructions assume you are logged into the Teramind appliance console or an SSH session on the master node as the prod user. If you do not have these credentials or the credentials for the tm_onsite database, please contact Teramind Support at [email protected].

1. Access Your Instance: Connect to your instance via SSH or through the VM's management console:

mceclip0.png

2. Initialize the Disk: Run the fdisk utility on the specific disk you wish to expand:

sudo fdisk /dev/sdX

Replace /dev/sdX with your actual device identifier (e.g., /dev/sdb):

2T-1.png

You may see a warning regarding the 2TB DOS partition limit; you can safely ignore this as we are converting to GPT:

mceclip3.png

3. Display Current Partitions: Type p and press Enter to view the current partition table and confirm you are working on the correct disk:

mceclip0.png

4. Create a New GPT Partition Table: Type g to create a new, empty GPT partition table. This is required to support volumes larger than 2TB:

mceclip1.png

5. Create the New Partition: Type n to add a new partition:

mceclip2.png

Hit Enter for all prompts (Partition number, First sector, and Last sector) to accept the default values. This ensures the partition uses the entire available space.

6. Verify the Changes: Type p again to review the new partition table. You should see a single partition covering the full size of the disk:

mceclip4.png

7. Write and Exit: Type w to write the changes to the disk and exit the fdisk utility:

mceclip5.png

8. Update the OS Kernel: Inform the operating system of the partition table changes without rebooting by running:

sudo partprobe

9. Resize the Filesystem: Now that the partition is enlarged, you must expand the actual filesystem to fill that space. Replace /dev/sdX1 with your partition (e.g., /dev/sdb1):

sudo resize2fs /dev/sdX1

10. Finalize: In some environments, a reboot may be necessary if the kernel does not automatically refresh the block device capacity. You can use the df -h after resizing to verify the new available space.

Did this answer your question?