btrbk icon indicating copy to clipboard operation
btrbk copied to clipboard

Using removable HDD as target?

Open SampsonF opened this issue 4 years ago • 4 comments
trafficstars

I want to do:

  • SSD will do hourly snap, even when the target HDD is offline
  • daily snaps will be send over to HDD when it is online (let's say, the HDD will online once every 7 day)

Is my below conf file OK for that?

cat /etc/btrbk/snap.conf ` timestamp_format long stream_buffer 512m snapshot_preserve_min latest snapshot_preserve 24h 7d 4w

target_preserve_min no target_preserve 0h 21d 10w *m *y

volume /var/vols/250G snapshot_dir _btrbk_snap target send-receive /var/vols/8T/_btrbk_backup/250G subvolume 850evohome subvolume 850evoroot subvolume var_log `

SampsonF avatar Jul 24 '21 08:07 SampsonF

This should work, did you try it by now? (sorry for the late reply)

You can use btrbk run (and have it complain about missing target disk if not connected, but snapshots will still be created), or:

  • btrbk snapshot if you know that the disk is not connected
  • btrbk resume to sync external disk

digint avatar Aug 06 '21 12:08 digint

Thank you!

Yes, I tried. When target disk is not connected, btrbk.service will logged as failed in journal but local snaps are indeed created.

Yes, btrbk snapshot and btrbk resume works as expected.

SampsonF avatar Aug 06 '21 21:08 SampsonF

When target disk is not connected, btrbk.service will logged as failed in journal but local snaps are indeed created.

Ah, right. btrbk exits with a different code (10 = backup abort) though, but you probably don't want to catch this as it could as well mean that something else was not backuped. Using "snapshot" and "resume" is definitively the better solution here. https://github.com/digint/btrbk/blob/master/doc/btrbk.1.asciidoc#exit-status

digint avatar Aug 06 '21 21:08 digint

I changed my btrbk.service file like this:

[Unit]
Description=btrbk backup
Documentation=man:btrbk(1)

[Service]
Type=oneshot
ExecStartPre=/usr/sbin/btrbk -v -p snapshot
ExecStart=/usr/sbin/btrbk -v -p resume
ExecStartPost=/usr/sbin/btrbk -v prune

btrbk.log

The run at 14:00 is using old config (just a single ExecStart=/usr/sbin/btrbk -v run) The run at 15:00 is using new config above.

Next, I will create one more systemd-timer, so that:

  • hourly - ExecStart=/usr/sbin/btrbk -v -p snapshot
  • Daily - ExecStart=/usr/sbin/btrbk -v resume

SampsonF avatar Aug 07 '21 06:08 SampsonF