psy0rz / zfs_autobackup

ZFS autobackup is used to periodicly backup ZFS filesystems to other locations. Easy to use and very reliable.
https://github.com/psy0rz/zfs_autobackup
GNU General Public License v3.0
601 stars 63 forks source link

Tool does not work at all with RPi4 as source #168

Closed PanWieczorek closed 2 years ago

PanWieczorek commented 2 years ago

Hi! I tried to work out a solution for my problem which is a simple backup for my rpi. SOURCE : rpi4 (zfs version zfs-2.0.2-1~bpo10+1), planed to have only couple of snapshots max TARGET : ubuntu 22.04 (zfs version zfs-2.1.4-0ubuntu0.1), long lasting backup

$ zfs-autobackup --version
zfs-autobackup v3.1.3 - (c)2021 E.H.Eefting (edwin@datux.nl)

On SOURCE I allow pi user to run zfs commands and also a ln -s zfs and zpool to /usr/local/bin (because PATH was not properly set up during ssh session)

Command executed on TARGET: sudo zfs-autobackup --debug --verbose --buffer 64M --keep-source 10,1d1w,0w1m,0m1y --keep-target 20,1d2w,1w1m,1m1y --clear-mountpoint --ssh-source pi@192.168.0.101 docker backup-pool/backups/rpi --force --destroy-incompatible

After a successfull --test pass i tried to run a proper backup, sadly my command went wrong with given error

  [Target] backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927: receiving full
# [Source] CMD    > (ssh pi@192.168.0.101 'zfs send -L zfs_autobackup_option_test')
# [Source] STDERR > cannot open 'zfs_autobackup_option_test': dataset does not exist
# [Source] CMD    > (ssh pi@192.168.0.101 'zfs send -e zfs_autobackup_option_test')
# [Source] STDERR > cannot open 'zfs_autobackup_option_test': dataset does not exist
# [Source] CMD    > (ssh pi@192.168.0.101 'zfs send -c zfs_autobackup_option_test')
# [Source] STDERR > cannot open 'zfs_autobackup_option_test': dataset does not exist
# [Target] CMD    > (zfs recv -s zfs_autobackup_option_test)
# [Target] STDERR > cannot receive: failed to read from stream
# [Target] backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927: Enabled resume support
# [Target] CMD    > (ssh pi@192.168.0.101 'zfs send --large-block --embed --verbose --parsable --props rpi-storage/var/docker@docker-20220909132927 | mbuffer -q -s128k -m64M') | (mbuffer -q -s128k -m64M | zfs recv -u -o canmount=noauto -v -F -s backup-pool/backups/rpi/rpi-storage/var/docker)
# [Source] STDERR > full        rpi-storage/var/docker@docker-20220909132927    4347917576
# [Source] STDERR > size        4347917576
# [Target] backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927: Checking if filesystem exists
# [Target] CMD    > (zfs list backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927)
# [Target] STDERR > cannot open 'backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927': dataset does not exist
! [Target] backup-pool/backups/rpi/rpi-storage/var/docker@docker-20220909132927: error during transfer
! [Source] rpi-storage/var/docker: FAILED: Target doesn't exist after transfer, something went wrong.
! Exception: Target doesn't exist after transfer, something went wrong.
Traceback (most recent call last):
  File "/usr/local/bin/zfs-autobackup", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/__init__.py", line 9, in cli
    failed_datasets=zfs_autobackup.run()
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/ZfsAutobackup.py", line 594, in run
    fail_count = self.sync_datasets(
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/ZfsAutobackup.py", line 433, in sync_datasets
    source_dataset.sync_snapshots(target_dataset, show_progress=self.args.progress,
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/ZfsDataset.py", line 1080, in sync_snapshots
    source_snapshot.transfer_snapshot(target_snapshot, features=features,
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/ZfsDataset.py", line 702, in transfer_snapshot
    target_snapshot.recv_pipe(pipe, features=features, filter_properties=filter_properties,
  File "/usr/local/lib/python3.10/dist-packages/zfs_autobackup/ZfsDataset.py", line 658, in recv_pipe
    raise (Exception("Target doesn't exist after transfer, something went wrong."))
Exception: Target doesn't exist after transfer, something went wrong.

I really don't know how to solve this issue, can I provide you some more information? Or is it enough to point out my problem?

PanWieczorek commented 2 years ago

I didn't allow pi user to send snapshots.... after playing with allow everything worked

psy0rz commented 2 years ago

very nice, thanks :)