Active IQ Unified Manager Discussions

How to confirm that a volume contains no non-qtree data



I am writing a "decommission" workflow i.e. to remove volumes.

One of the requirements is to ensure that the volume only contains a single qtree and that there is no non-qtree data.

I've tried a couple of ways to do this but with no success for various reasons...

Firstly I tried using PowerShell by calling the Invoke-NaSSh cmdlet to perform an "ls" of the volume.  I tried passing "priv set advanced;ls /vol/vol0" as parameters.  This works if it is run on the command line as a standard powershell script but it fails when ran within WFA.  For some reason the ls command produces no output - no error messages logged just no output.

I then moved on to try Perl using the "file-list-directory-iter-*" ZAPI calls.  I successfully scripted this from the command line but again struggled to get this to execute from within WFA.  This time I unserstand the reason though.  ZAPI requires a user name and password to be passed to it.  It uses "getCredentials()" within to pass the credentials that are stored in WFA when establishing the connection to the filer.  The problem is that we are not using the WFA credential cache, we are running the WFA service using a Windows Domain account which is in the administrators group on the filers.  There are over 800 filers in the estate which is the reason why we are running in this mode.  If I populate the WFA credentials cache the workflow succeeds, but this isnt really a scalable option....

If anyone has any suggestions as to how I meet this requirement, or if they know why the PowerShell cmdlet might be failing I would really appreciate it:-)

Many Thanks,



Re: How to confirm that a volume contains no non-qtree data


1. Doesn't On Tap have ls built into it now? You have to run it from priv mode.

priv set advanced

ls /vol/your_volume_name

2. Have you tried the secret java script built into the filer?

java netapp.cmds.jsh

You can use ls after launching that script.

ls /vol/your_volume_name

Not sure how this would return values to WFA, but at least it might be a start.

Re: How to confirm that a volume contains no non-qtree data


Thanks for the response.

You are correct, ls has been built in for several years.

The problem is I need to call it from WFA so PowerShell is the best bet.  But for some reason the Invoke-NaSsh powershell cmdlet called from WFA (whilst in priv set advanced mode) returns nothing.  All other non-priveleged commands run fine,

I wasnt aware of the hidden java shell.  I tried calling this from PoSH as below but no luck:

Invoke-NaSsh -Controller $dst_filer -Command "java netapp.cmds.jsh;ls /vol/vol0" -Credential $cred

It just returns jsh> waits a few seconds and then ls returns nothing.

Any other ideas welcome:-)

Re: How to confirm that a volume contains no non-qtree data



I tried something like this and that did give the output for me:


Connect-WfaController -Array $Array

Get-WFALogger -Info -message $("Listing vol0 volume contents")

$inputRequestXML = "<system-cli><priv>advanced</priv><args><arg>ls</arg><arg>/vol/vol0</arg></args></system-cli>"

$OutputXML = Invoke-NaSystemApi  $inputRequestXML

Get-WfaLogger -Info -message "vol0 ls output"

Get-WfaLogger -Info -message $OutputXML.results."cli-output"


Listing vol0 volume contents

vol0 ls output:










When this experiment was done, the credentials were configured in WFA i.e I used the credential cache.

Did not try with your deployment mode of using Windows domain service. (I dont have that setup right now)

Hopefully, it works for you too.

By the way, 2 queries:

- So, if you do find non-qtree data, are you erroring out and stopping the decommissioning workflow ?

Was that the requirement?

- Are you cross-checking the contents of ls to check whether there is a single qtree with that name using

Get-NaQtree also?



Re: How to confirm that a volume contains no non-qtree data



Adding on top of Shailja's comment. ONTAP also provides power shell command 'Read-NaDirectory' which is equivalent to 'file-list-directory-iter-*'.

C:\PS>Read-NaDirectory /vol/vol2

List the contents of the root directory in volume 'vol2'.



Name   Modified Owner Group   Perm Empty     Type            Size      Created 


----   -------- ----- -----   ---- -----     ----            ----      ------- 



      8/27/2010     0     0   1077 False     directory       4 KB    11/6/2008


      8/27/2010     0     0   2077 False     directory      16 KB    11/6/2008

    lun1                                     file           20 GB    3/19/2009 

      8/22/2010     0     0   1077

    lun2                                     file           20 GB    2/10/2010 

      8/22/2010     0     0   1077

    quorum                                   file            1 GB    2/12/2009

View solution in original post

Re: How to confirm that a volume contains no non-qtree data


Hello shailaja and girirp,

Thanks you both for your responses.

Both methods work and I decided to go with the Read-NaDirectory simply becuase it is easier to read.

Many Thanks,


Earn Rewards for Your Review!
GPI Review Banner
All Community Forums