Welcome to the IPFire Wiki

This wiki is a community-maintained resource about everything there is to know about IPFire.

Please join in and help us improving it!

Automatic backup of data from IPFire to an external USB-harddisk

IPFire can be set up to generate an automatic rsync backup (synchronization) on connection of a dedicated USB hard drive to the USB port.
Data to be backed up is located on a local disk. The target file system is NTFS.

  • First, /etc/udev/rules.d/23-usb.rules is extended by adding the entry:


ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="sd?1", RUN+="/bin/usb_mount_wrapper.sh"

  • Create a directory /mnt/usb-backup
  • Create a Bash Script /bin/usb_mount_wrapper.sh with the following content
  • Create a Bash Script /bin/usb_mount.sh with the following content:

!/bin/bash

/bin/usb_mount.sh &

exit 0

!/bin/bash

export PATH=/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:

function log() {
echo "$@"
logger -t backup "#### $@ ####"
}

SOURCE="your source"
DEST="/mnt/usb-backup"
date=$(date +%Y%B%d)

log ".....Specialmount NTFS Label Backup......"''

mount.ntfs-3g /dev/disk/by-label/usb-backup /mnt/usb-backup

log ".......start Backup............."

rsync -arlDuv --delete $SOURCE $DEST --log-file=$DEST/$date.txt

log ".......Backup done.............."

log ".......umount usb-hdd..........."

umount /mnt/usb-backup

Before the first test you must reboot the IPFire, format the USB drive as NTFS and you have to label it "usb-backup". By labeling the drive, you prevent other connected USB hard drives being accidentally overwritten.

To check the backup performed a log file is generated by rsync, which is stored with the current date as a text file on the target USB drive.

Edit Page ‐ Yes, you can edit!

Older Revisions • November 15 at 2:11 am