There are several ways to add more disk capacity to our VitalPBX server, next we will show how to create and connect a remote storage unit.
Scenery
We have two servers:
- VitalPBX Server
- Storage Server
Server installation
Let’s assume that our Storage Server also has Debian 11
Next, we are going to prepare our storage server, for which we install the following software.
apt install nfs-kernel-server
We create a folder, which we are going to share with the VitalPBX Server
mkdir -p /nfs/recondings
If we want all clients to have access to the directory, the permission restrictions must be removed:
chown nobody:nogroup /nfs/recordings/
chmod 777 /nfs/recordings/
Now it is necessary to grant access permissions to the machine that serves as the server, for this we must modify the /etc/exports file
nano /etc/exports
At the end of the file we will add the access instruction for a client:
/nfs/recordings VPBX_IP(rw,sync,no_subtree_check)
Apply the changes and restart the service:
exportfs -a
systemctl restart nfs-kernel-server
In the event that the server’s firewall is configured, it will be necessary to allow access to the clients:
ufw allow from VPBX_IP to any port nfs
Client Installation
On the client (VitalPBX Server) we will install nfs-common:
apt install nfs-common
Create the directory where the server shared folder will be mounted:
mkdir –p /nfs/recordings/
Later we move all the contents of the folder /var/spool/asterisk/monitor to /nfs/recordings/
mv /var/spool/asterisk/monitor/ /nfs/recordings/
Since we no longer have the monitor folder where VitalPBX saved the recordings, we proceed to create a virtual link.
cd /var/spool/asterisk/
ln -s /nfs/recordings/ monitor
Now we change the permissions so that Asterisk is happy.
chown -R asterisk:asterisk monitor
Next we are going to mount the shared directory:
mount STORAGE_IP:/nfs/recordings /nfs/recordings
Permanently mount the shared directory:
nano /etc/fstab
STORAGE_IP:/nfs/recordings /nfs/recordings nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0