I’ve been quite impressed by the new UI for the new Unity arrays. The pains of JAVA/Flash annoyances are a thing of the past with the new sleek, smooth interface on board.
There are still some things missing however. One of the tasks I had before me was to create a significant amount of filesystems for use with discrete NFS shares.
The requirements were for 143 NFS shares, 300GB each with sequential naming.
Creating single (or even a handful of these) would take just a minute or 2 but doing them in bulk is not really feasible or sensible, it may have been easier if there was an option in the UI for multiple “increments or counts”. But alas, not yet ?
Of course, this type of task can still be completed using the included automation tools, which in the Unity’s case is UEMCli. With some quick Powershell this was an easy one.
Adding filesystems can be completed using the /unitycli /stor/prov/fs command and the create operator, the format is;
1 2 3 4 5 6 |
Format /net/nas/nfs create {-server <value> | -serverName <value>} [- hostname <value>] [-v4 {yes | no}] [-secure {no | yes [-kdcType {Windows | custom}]}] [-username <value> {-passwd <value> | - passwdSecure}] [-extendedUnixCredEnabled {yes|no}] [- credCacheRetention <value> |
My requirements were for 143 @ 300GB. I’m going to include a Description and set the Deduplication, Access Policy and MultiProtocol options over the default requirements.
To have the multiples created, I’ll define a number range array and then wrap the command in a “for each” loop.
The $fsid variable is used for the iterations and also as part of a concatenation to sequentially name the File Systems and the Description.
1 2 3 4 |
$fsid= (001..143) | % { "ImageCache0"+$_ } foreach ($id in $fsid) { uemcli -d arrayhostname.local -u Local/unitycli /stor/prov/fs create -name $id -descr MI_$id -server nas_2 -pool Pool0 -size 300G -thin yes -dataReduction yes -type multiprotocol -accessPolicy windows -replDest no } |
The resulting output is fairly droll, but the tasks completes;
You may notice there’s one thing missing here, the NFS Exports ! Strangely enough, the UI dialog allows you to create a default SMB/NFS share at the same time you create a FileSystem. No sic option currently exists in the CLI… Odd, but I’m sure we’ll get there.
In any case, we can easily append a “change” process to the loop and create it as required, at the same time. Here, for consistency, I’ll use the same numbering and include the hosts I want to have defined Root level access to the export.
1 2 3 4 5 6 |
$fsid= (001..143) | % { "ImageCache0"+$_ } foreach ($id in $fsid) { uemcli -d arrayhostname.local -u Local/unitycli /stor/prov/fs create -name $id -descr MI_$id -server nas_2 -pool Pool0 -size 300G -thin yes -dataReduction yes -type multiprotocol -accessPolicy windows -replDest no uemcli -d arrayhostname.local -u Local/unitycli /stor/prov/fs/nfs create -name $id -descr $id -fsName $id -path "/" -rootHosts "Host_14,Host_15,Host_16,Host_17,Host_18,Host_19" } |
Job done.
Nice scripting!
Cheers Rob 🙂