Skip to content

Encrypted datasets & adding syncoid --sendoptions / --receiveoptions | change destination compression to zstd-19 #9

@samssausages

Description

@samssausages

Mainly posting this to ask if there is a reason syncoid --sendoptions and --receiveoptions flags are not configurable in the script, other than simplicity? Wondering if I'm overlooking something obvious.

  1. When backing up an encrypted dataset, currently they are backed up as decrypted. Probably fine for many people, but I wanted my backup to carry over the encryption. This can be accomplished by adding the flag sendoptions=w to the syncoid command in the script

  2. For backups, I'm not worried about speed, so I figured I'd set compression to zstd-19 and recordsize to 1M. Space savings depend on the data, but often a few extra percent can be gained, some of my datasets save 10% over LZ4. I did this by adding the flag --recvoptions=o recordsize=1M o compression=zstd-19 to the syncoid command.

EDIT:
Thinking about this, the -w (raw) command on the send doesn't allow for re-compression. So when using this with an encrypted dataset, it doesn't re-compress.
So as presented here, it's either or. Encryption or higher compression. I still find it useful as is, but I will need to update the notes if that's the route we take.
However, I'm exploring ways to do both right now, but I just started looking into that and will update in another post below.
I guess this is where the LUKS encryption that Unraid applies to array disks may fill in the blank, and give us the ability to have both.
The more I think about this, that is probably the way to go... have it decrypt the dataset on backup, as it does now, then rely on the LUKS encryption on the Unraid Array. And still get the benefits of the higher compression by using the --recvoptions flags mentioned above.

Comments as I'm brainstorming this are appreciated!

How I configured my script:

Step 1:
I added the configuration variables to the "Replication Setting" section, around line 57. Probably best to leave the variable blank by default and have a note with the options so they can copy/paste it over to enable. Or, I guess I could make it more human friendly with a "enable encryption? yes/no". Let me know if that works better for you.

# Optional Advanced flags for syncoid send and receive options. Leave empty or customize for your dataset and cold storage requirements
syncoid_send_options="--sendoptions=w" # --sendoptions=w is useful for encrypted datasets and sends raw encrypted dataset
syncoid_receive_options="--recvoptions=o recordsize=1M o compression=zstd-19" # set recordsize & compression at destination to the max with --recvoptions=o recordsize=1M o compression=zstd-19 Must consider this when restoring, as may want to change that back

Step 2:
I added the variables to the syncoid replicate snapshot command, around line 355. Now looks like:

/usr/local/sbin/syncoid $syncoid_send_options $syncoid_receive_options "${syncoid_flags[@]}" "${source_path}" "${destination}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions