I have a NAS (WD MyCloud) which has by default NFS/SMB access enabled. I also have a raspberry pi, that I would like to use as a git server that is addressable over internet using a SSH connection. The data would be stored on the NAS.To sum up:Internet -> router -> raspberry -> NASI've managed to mount the NAS share with NFS, but when I do this, the NAS never sleeps since it is mounted by the raspberry pi. I only make a few commits, and it would be better if the NAS is active only when needed.Is it possible to achieve this using NFS? using another technology? Is it possible to unmount the NFS share after a time and remount it automatically when needed?
mount a NAS network share, but let the NAS sleep
mount;raspberry pi;git;nas
I found this question on my StackExchange profile. Since then, I found the answer I was looking for:Instead of doing NFS mounts, I am now using SSHFS to access the files, which gives me encryption and authentication on the NAS.The public key of the raspberry is saved on the NAS and configured so that I can do a ssh git@cloud without entering a password. user git must have access to the required folders.Then, I am using AutoFS on the raspberry to automatically mount the sshfs when needed.Create /autofs mountpointmkdir /autofsin /etc/auto.master (user git on the raspberry has UID/GID of 1005/1000, replace accordingly with the UID/GID of the user that will have access to the mountpoint)/autofs /etc/auto.git uid=1005,gid=1000, --timeout=30, --ghostin /etc/auto.git (/nfs/git is the mountpoint on the cloud server)git -fstype=fuse,port=22,rw,allow_other :sshfs\#git@cloud\:/nfs/gitthen the /autofs/git will point to /nfs/git on the server. A service restart may be required to apply these changes, I don't remember very well.