Page tree

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.

How to partition a new hard disk

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:

cat /proc/partitions

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 /dev/sda.

STEP 1: If the device is present, you need to partition it using:

fdisk /dev/sdb

For example:

Command (m for help): n
Command action
e extended
p primary partition (1-4)

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 /newdrive.

To verify if the bind was done correctly, run mount and check if /var/spool/asterisk/monitor and /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

How to make changes persistent after reboot

Add the following lines into /etc/fstab:

/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

How to copy the old files to the new location

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

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.