Mauricio Alvarez
2013-Apr-29 11:00 UTC
[Samba] Samba 3 dynamically enable or disable share
Hello, ? ?I wonder if it is possible to dynamically enable/disable samba 3 shares.? Here is my problem.? On a remote server I have 4 removable hard drives, large capacity. I am not using any RAID/JBOD, so each drive is mounted individually (like /mnt/DISK1, /mnt/DISK2 etc) and each drive is individually shared, something like: [STORAGE01] path = /mnt/DISK1 Guest OK = false ... [STORAGE02] path = /mnt/DISK2 Guest OK = false ...? etc... Then I have a bunch of machines that just wait for the share (each machine points to only one share) to be available and then start blindly dumping data into the share (the hosts don't make checks--if the directory structure isn't there, they just re-create it and start dumping data). Problem is, the samba server is in a remote location and if for any reason one of the drives isn't mounted, samba will share the system drive instead, and this will fill up very fast and lock up my server. So, I can make a script to mount the external drives, and only if all went well then start samba. But since my system is best-effort, in case say Disk3 fails to mount, I would like to still be able to share /mnt/DISK1, /mnt/DISK2 and /mnt/DISK4 but NOT /mnt/DISK3 (sharename is STORAGE03).? This would call for either my script to copy to samba.conf one of 2^4 different smb.conf files (covering all possible combinations), then start samba. This is messy, it would be so much better to be able to selectively enable/disable the shares. Any other ideas? Thanks in advance!
Michael De Groote
2013-Apr-29 12:54 UTC
[Samba] Samba 3 dynamically enable or disable share
Wouldn't it be very simple to just create a VERY small partition (e.g. 10MB) on the main drive (the one that your system disk is on), and mount it on e.g. /mnt. Then, even if one of your disks can't mount for some reason, only this very small partition will fill up => no problem for the rest of the system. You would still have to configure your other machines to handle disk full failures and maybe subsequently try another share... Michael 2013/4/29 Mauricio Alvarez <maurialvarez303 at rocketmail.com>> Hello, > > I wonder if it is possible to dynamically enable/disable samba 3 > shares. > > Here is my problem. > > On a remote server I have 4 removable hard drives, large capacity. I am > not using any RAID/JBOD, so each drive is mounted individually (like > /mnt/DISK1, /mnt/DISK2 etc) and each drive is individually shared, > something like: > > [STORAGE01] > path = /mnt/DISK1 > Guest OK = false > ... > > [STORAGE02] > path = /mnt/DISK2 > Guest OK = false > ... > etc... > > Then I have a bunch of machines that just wait for the share (each machine > points to only one share) to be available and then start blindly dumping > data into the share (the hosts don't make checks--if the directory > structure isn't there, they just re-create it and start dumping data). > > Problem is, the samba server is in a remote location and if for any reason > one of the drives isn't mounted, samba will share the system drive instead, > and this will fill up very fast and lock up my server. > > So, I can make a script to mount the external drives, and only if all went > well then start samba. But since my system is best-effort, in case say > Disk3 fails to mount, I would like to still be able to share /mnt/DISK1, > /mnt/DISK2 and /mnt/DISK4 but NOT /mnt/DISK3 (sharename is STORAGE03). > > This would call for either my script to copy to samba.conf one of 2^4 > different smb.conf files (covering all possible combinations), then start > samba. > > This is messy, it would be so much better to be able to selectively > enable/disable the shares. > > > Any other ideas? Thanks in advance! > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >-- Michael De Groote ICT-coordinator Sint-Pietersschool Korbeek-Lo ICT-support Sancta Maria Basisschool Leuven
Mauricio Alvarez
2013-Apr-29 14:05 UTC
[Samba] Samba 3 dynamically enable or disable share
Michael, ? ?I really don't want to repartition--again! But yes, your idea is intresting.? If there really isn't any other option (really? no-one has ever had this problem in the past?), I was thinking of something like this: * Inside each disk, at the root level, create a single directory, call it ROOTDIR01 for DISK1, ROOTDIR02 for disk2 etc. * Modify the entries in smb.conf like so: [STORAGE01] path = /mnt/DISK1/ROOTDIR01 Guest OK = false ... etc... so, if no disk is mounted, we have only /mnt/DISK1 but no ROOTDIR01. If the disk is mounted, the ROOTDIR01 is then visible and gets shared as [STORAGE01] Also, the clients see [STORAGE01] as their root dir, ignoring the ROOTDIR01 sub-level This is very crude, I wonder if it might work.> Wouldn't it be very simple to just create a VERY small partition (e.g. 10MB) on the main drive? > (the one that your system disk is on), and mount it on e.g. /mnt. > > Then, even if one of your disks can't mount for some reason, only this very small partition will > fill up => no problem for the rest of the system. > > You would still have to configure your other machines to handle disk full failures and maybe? > subsequently try another share... > > > >Michael > > >