Applies to VoipNow 3 and higher!
This article describes how to use a different partition from the one where VoipNow is installed to store your voicemails and call recordings.
After adding a new hard disk to the server, you will have to partition it accordingly. In order to do so, you need to run:
This command should list all existing hard disks and partitions. If you already have a
/dev/sda (common for SATA devices), then whenever you add another device, it should be displayed as
STEP 1: If the device is present, you need to partition it using:
Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 1 First cylinder (1-2654, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-2654, default 2654): Using default value 2654 Command (m for help): w (Write and save partition table) The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
STEP 2: Then you need to format the partition as ext4 using the following command:
mkfs -t ext4 /dev/sdb1
STEP 3: Create a directory for the new partition and mount it:
mkdir /newdrive mount /dev/sdb1 /newdrive
Check the How to Copy the Old Files to the New Location section in case you want to copy old recordings/voicemails to the new hard disk.
STEP 4: Bind the Recordings directories to a new directory by using the following command lines:
service asterisk stop mkdir -p /newdrive/monitor && mount --bind /newdrive/monitor /var/spool/asterisk/monitor mkdir -p /newdrive/voicemail && mount --bind /newdrive/voicemail /var/spool/asterisk/voicemail service asterisk start
Now, all new voicemails and recordings will be written into the new directory called
To verify if the bind was done correctly, run
mount and check if
/var/spool/asterisk/voicemail are present.
To unmount the directories, run:
umount /var/spool/asterisk/monitor umount /var/spool/asterisk/voicemail
STEP 5: Make sure the new directories will be owned by Asterisk and their permissions are set to 750. For example:
chown asterisk.asterisk /newdrive/monitor chown asterisk.asterisk /newdrive/voicemail chmod 750 /newdrive/voicemail chmod 750 /newdrive/monitor
Add the following lines into
/dev/sdb1 /newdrive ext4 defaults 1 2 /newdrive/monitor /var/spool/asterisk//monitor bind defaults,bind 0 0 /newdrive/voicemail /var/spool/asterisk/voicemail bind defaults,bind 0 0
To copy old files to the new location, run:
This must be done before mounting the folders from newdrive to /var/spool/asterisk
cp -Rpf /var/spool/asterisk/monitor /newdrive/monitor cp -Rpf /var/spool/asterisk/voicemail /newdrive/voicemail