Network Attached Storage​

 View Only

 Script to create a large number of shares on HNAS 5000 series cluster

George Done's profile image
George Done posted 02-24-2022 09:01
I am deploying an HNAS 5200 2-node cluster at a customer new to Hitachi NAS. They need to create about 80 CIFS shares and start migrating from NetApp and severla Windows  servers. they would like to create those shares using a script and an associated .csv file or similar  with something like

share_name, filesystem_name, vvol, quota_values, owner, etc

I was wondering if anyone have some script which could be used (with modifications) for such purpose.
William Jansen Van Nieuwenhuizen's profile image
William Jansen Van Nieuwenhuizen
Hello George

Have a look at our Knowledge base here, I believe you can do this with a quick shell, PowerShell or python script. 

I have some colleagues like @Johann du Toit that might have some specific examples for you.
Albert Hagopian's profile image
Albert Hagopian
You would have to look at the API for how it creates shares, etc - as it doing what is requested will take multiple calls.

Internally within our QA/dev team, we do not have anything available to fulfill this request.
Tammy Waldschmidt's profile image
Tammy Waldschmidt
Hi George,

Did you happen to get/create a script to do this?
George Done's profile image
George Done

Hi Tammy,
In the end I did not create really a script but an Excel file which was constructing in the last column the right command based on the other columns. Then I could just copy the content of the last column and paste it to the HNAS command line, simiilar with info below.

EVS EVS ID EVS_Share EVS_Share_Fullpath FileSytem EVS_Volume COMMAND_ViVOl Command_CIFS_SHARE
glpdstghnas1 1 AccentureMOFS \\glpdstghnas1\AccentureMOFS FS1 /AccentureMOFS  virtual-volume add  -e fs1 AccentureMOFS /AccentureMOFS cifs-share add -e AccentureMOFS FS1 \AccentureMOFS
glpdstghnas1 1 archive \\glpdstghnas1\archive FS1 /archive  virtual-volume add  -e fs1 archive /archive cifs-share add -e archive FS1 \archive
glpdstghnas1 1 eupdvwapp093 \\glpdstghnas1\eupdvwapp093 FS1 /eupdvwapp093  virtual-volume add  -e fs1 eupdvwapp093 /eupdvwapp093 cifs-share add -e eupdvwapp093 FS1 \eupdvwapp093
glpdstghnas1 1 eupdvwapp093_3 \\glpdstghnas1\eupdvwapp093_3 FS1 /eupdvwapp093_3  virtual-volume add  -e fs1 eupdvwapp093_3 /eupdvwapp093_3 cifs-share add -e eupdvwapp093_3 FS1 \eupdvwapp093_3
glpdstghnas1 1 eupdvwapp099 \\glpdstghnas1\eupdvwapp099 FS1 /eupdvwapp099  virtual-volume add  -e fs1 eupdvwapp099 /eupdvwapp099 cifs-share add -e eupdvwapp099 FS1 \eupdvwapp099