Network and Storage Protocols

Migrate shares onto filer


Is there a tool / script which can re apply CIFS shares once data has been migrated from a file server onto a filer?

Also, if you snapvault a cifs volume to a secondary filer which subsequently needs to be made read-writeable in a disaster what can be used to re apply shares (or do these shares already exist)?? 



Details of CIFS shares are held in the file /vol/rootvol/etc/cifsconfig_share.cfg. You could copy the contents to that file on the secondary, edit any differences in path and restart CIFS BUT this is not the way SnapVault is designed to be used.

SnapVault is designed as an archive where you restore data back from the secondary to the primary, if you're looking for a DR solution then SnapMirror is the correct product. SnapMirror replicates a volume from source to destination and keeps the destination read-only. In a DR scenario the mirror is broken and the destination volume becomes read-write, when the source site comes up the data flow is reversed and the source volume synchronised with the destination volume. Once complete the relationship from source to destination is resynchronised and updates carry on as before.




My mistake, I did mean snapmirror.

What about re applying shares from a windows file server onto a filer? Any tools out there for this?


I don't know of any tools to do this specifically.  You could use excel to do this...

From the windows server command line type "net share", this will give you a list of all the shares on that server:

blah1     c:\blah1     Comments for blah1

blah2     c:\blah2     Comments for blah2

blah3     c:\blah3     Comments for blah3

Out put this list into a text file and then import it into excel using spaces as your delimiter.  This will put each field into it's own column.

Strip out the c:\ using find and replace

       A            B            C

1     blah1     blah1     Comments for blah1

2     blah2     blah2     Comments for blah2 

3     blah3     blah3     Comments for blah3

Then use the CONCATENATE function in excel to build your new cifs commands:

=CONCATENATE("cifs shares -add """,A1,""" ""/vol/cifsvol/",B1,""" -comment """,C1,"""")

=CONCATENATE("cifs access """,A1,""" S-NONE ""nosd""")

The above "formulas" will produce the following:

cifs shares -add "blah1" "/vol/cifsvol/blah1" -comment "Comments for blah1"

cifs access "blah1" S-NONE "nosd"

Use these two lines for each share to build your new /etc/cifsconfig_share.cfg file.

Terminate and restart cifs.


Excel and concatenate is clever.  I am cautious editing cifsconfigshare though.  In many cases it doesn't catch everything (a share or access doesn't process after edit sometimes and not sure if support would support shares created by editing directly).  We often script to create the shares on the cli with cifs running. The key thing with that is that every new share has a default everyone "full control" which often isn't the requirement...when parsed in the config file at cifs startup there is no cifs access unless specifically listed.  But when running cifs shares -add from the cli there is always an  everyone full control access which may need to be removed/modified.