btrbk
btrbk copied to clipboard
should lock to avoid parallel invocation
I had added an external harddrive, adjusted btrbk.conf to backup to it, and manually started btrbk run
. Since it is the first invocation, it takes awhile to complete.
Meanwhile cron job also invoked btrbk and now there are two of them dumping in parallel
yoh 3875614 0.0 0.0 16220 4816 pts/19 Ss+ Oct14 0:06 | \_ zsh
yoh 2703946 0.0 0.0 16652 7052 pts/46 Ss Oct19 0:17 | \_ zsh
root 1790245 0.0 0.0 8684 3388 pts/46 S Oct31 0:00 | | \_ sudo -s
root 1790246 0.0 0.0 9088 2632 pts/46 S Oct31 0:00 | | \_ /bin/zsh
root 1790267 0.0 0.0 18352 4444 pts/46 S+ Oct31 0:00 | | \_ /usr/bin/perl /usr/sbin/btrbk run
root 1790285 0.0 0.0 2400 364 pts/46 S+ Oct31 0:00 | | \_ sh -c btrfs send /mnt/btrfs/.snapshots/home.20201022 | mbuffer -v 1 -q -m 512m | btrfs receive /mnt/backup/_btrbk/
root 1790286 98.2 0.0 12756 372 pts/46 Rl+ Oct31 784:07 | | \_ btrfs send /mnt/btrfs/.snapshots/home.20201022
root 1790287 2.7 1.6 535012 525496 pts/46 Sl+ Oct31 22:02 | | \_ mbuffer -v 1 -q -m 512m
root 1790288 5.0 0.0 4560 1872 pts/46 S+ Oct31 39:57 | | \_ btrfs receive /mnt/backup/_btrbk/
root 1835428 0.0 0.0 2748 1764 ? Ss 07:33 0:00 /usr/sbin/anacron -d -q -s
root 1835664 0.0 0.0 2400 580 ? S 07:38 0:00 \_ /bin/sh -c run-parts --report /etc/cron.daily
root 1835665 0.0 0.0 2296 424 ? S 07:38 0:00 \_ run-parts --report /etc/cron.daily
root 1835673 0.0 0.0 6604 1580 ? S 07:38 0:00 \_ /bin/bash /etc/cron.daily/btrbk
root 1835674 0.0 0.0 18308 11412 ? S 07:38 0:00 \_ /usr/bin/perl /usr/sbin/btrbk run
root 1835687 0.0 0.0 2400 652 ? S 07:38 0:00 \_ sh -c btrfs send /mnt/btrfs/.snapshots/home.20201023 | mbuffer -v 1 -q -m 512m | btrfs receive /mnt/backup/_btrbk/
root 1835688 98.7 0.0 12756 608 ? Rl 07:38 91:55 \_ btrfs send /mnt/btrfs/.snapshots/home.20201023
root 1835689 2.9 1.6 535012 525728 ? Sl 07:38 2:46 \_ mbuffer -v 1 -q -m 512m
root 1835690 7.7 0.0 4560 2020 ? S 07:38 7:10 \_ btrfs receive /mnt/backup/_btrbk/
$> ls -l /mnt/btrfs/.snapshots/
total 0
drwxr-xr-x 1 root root 218 Jul 31 14:44 home.20201022/
drwxr-xr-x 1 root root 218 Jul 31 14:44 home.20201023/
drwxr-xr-x 1 root root 218 Jul 31 14:44 home.20201024/
...
not sure how unkosher that would be.. I will interrupt cron one for now.
flock
or alike could have been used to prevent cron invocation due to btrbk already being running
edit : killed cron job, disabled it for now, and removed /mnt/backup/_btrbk/home.20201023 since expect manually invoked btrbk to want to transmit the it later on
You can set "lockfile" in btrbk config file:
https://github.com/digint/btrbk/blob/master/btrbk.conf.example#L81
not sure how unkosher that would be.. I will interrupt cron one for now.
From a btrfs point of view, this should be kosher ;-)
You can set "lockfile" in btrbk config file:
https://github.com/digint/btrbk/blob/master/btrbk.conf.example#L81
Thank you! I will!
IMHO locking should be default mode of operation, even if not explicitly specified, or explicitly disabled
Yes, I think so too @yarikoptic