ghan1t / udev-trigger-zfs-autobackup

Automatically snapshot and sync ZFS datasets when backup disk is attached.
MIT License
4 stars 1 forks source link

set-properties readonly=on does not work #1

Closed ghan1t closed 7 months ago

ghan1t commented 9 months ago

If I use the option -- set-properties readonly=on (did not test other set-properties options) with your script, zfs-autobackup will not recognize backup-name and target-path arguments. It works with standalone zfs-autobackup command.

https://www.truenas.com/community/threads/udev-trigger-zfs-autobackup-to-removable-disk-offsite-backup.100570/post-803248

zfs-autobackup-n -v -d --strip-path=1 --allow-empty --clear-mountpoint --set-properties readonly=on --keep-source=10,1d1w,1w1m,1m1y --keep-target=10,1d1w,1w1m,1m1y testbackup2 testbackup2 zfs-autobackup: error: unrecognized arguments: testbackup2 testbackup2

log2.txt

ghan1t commented 9 months ago

Could you try with a shorter zfs property name? I couldn't run it once with a long property. And you're target goes to a pool directly, not into a dataset? This error could be caused by my script setting the args into sys.argv and then calling the cli method of zfs-autobackup. Maybe some parameters are not parsed correctly. I'll try to make some experiments.

wolmeh commented 9 months ago

And you're target goes to a pool directly, not into a dataset?

Yes, backup target is the pool itself, not a dataset underneath. It works with zfs-autobackup in general but not in combination with your udev trigger script

wolmeh commented 9 months ago

Could you try with a shorter zfs property name?

I will try as soon as possible

wolmeh commented 8 months ago

Hey ghan1t, setting the option --set-properties does not seem to work with your script. This time I wanted to set the property keylocation=none by using the switch --set-properties keylocation=none. Same error like using --set-properties readlonly=on in second run but this time I have got different errors on first run. You can find the logfiles in the attachment

log_secondrun.txt log_firstrun.txt

Probably the parsing problem you assumed?

wolmeh commented 8 months ago

and a shorter zfs property name does not help. Same error with zfs property name "bck" for example.

ghan1t commented 8 months ago

@wolmeh it's again the only parameter with a space, that's probably the reason. I have never tested that before. Will have a look.

ghan1t commented 7 months ago

Hi @wolmeh I have found the reason. zfs-autobackup expects '--set-property readonly=on' as two parameters passed on the cli and not as one parameter with a space. You can do this in the config this way:

ghan1t commented 7 months ago

@wolmeh I made it configurable. It splits parameters by default. Run trigger.sh --update to get the newest version.