World Backup Day 2025

Today March 31st (sorry if you’re in the future) is world backup day. I think recent events have shown us the importance of having a good and recent backup. There are two types of people in this world. Those who backup, and those who will soon learn they should have.

In general you should backup daily and keep a copy local and one somewhere off-site. So when they say comes that something has gone horribly wrong. You can have minimal downtime. Note this can also help you roll back a change. A feature I put into the backup module when I wrote it to speed development was for the CLI. You can use --backupsingle to backup data from a single module. See the following example.
To backup core for example:

fwconsole backup --backupsingle core --singlesaveto /var/spool/asterisk/tmp/

Then you can restore the data with:

fwconsole backup --restoresingle /var/spool/asterisk/tmp/voicemail-20250331-191234-1743448354-17.0.5.29-1736773590.tar.gz

Stay safe my friends

EDIT: As pointed out below the docs and I were a little fuzzy… you specify the destination folder and it has to be a place where the asterisk user has write permissions.

6 Likes

Should this be run as root?
fwconsole backup --backupsingle voicemail --singlesaveto /root/voicemail/

I get the following error after the manifest is made:
In Filesystem.php line 305:

Cannot rename “/tmp/backup/1b83b4b7-89d8-4df8-8d1a-29d77dc2609a/voicemail-20250331-141625-1743444985-17.0.5.29
-1249516429.tar.gz” to “/root/voicemail//voicemail-20250331-141625-1743444985-17.0.5.29-1249516429.tar.gz”: re
name(/tmp/backup/1b83b4b7-89d8-4df8-8d1a-29d77dc2609a/voicemail-20250331-141625-1743444985-17.0.5.29-124951642
9.tar.gz,/root/voicemail//voicemail-20250331-141625-1743444985-17.0.5.29-1249516429.tar.gz): Permission denied

Thanks

1 Like

I think fwconsole does most of its tasks as the asterisk user so it is likely the backup has to go somewhere the asterisk user has write permissions… I swear I have done it to root but more likely I did it in /usr/src where I did most of my dev work… Played with it for a second and it wrote out to tmp…

root@freepbxdev17:~/backups# fwconsole backup --backupsingle voicemail --singlesaveto /tmp/voicemail
Transaction ID is: 783c909c-f1aa-485d-9d03-80fcb7f26c2e
Processing voicemail
Working with voicemail module
Exclude Greeeting ?no
Exclude VMRecords ?no
Exporting Feature Codes from voicemail
Exporting Advanced settings from voicemail
        Adding file to tar: files/etc/asterisk/voicemail.conf
        Adding module manifest for voicemail
***In single restores mode dependencies are NOT processed***
There was nothing to cleanup
Finished created backup file: /tmp/voicemail/voicemail-20250331-190958-1743448198-17.0.5.29-1752732634.tar.gz

I did try and create a folder in /root/ called backups and chown it to asterisk but I think because the asterisk user can’t see the parent it still fails.

Thanks for the quick response.
entered fwconsole backup --backupsingle voicemail --singlesaveto /tmp/voicemail
back up created successfully.
downloaded to my desktop
uploaded to a new server
entered fwconsole backup --restoresingle /tmp/voicemail/voicemail-20250331-152514-1743449114-17.0.5.29-1526620864.tar.gz
Transaction ID is: 704133ac-a3cf-426e-9fae-810055f1bed6
Extracting backup…
In single restores mode dependencies are NOT processed
Resetting voicemail module data
Dropping table voicemail_admin…Done
Updating tables voicemail_admin…Done
OPERATOR_XTN added
VM_OPTS added
VM_GAIN added
VM_DDTYPE added
VMX_OPTS_LOOP added
VMX_OPTS_DOVM added
VMX_TIMEOUT added
VMX_REPEAT added
VMX_LOOPS added
Generating CSS…Done
Restoring from voicemail [FreePBX\modules\Voicemail\Restore]
923 Files Restored
Importing Table voicemail_admin from voicemail
Cleaning table: voicemail_admin

Done

Finished

Restore completed successfully
Wish I knew about this backup/restore a week ago before the server went into production.

Thanks

2 Likes

The only real backup, is a tested backup. Well done!