devros Posted September 27, 2018 Share Posted September 27, 2018 I currently have a zpool of a few SSDs with a few ZFS volumes on there. I need to export one of the volumes over NFS. The problem is that, unlike the SMB settings where you can add extra config, there is no such option for NFS. Unassigned devices won't recognize ZFS volumes, so I can't use that. If I use the zfs set sharenfs=on command, it will work then, but will not stay shared after a reboot or if any changes are made to any share setting. My solution was to write a script that runs when the array is 1st started that echos the lines of config I need into /etc/exports and then restarts nfsd. The problem is that whenever some config changes are made, it results in /etc/exports getting blown away, regenerated and a restart of nfsd. Any thoughts on how I could get the two extra lines I need added every time /etc/exports get regenerated? TIA, -dev Quote Link to comment
FlamongOle Posted May 14, 2022 Share Posted May 14, 2022 Super old thread, but I have the same problem. I just do exactly that myself. Sometimes it drops out because of another config somewhere in Unraid. And Samba I wanna use less possible. Quote Link to comment
vonProteus Posted October 6, 2022 Share Posted October 6, 2022 i created 3 scripts for this problem one to regenerate shares from zfs #!/bin/bash -e zfs get sharenfs -H -o name,value,source -t filesystem | grep -v off | grep -v "inherited from" | while IFS=$'\n' read LINE; do LINE=($LINE) NAME=${LINE[0]} SHARENFS=${LINE[1]} echo regenerating share $NAME with $SHARENFS zfs set sharenfs=off $NAME zfs set sharenfs=$SHARENFS $NAME done second one to run on every shutdown of array to backup zfs nfs shares to $BACKUPLOCATION #!/bin/bash -e BACKUPLOCATION=/mnt/tank/storage/unraid/zfs-nfs/backup/ rsync --verbose --archive --human-readable --progress --partial --checksum --delete-after /etc/exports.d/ $BACKUPLOCATION and last one to restore backup on every start of array #!/bin/bash -e BACKUPLOCATION=/mnt/tank/storage/unraid/zfs-nfs/backup/ rsync --verbose --archive --human-readable --progress --partial --checksum $BACKUPLOCATION /etc/exports.d exportfs -ra Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.