Tuesday 01 Oct 2024


Send ZFS dataset over SSH connection

Image copyright.

I wanted to send a dataset from my server to my backup server. I was fed up of using rsync because this dataset has many thousands of pictures, which takes a long time. The dataset contains thumbs and database files for a docker container.

Before I could send the dataset, I need to add permissions on the recieving machine so that the root user is not used. Without this step, the command will fail because the recieve command needs root permission.

zfs allow -u karl compression,mount,create,mount,receive,atime,recordsize pool_name

I added atime and recordsize to my permissions because I have changed these values from the default in the source dataset, from 128k (default) to 1M.

I am now ready to send that data.

zfs send --raw -R pool/dataset@snap1 | pv | ssh -i /home/karl/.ssh/id_ed25519 karl@192.168.1.120 "zfs recv pool/dataset"

--raw will send the encrypted dataset
-R sends all settings and snapshots

Now I have an exact copy of my dataset. I can use the incremental send option to speed up backups going forward.


Backlinks:
index
Journal:Index
Journal:2024:10