I have two 2-TB hard drives (not the boot/system drives) with a single partition in each, that I share with Samba. Mountpoints are in
These are also the path of two samba shares, named backup1 and backup2. As soon as these shares are up, they start getting filled with (lots of) data from other machines in the network (some machines write to backup1, others to backup2, but none writes on both).
Everything works as planned, no problem with Samba. This server (on remote location) is configured to auto-reboot in case of power loss etc. Also, I have two drives in RAID1 as system/boot drives, to make sure the server can (almost!) always at least boot.
The problem is in case the system boots fine, but for some reason cannot mount one (or both) of the 2 TB hard drives: samba would start sharing
/mnt/drive02, the large capacity drive (s) is not mounted so all the data in fact ends up on the system drive, filling it up and making the system unusable or unable to be accessed remotely via ssh.
So I don't think is a good idea entering the partitions of the two 2 TB drives in
/etc/fstab, since I noticed some problems in boot in case one of the data drives is for example disconnected. Again this is important as the server is in remote location and cannot rely on an operator intervention to fix on-screen messages such as "drive not ready, keep waiting, press S to skip mounting, M for manual..."
So I have a small script which tries mounting the data drives a minute after boot, and this fixes the fstab part. Now on to Samba.
What I would like is to have Samba start after some time (no problem) but also "dynamically" enable or disable the two shares. So, for example, if the 2nd data drive fails, my script will only be able to mount the 1st data disk and samba would only advertise the backup1 share (with data being written to the 2-TB disk drive); the other share (backup2, mapped to
/mnt/drive02) would be not advertised/disabled, but at least I have one share running (and some of my machines can pour data into it).
Of course, the easy way is to have samba start only if both data drives are mounted, but this is an all-or-nothing solution