Last modified: 2022-08-28 11:10

The example shows how af can be used to create local, remote and offline archives or backups from a local computer or network share.

Real life example


I do my daily computer hobby on two devices, one Raspberry Pi 400, which I use most of the time, and a 10 inch Netbook from 2010. To access the files from both devices I use a NAS that exports them via NFS. So, how is the backup working with af?

Directory level

For the directories where I edit the source files I use a configuration like

dir     /var/backups/pi/archive-files
history HISTORY
editor  +vi

omit    \.(o|tar\.gz)$

to create a local archive of previous files. I use these copies in two cases:

  1. I started editing something, discovering later that it is a dumb idea. The local archive gives me an easy way back.
  2. When I'm debugging things, I sometimes diff the current version of a file against an older.

But, since the archive is on the same computer and disk, it is not a backup. Backups are stored on the NAS, which runs also an smb share. This needs

gio     smb://wzk@nas.local/home
dir     netzwerk-speicher/backups/archive-files

to be added to the .archive-files.conf. To create a backup, I run

$ af mount nas:
$ af create nas:

and I do this NAS backups every few days (local copies daily).

NFS backups

So the working data (NFS) and the backups (smb) are on the NAS. This could fail too and backups to another device are required. I have a short shell script that fetches all modified files from NFS into a an archive on the Raspberry. (No one said that you can't store backups on a client).



if [ ! -d "$TP" ]; then
    echo "$0: nfs is not mounted" >&2

af -f /dev/stdin "$@" <<EOF
  src $SRC
  dst /var/backups/pi/nfs
  omit \.(o|class|zip|tar|gz|jar)$

I try to run this script once a week.

Offline backups

Now there is still the worst case that all my IT devices are cybered at once. Offline backups help to recover (partly - as far as the latest backup goes) from that. The NAS has its own backup tools and schedule but I use from a USB drive to have directly accessible file backups. To create a backup, I

The configuration file is moba/conf/pi-400/net.conf with this content:

src     /home/pi/net/
omit    ([:]|\.(class|o)$)

This configuration works from the Raspberry. To run the backup from the Netbook too, I would have to create a similar configuration file in the moba/conf/my-netbook directory.