When I create a volume, it's a logical constuct and internally only consumes space for a small amount of metadata. If I set the volume guarantee to "volume", then the full space of the volume is "reserved" from the space in the aggregate. Likewise, if I have a LUN in a volume, even though the LUN may be 500GB, if inly 12GB contains blocks that were written to, then it's actually only using 12GB. It appears to take 500GB from the volume because the space for the LUN is reserved by default. It's pretty easy to see this in action with System Manager. Highlight the LUN and then select "edit" remove the checkbox for "space reserved" and click apply. You can edit it again and set the LUN back to space reserved without harming anything. Now, as far as monitoring the space used inside the LUN, that process probably won't work very well. You can however, easily write a script using the Data ONTAP PowerShell Toolkit to mind the "occupied" size of the LUN in the active filesystem using the get-nalunoccupied size cmdlet. In fact, you can use the toolkit to learn quite a bit about what's going on inside your LUNs. Clear-nalunstatistics and get-nalunstatistics in particular would give you a very good idea of what write activity is happening on each LUN. You can find the toolkit here: http://communities.netapp.com/community/interfaces_and_tools/data_ontap_powershell_toolkit J
... View more
You can use read-nafile to place the contents of the snapmirror log in a variable. $log=read-nafile /vol/vol0/etc/log/snapmirror.0 also see get-nafile J
... View more
One way to work with multiple controllers in your loop is to create a collection of naconnection objects. There's an example here: http://communities.netapp.com/docs/DOC-6293 J
... View more
create an object collection. In your for-each, append each aggregate object to your collection, say $AggCollection for instance. Then, pipe the aggregate collection throught sort-object specifying the property to sort on (Name I think in your case) with -Property $AggCollection | sort-object -Property Name In http://communities.netapp.com/docs/DOC-6293 I use foreach to populate an object collection with connection objects. J
... View more
It accepts pipeline by property name. Since a ParentSnapshot name property doesn't exist on a snapshot infobject, you'll want to take your $Snapshot object and add a "ParentSnapshot property by aliasing Name. J
... View more
Take a look at the Data ONTAP PowerShell Toolkit (which is free to NetApp Customers and Partners). If you find something you can't do in SANScreen 6.0, you'll likely be able to do it using the toolkit. J
... View more
Glad to hear that you've got it. It you look over in samples, you'll find an example of a small powershell GUI to import options., Hope this helps. Happy Scripting J
... View more
Thanks Glenn, Your input is greatly apriciated. You are correct that the Data ONTAP PowrShell Toolkit is in it's infancy. Any advice you have to give can only make it better going forward. Thanks again J
... View more
Hi Glenn, Thank you for your feedback. Finding inconsistencies and reporting them is, as you can guess, of the upmost importance. Thank you for all your help and encouragement. J
... View more
Thanks, I'm glad you found it useful. My snippets are meant to be more of ideas of what could be than anything else. They're meant to inspire othere to create solutions. 🙂 Happy Scripting J
... View more
You could look at the portion of space on a LUN that's occupied. There's a sample script using the Data ONTAP PowerShell Toolkit here: http://communities.netapp.com/docs/DOC-6349 J
... View more
You likely have some base set of licenses installed on all your controllers, and some controllers may have additional licenses. You could configure your script in such a way that you import the base, then do a license check before importing optional settings: Import-csv base.csv | set-naoption $Flexcache=get-nalicense |? {$_.Service -eq "flexcache_nfs"} if($Flexcache.Code -ne $null) {import-csv flexcache.csv | set-naoption} Imports the base, then checks for a flexcache_nfs license and imports those settings if the license is present. J
... View more
Get-NaOption auditlog.* autologout.* autosupport.* backup.* bootfs.* cf.* cifs.* cksum.* console.* coredump.* disk.* dns.* ems.* ext_cache.* fcp.* flexcache.* fpolicy.* ftpd.* httpd.* ip.* iscsi.* kerberos.* ldap.* locking.* lun.* ndmpd.* nfs.* nis.* nlm.* pcnfsd.* ra.* raid.* replication.* rlm.* rmc.* rpc.* rsh.* security.* snaplock.* snapmirror.* snapvalidator.* snapvault.* snmp.* ssh.* ssh1.* ssh2.* ssl.* tape.* telnet.* tftpd.* timed.* trusted.* vfiler.* vol.* wafl.* webdav.* | Export-Csv Backup.csv #-Force and then Import-CSV Backup.csv | Set-NaOption Certainly works as you stated. Now if I import backup.csv to another filer of the same version with the same licenses enabled, that works as well. Be aware that, as you mentioned, not all options are available in all versions (opions available in 7.3.3 might not be in 7.2.6 depending on when the feature was implemented). Also be aware that some options require a license to be enabled. Also, instead of editing the CSV manually, try setting desired option with set-naoption, then export it. Happy Scripting J
... View more
Excellent point Clinton, If you change the behavior to throw a terminating error, then you can use try/catch. Beware however if you use this with a pipeline. Let's say I do something like: PS C:\> $SIM1=connect-nacontroller SIM1 PS C:\> Write-Host "Sending invalid command" Sending invalid command PS C:\> try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate} catch {Write-Host "Caught exception."} Invoke-NaSnapmirrorUpdate : Source not set on command line or in /etc/snapmirror.conf file. At line:1 char:60 + try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate <<<< } catch {Write-Host "Caught exception."} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORPARSERERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate Invoke-NaSnapmirrorUpdate : Source not set on command line or in /etc/snapmirror.conf file. At line:1 char:60 + try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate <<<< } catch {Write-Host "Caught exception."} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORPARSERERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate Invoke-NaSnapmirrorUpdate : Source not set on command line or in /etc/snapmirror.conf file. At line:1 char:60 + try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate <<<< } catch {Write-Host "Caught exception."} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORPARSERERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate Invoke-NaSnapmirrorUpdate : Source not set on command line or in /etc/snapmirror.conf file. At line:1 char:60 + try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate <<<< } catch {Write-Host "Caught exception."} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORPARSERERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate Invoke-NaSnapmirrorUpdate : Source not set on command line or in /etc/snapmirror.conf file. At line:1 char:60 + try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate <<<< } catch {Write-Host "Caught exception."} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORPARSERERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate PS C:\> Write-Host "Done" Done PS C:\> I have several volumes, but no snapmirror relationships. because I piped the output of get na-vol to Invoke-nasnapmirrorupdate, I see a failure for each volume in my collection. This happens specifically because the error is non-terminating. Now, if I make it a terminating error and put it in try-catch: PS C:\> $SIM1=connect-nacontroller SIM1 PS C:\> Write-Host "Sending invalid command" Sending invalid command PS C:\> try {get-navol -Controller $SIM1| Invoke-nasnapmirrorupdate -ErrorAction Stop} catch {Write-Host "Caught exception."} Caught exception. PS C:\> Write-Host "Done" Done PS C:\> It bails on the first error and does not even try the rest of the volumes in my collection. What to do? I pipe the output of get-navol to a foreach-object statement where I process the try-catch: PS C:\> $SIM1=connect-nacontroller SIM1 PS C:\> Write-Host "Sending invalid command" Sending invalid command PS C:\> get-navol | foreach-object -Process {try {Invoke-nasnapmirrorupdate $_ -ErrorAction Stop} catch {Write-Host "Caught exception."}} Caught exception. Caught exception. Caught exception. Caught exception. Caught exception. PS C:\> Write-Host "Done" Done PS C:\> Happy Scripting J
... View more
In order to use a catch block, the cmdlet needs to return an exception. If I call "Invoke-nasnapmirrorupdate $null", then an exception is returned, a ParameterBindingValidationException: Invoke-NaSnapmirrorUpdate : Cannot bind argument to parameter 'Destination' because it is null. At line:1 char:26 + invoke-nasnapmirrorupdate <<<< $null + CategoryInfo : InvalidData: (:) [Invoke-NaSnapmirrorUpdate], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate In that case, try {invoke-nasnapmirrorupdate $null} catch {"Invoke-NaSnapMirrorUpdate returned an error"} does indeed work printing "Invoke-NaSnapMirrorUpdate returned an error" on the console. The problem here seems to be that if invalid parameters make it past validation and are sent in the underlying ZAPI call, like: PS C:\> try {invoke-nasnapmirrorupdate -Source SIM1:vol1 vol1} catch {"Invoke-NaSnapMirrorUpdate returned an error"} Invoke-NaSnapmirrorUpdate : Snapmirror error: destination is not in snapmirrored state At line:1 char:31 + try {invoke-nasnapmirrorupdate <<<< -Source SIM1:vol1 vol1} catch {"Invoke-NaSnapMirrorUpdate returned an error"} + CategoryInfo : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Invoke-NaSnapmirrorUpdate], ESNAPMIRRORERROR + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorUpdate As you can see, the problem here is that the cmdlet is not raising an exception at this point for catch to catch. You'd want to specify the error or use trap. J
... View more
I guess my bias is showing. I've known Ed Wilson for a LONG time, since my days at Microsoft, and he's always been there for me. He's a prolific author, with many books to his name, and the current Microsoft Scripting Guy. I'd highly recommend any title by Ed, but that's just me I suppose. Take it with a grain of salt. Happy Scripting J
... View more
With initialize-nacontroller you can set the first interface. Sadly ifconfig and vifconfig didn't make the first cut as these are realitively new APIs. Look for them in the near future. As for options; I have two small samples in documents on this community page. In one, I show how to set options. In the other, I show how to create an object collection from a text file, and perform a series of operations on the object collection (connect to a collection of controllers and set a couple options). In short yes you can create an object collection consisting of options and their values, then loop through setting those option on all the controllers in another collection object. Data ONTAP PowerShell Toolkit - HOWTO: Work with Many Controllers Data ONTAP PowerShell Toolkit - HOWTO: Set Options Happy Scripting J
... View more
Microsoft Windows PowerShell Step by Step By Ed Wilson, AKA the Microsoft Scripting Guys http://www.microsoft.com/learning/en/us/book.aspx?ID=10329&locale=en-us Happy Scripting J
... View more
Hi Ben, If you're working with a single connection, connections are transitive: connect-nacontroller SIM1; get-navol will list on the volumes on controller SIM1. I can keep using other cmdlets without specifying the -Controller, and SIM1 will be used; until I connect to another controller that is. Now if you're working with more than one controller, I suspect you'd like to put the connection objects in a collection. Something like this simplistic example: [object[]]$Simulators=$null;foreach ($SIM in @("SIM1", "SIM2", "SIM3")) {$NewSIM=Connect-nacontroller $SIM;$Simulators=$Simulators+$NewSIM} Now that you've created a "connection collection", I also suspect you'd like to do something creative with it. Perhaps you'd like to set some option on a group of controllers or list all the snapshots or volumes on a the controllers in your connection. Sadly we don't accept pipeline for -Controller today, but perhaps you could use the foreach-object which does, something like: $Simulators | foreach-object -Process {get-navol -Controller $_} Which returns all the volumes on all three members of my "connection collection". Happy Scripting J
... View more
For the NetApp Controller, you'd use get-nsiscsinodename. For the host? PS C:\> $HostInitiator=get-naiscsisession;$HostInitiator.InitiatorNodeName iqn.1991-05.com.microsoft:win-cjrn2t2kse0 PS C:\> I just put the object returned by get-naiscsisession in a variable then output the InitiatiorNodeName of that variable. Does that work for you? J
... View more