zfsbud icon indicating copy to clipboard operation
zfsbud copied to clipboard

usage of zfsbud on XigmaNAS (freebsd) causes errors

Open pvswie opened this issue 3 years ago • 2 comments

I have been running XigmaNAS (previously NAS4Free, both based on FreeBSD) for some time. I want to implement better backups using both local cleverly choosen snapshots and replication to a remote XigmaNAS. It seems to me zfsbud can do all of that.

Not to interfere with the operational NAS I created a virtual one and started playing with the zfsbud script. This however quickly led to errors: 'date -d '2023-02-15 -0 month' +%Y-%m-01' is not accepted. FreeBSD 'date' would need -jf '%Y-%m-%d' to convert the date part. For date/time adjustment one should use the date -v option. I only managed to realize adjusting partially: date -v has effect with the current time/date, there however is no effect anymore with a command line specified time/date. Careful reading of the man file revealed -v works on the currect date/time only. I changed zfsbud.sh 'DATECMD=date' into 'DATECMD="date -jf '%Y-%m-%d'"' which overcame the first error (but ignores the date/time adjustment). With this DATACMD in place however the next error pops up: another -d option that is not covered by the DATACMD substitution. Looking at the zfsbud.sh script I have no clue how to fix this through the DATACMD variable.

Conclusion / Question: It seems to me the DATECMD is not able to solve the issues for FreeBSD. I think the FreeBSD date command cannot be used at all since it does not support the date/time adjustment for a command line provided date/time. I will try to ask on the FreeBSD forum about this. Does anyone have any other ideas, I would still prefer to use zfsbud.sh

pvswie avatar Feb 04 '23 12:02 pvswie

Sorry for the late answer. Even though ZFS plays a huge role on BSD, I must admit I don't run BSD systems nor do I test this script over in BSD land. In case you find an answer to this problem, please make sure to let me know. If you don't, take a look at sanoid/syncoid as an alternative; It didn't quite fit my needs (hence this script), but it is great software and it does have some documentation on how to run it on BSD.

gbytedev avatar Mar 23 '23 15:03 gbytedev

You need gnu date program which behaves like Linux one

pkg install coreutils

and then:

DATECMD=/usr/local/bin/gdate

kapitainsky avatar Apr 25 '23 10:04 kapitainsky