Welcome to the IPFire Wiki

This wiki is a community-maintained resource about everything there is to know about IPFire. Join us and help us improving it!

Looking for something?

Use the search and find answers to everything about IPFire. If you cannot find what you are looking for, join our community and talk to fellow IPFire users, developers and everybody else involved in the project.

IPFire Community

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:

filename = /etc/udev/rules.d/23-usb.rules

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:

filename = /bin/usb_mount_wrapper.sh

#!/bin/bash

/bin/usb_mount.sh &

exit 0

filename = /bin/usb_mount.sh

#!/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 • August 27 at 9:52 pm • Jon