[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Backup Times on a Linux desktop




I'll respond on the issue of triggering the backup, rather than the
specific backup software itself, because my solution for triggering
is separate from the backup software I use (rdiff-backup).

I trigger (some) backup jobs via systemd units, that are triggered by
the insertion of my removeable backup drive. So, I would suggest that
instead of doing a network backup to your 4T drive on the other side of
your pi, you could attach the drive directly to your Computer when you
want to initiate a backup. This doesn't address your desire to have it
happen in the background, though, because you would still need to
remember (or prompt yourself) to attach the drive. I provide the details
anyway just in case they are interesting.

My "backup-exthdd.service" is what performs the actual backup job:

   [Unit]
   OnFailure=status-email-user@%n.service blinkstick-fail.service
   Requires=systemd-cryptsetup@extbackup.service
   After=systemd-cryptsetup@extbackup.service

   [Service]
   Type=oneshot
   ExecStart=/bin/mount /extbackup
   ExecStart=<your backup job goes here>
   ExecStop=/bin/umount /extbackup
   ExecStop=/usr/local/bin/blinkstick --index 1 --limit 10 --set-color green

   [Install]
   WantedBy=dev-disk-by\x2duuid-e0eed9b6\x2d03f1\x2d41ed\x2d80a4\x2dc7cc4ff013c3.device

(the mount and umount Execs there shouldn't be needed, they should be
addressed by systemd unit dependencies, but in practice they were
necessary when I set this up. This was a while ago and systemd may
perform differently now.)

My external backup disk has an encrypted partition on it. So, the job
above actually depends upon the decrypted partition. The job
"systemd-cryptsetup@extbackup.service" handles that. The skeleton of the
job was written by systemd-cryptsetup-generator automatically, based on
content in /etc/crypttab; I then had to adapt it further. The entirety
of it is:

   [Unit]
   Description=Cryptography Setup for %I
   SourcePath=/etc/crypttab
   DefaultDependencies=no
   Conflicts=umount.target
   BindsTo=dev-mapper-%i.device
   IgnoreOnIsolate=true
   After=systemd-readahead-collect.service systemd-readahead-replay.service cryptsetup-pre.target
   Before=cryptsetup.target
   BindsTo=dev-disk-by\x2duuid-e0eed9b6\x2d03f1\x2d41ed\x2d80a4\x2dc7cc4ff013c3.device
   After=dev-disk-by\x2duuid-e0eed9b6\x2d03f1\x2d41ed\x2d80a4\x2dc7cc4ff013c3.device
   Before=umount.target
   StopWhenUnneeded=true

   [Service]
   Type=oneshot
   RemainAfterExit=yes
   TimeoutSec=0
   ExecStart=/lib/systemd/systemd-cryptsetup attach 'extbackup' '/dev/disk/by-uuid/e0eed9b6-03f1-41ed-80a4-c7cc4ff013c3' '/root/exthdd.key' 'luks,noauto'
   ExecStop=/lib/systemd/systemd-cryptsetup detach 'extbackup'

So when the remote disk device with the UUID
e0eed9b6-03f1-41ed-80a4-c7cc4ff013c3 appears on the system, its
appearance causes systemd to start the "backup-exthdd.service" job,
which depends upon the bits to enable the encrypted volume.

(the "blinkstick-fail.service" and ExecStop=/usr/local/bin/blinkstick…
line relate to a notification system I have: this is my headless NAS,
and the "blinkstick" is a little multicolour LED attached via USB. In
normal circumstances it is switched off. When a job is running it
changes to a particular colour; when the job finished successfully, it's
green - indicating I can unplug the drive (it's all unmounted etc.), if
anything goes wrong it turns red.)


Reply to: