2023-09-26 - Create ZFS Dataset And NFS Share And Auto Mount WesleyBallard.com https://serverfault.com/questions/514118/mapping-uid-and-gid-of-local-user-to-the-mounted-nfs-share https://superuser.com/questions/930569/nfs-mount-causes-boot-delay https://www.redhat.com/sysadmin/mount-nfs-filesystems-autofs https://www.linode.com/docs/guides/linux-symlinks/ https://serverfault.com/questions/1050690/why-directories-mounted-with-autofs-are-not-visible-in-filesystem-but-are-acces https://www.linuxquestions.org/questions/linux-software-2/autofs-mount-a-directory-inside-home-username-4175468306/ https://documentation.suse.com/es-es/sles/15-SP1/html/SLES-all/cha-autofs.html 1: Install and enable NFS service apt install nfs-server systemctl enable --now nfs-server.service systemctl enable --now zfs-share.service 2: Create ZFS Pool zpool create -o ashift=12 -m none tank raidz2 /dev/disk/by-id/wwn-UNIQUE1 /dev/disk/by-id/wwn-UNIQUE2 /dev/disk/by-id/wwn-UNIQUE3 /dev/disk/by-id/wwn-UNIQUE4 3: Find uid of user that will own the share. Use the user id for the anonuid and anongid in next step. id wesley 4: Create ZFS Dataset zfs create \ -o atime=on \ -o relatime=on \ -o mountpoint=/tank/Movies \ -o sharenfs="rw=@192.168.1.0/24,all_squash,anonuid=1000,anongid=1000" \ tank/Movies 5: Take ownership of the dataset chown wesley:wesley /tank/Movies/ 6: Set permissions on the dataset chmod 774 /tank/Movies 7: Stop tracker from indexing files touch /tank/Movies/.trackerignore 8: Take ownership and set permissions on the file chown wesley:wesley /tank/Movies/.trackerignore \ && chmod 744 /tank/Movies/.trackerignore -------------------------------------------------------------------------------- Client Machine 1: Install NFS sudo apt install nfs-common 2: Automount share when accessed not on boot with 'autofs' sudo apt install autofs 3: Edit autofs master file sudo vim /etc/auto.master Add /- /etc/autofs.supertank --timeout 30 browse The "/-" means autofs should use the mountpoint specified inside of the file /etc/autofs.supertank. Doing this allows a share to be mounted directly inside of the home folder without the entire home folder being replaced with the shared folder. The option "browse" will cause the shared folder to be displayed even before the folder is mounted. This allows you to easily access the directory by click on it in the file manager and then autofs will mount it and the folder will open. 4: Create /etc/autofs.supertank file sudo vim /etc/autofs.supertank Add /home/wesley/Movies -rw,hard superprox.ballard:/tank/Movies 5: Reload the autofs daemon sudo systemctl reload autofs \ && sudo systemctl status autofs 6: Copy files from internal drive to the share. rsync -avz --progress /mnt/Data/Movies/ /home/wesley/Movies/