Solved How to synchronize samba server?

ZFS snapshots are never writable, even for root.

For a zfs filesystem, you can use zfs set readonly=on filesystem

So, on samba server host, I have following lines in /etc/crontab to do replicating:
Code:
# take snapshots
30    9-17/1    *    *    1-6        root    zfsnap snapshot -s -S -v -a 2w -r zroot/jtanks/samba/store1 >> /var/log/zfsnap.log
30    0,18,21    *    *    2-6        root    zfsnap snapshot -s -S -v -a 2w -r zroot/jtanks/samba/store1 >> /var/log/zfsnap.log

# incremental remote replication to backup server
30    22    *    *    1-6        root    zxfer -dFkPv -I keylocation,keyformat,pbkdf2iters -T root@192.168.1.151 -R zroot/jtanks/samba/store1 backup/samba
30    23    *    *    1,3,5        root    zxfer -dFkPv -I keylocation,keyformat,pbkdf2iters -T root@192.168.1.151 -R zroot/jtanks/samba/store2 backup/samba

40    0    *    *    2-7        bxbzq    rsync -azvH --delete --progress --delay-updates /jails/samba/store1 bxbzq@192.168.1.161:/project
0    0    *    *    2,4,6        bxbzq    rsync -azvH --delete --progress --delay-updates /jails/samba/store2 bxbzq@192.168.1.161:/project

On 192.168.1.151, I do # zfs set readonly=on backup/samba
On 192.168.1.161, I do # zfs set readonly=on zroot/project

I'm a bit confused, if the filesystems are set readonly, how can them be written by zxfer or rsync?
 
Last edited:
When a zfs filesystem is set readonly, that means it can’t be modified via the standard filesystem interface (standard “posix” file/directory manipulation that operates on a mounted file path), but the zfs filesystem/dataset can still have updates applied to it by a zfs recv operation.

rsync only operates via the standard filesystem interface, so it won’t be able to update a readonly filesystem.
 
Back
Top