I have a setup in which I have a Raspberry Pi B+ with Raspbian as file server, sharing a 5 disk usb rack. I don't whant the rack to be on all the time, so I turn it on when I'm going to use it and turn it off when it isn't needed anymore.
So far, I have been using samba to share the disks. Using samba, I can unmount the disks and turn off the rack without problems. When I turn the rack on again, the drives are automatically mounted and the samba shares are available again.
Due poor performance of the samba shares, I wanted to use NFS shares the same way. However, when I try to unmount the shared drives, I always get the "device is busy" error, so I need first to stop the nfs-kernel-server to be able to turn off the rack. That means that when I turn on the rack again, the shares will not be available until I manually restart the nfs-kernel-server again.
So, is there a way to reproduce the same behaviour that with samba (unmount drives and automatically share them when the rack is turned on)?
Alternatively, is there a way to automatically start the nfs-kernel-server when the drives are automounted?
Thank you and best regards.