allanjude / zxfer

A continuation of development on zxfer, a popular script for managing ZFS snapshot replication
BSD 2-Clause "Simplified" License
123 stars 40 forks source link

add option to compress zfs send #62

Open totalAldo opened 5 months ago

totalAldo commented 5 months ago

Hi Allan,

Is there is a recommended way to compress the zfs send portion when using ssh? I looked at the -D option but that doesn't seem to work when using ssh to send because it's not escaped.

I added experimental support for piping zfs send through zstd -3 and then decompressing using zstd -d on the receiving host.

If this functionality is useful, I'd be happy to clean up the implementation and submit a pull request. totalAldo/zxfer

example: zxfer -v -d -F -z -O user@host -R zroot localpool/backup/zroot

which generates something like: ssh user@host "zfs send -i start_snap end_snap | zstd -3" | zstd -d /sbin/zfs receive -F dest

and the zstd command can be customized using -Z zxfer -v -d -F -Z "zstd -T0 -9" -O user@host -R zroot localpool/backup/zroot

I saw on open pull request that uses -z and -Z for different purposes so if the options need to change, can do that as well.

Here's a link to the relevant code: https://github.com/totalAldo/zxfer/blob/9a7b4e1da5305952863ddbe518403b8c8c18521b/zxfer#L1355-L1462