[GNC] I'm still a bit confused about when things get saved.

Chris Green cl at isbd.net
Fri Sep 11 07:50:14 EDT 2020


On Fri, Sep 11, 2020 at 06:17:14AM -0500, Fross, Michael wrote:
> 
> > I run incremental backups of all the important data one my system,
> > in particular I run hourly incremental backups of my 'home' directory
> > (I use Linux) and this contains just about everything of significance.
> >
[snip details]
> >
> What backup software did you decide to use Chris? I’ve written some scripts
> to backup my Gnucash files, but have been looking at a more comprehensive
> solution.
> 
Both the 'local' hourly backup and the remote (to the garage) daily
one basically use rsync with linux 'hard links' to provide the
incremental backup.  There's a 'prebackup' and a 'postbackup' script
that do the directory manipulation and to weed out some of the backups
as they get older.  The scripts are written in Python but are only a
few tens of lines long.  All d-i-y.

So, for example, the hourly 'local' backup is:-

    #!/bin/bash
    #
    #
    # Local snapshots to the /bak disk drive
    #
    #
    #
    # Run the pre-backup script
    #
    /home/chris/.cfg/esprimo/bin/prebak.py
    #
    #
    # Backup files using rsync
    #
    rsync -a --exclude-from /etc/rsync.doNotCopy \
        --link-dest=/bak/snapshot/cur  /etc /home /bak/snapshot/new/
    #
    #
    # Run the post-backup script
    #
    /home/chris/.cfg/esprimo/bin/postbak.py

If you're interested (or anyone else is) we can go 'off list' to
discuss further, I'm quite happy for others to use my code.

The big advantage of the rsync 'hard-links' is that the backups are
all 'complete' copies of what's backed up, you don't have to unpack
anything or run a program.  You can find what looks exactly like your
home directory (and /etc as you can see) in the backup, except that
it's how it was x hours or y days ago.

It works because a file that doesn't change only exists in one place
and the files you see in each hourly/daily/weekly backup are [hard]
links to the same file, so it only uses space for one copy of the file.

-- 
Chris Green


More information about the gnucash-user mailing list