Node Backup

As I’ve mentioned elsewhere on the website, backing up the Node is a somewhat controversial topic. Some individuals prefer to back up the entire microSD card regularly, while others choose not to back up anything at all. Since my Node is housed in a project box and removing the microSD card is a bit of a hassle, I opt to back up only the user files on a regular basis.

There is a well-written document on the HamVoip website about backing up your node.
After reading it several times, I developed a backup/restore solution tailored to my own needs.

Backup The Entire Node

The official backup document raises two valid points  where its says...

"With the advent of the down-loadable image and on-line updates, doing a complete image backup has become much less of a necessity. A much better way to backup is to selectively save the files that you change or are likely to change in configuring your Allstar server"

Backing up only the files that the user modifies to a USB thumb drive using the built-in backup script appealed to me due to its speed and efficiency. This approach also eliminates the need to dismantle the enclosure to access the microSD card, as I always have a USB stick connected to one of the Pi’s USB ports.

Backup Script

To initiate the backup process, SSH into the Raspberry Pi and execute the file-backup.sh script from any directory. You will be presented with the following prompt:

This script will back up your node information and files that are likely to change, which are not included in Hamvoip updates.
Would you like to continue? [y/n]

After selecting Y to proceed, you will be prompted to choose the backup destination: either a [U]SB stick or a [F]ile.
As I want to backup to the USB stick inserted into the Pi, I choose U

Backing Up to USB
I have a 4GB USB drive permanently connected to the Raspberry Pi, which serves as the primary destination for my selective backups. To begin the process, I simply select U from the menu, and within a few seconds, the backup is completed with the following message:
Backup Complete:
The backup file is located at:
/media/usb/RaspPi_2025-10-08-2333.tgz

Note: I modified the date format in the script to reflect the UK format, so the updated message now reads:
Backup Complete:
The backup file is located at:
/media/usb/RaspPi_2025-10-08-2333.tgz

Restore Script

The restore script is designed to quickly restore backups from the USB drive without the need to remove the microSD card from the Raspberry Pi.
To begin, SSH into the Pi and run file-restore.sh from any directory. You will then be presented with a list of available backups.
Choose the one you wish to restore and follow the on-screen prompts to complete the process.

Video Demonstration

Here is a short video demonstrating how I use both the backup and restore scripts to efficiently back up and restore data from the USB thumb drive, which is always connected to the Raspberry Pi. The video walks you through the entire process, showcasing how quick and simple it is to safeguard your data without the need to remove the microSD card.

Choosing What To Backup

By default, the backup script will back up the following directories and their subdirectories:

  • /root
  • /etc/asterisk
  • /usr/local/etc
  • /var/spool/cron
  • /srv/http/allmon2/allmon.ini.php
  • /srv/http/supermon/allmon.ini
  • /srv/http/supermon/global.inc

To customise the backup, open the script located at /usr/local/etc/backup.conf 
Locate the line beginning with INCLUDE_LIST= and adjust the content between the quotation marks to reflect your desired directories.

Example:
Since I use the Pi as a web server, I wanted to back up everything in the /srv directory.
Rather than adding each folder individually, I simply included /srv/http, which automatically includes all files and subdirectories within the /srv/http folder.

INCLUDE_LIST="/root /etc /usr/local/sbin /etc/asterisk /usr/local/etc /var/spool/cron /srv/http ${BACKUP_INFO_FILE}"