Using the database query option on Celerra & VNX File commands


EMC has added a hidden query option on some of the nas commands that allows you to directly query the NAS database. I’ve tested the ‘-query’ option n the nas_fs, nas_server, nas_slice and nas_disk commands, however it may be available on other commands as well. It’s a powerful command with a lot of options, so I took some time to play around with it today. The EMC documentation on this option in their command line reference guide is very sparse and I haven’t done much experimentation with it yet, but I thought I’d share what I’ve found so far.

You can view all of the possible query tags by typing in the commands below. There are dozens of tags available for query. The output list for all the commands is large enough that it’s not practical to add it into this blog post.

nas_fs -query:tags
nas_server -query:tags
nas_slice -query:tags
nas_disk -query:tags

Here’s a snippet of the tags available for nas_fs (the first seven):

Supported Query Tags for nas_fs:
Tag           Synopsis
ACL         The Access Control List of the item
ACLCHKInProgress         Is ACLCHK running on this fs?
ATime         The UTC date of the item’s table last access
AccessPolicyTranslationErrorMessage         The error message of the MPD translation error, if any.
AccessPolicyTranslationPercentComplete         The percentage of translation that has been completed by the Access Policy translation thread for this item.
AccessPolicyTranslationState         The state of the Access Policy translation thread for this item.
AutoExtend         Auto extend True/False

The basic syntax for a query looks like this:

nas_fs -query:inuse==y:type=uxfs:IsRoot=False -Fields:Name,Id,StoragePoolName,Size,SizeValues -format:’%s,%s,%s,%d,%d\n’

In the above example, we are running the query based on three options. We want the file system to be in use, be of the type uxfs, and not be root. In the fields parameter, we want the file system’s name, ID, Storage Pool name, size, and size values. Because our output has five fields, and we want each file system to have it’s own line in the output, we add five formatting options separated by commas (for a csv type output), followed by a ‘\n’ to create a carriage return after each file system’s information has been outputted.

Here are the valid query operators:

= pattern match
== exact match
=- not less than
=+ not more than
=* any
=^ not having pattern
=^= not an exact match
=^- is less than
=^+ is greater than
=^* not any (none)

The format option is not well documented. The only parameters I’ve used for the format option are q and s. From what I’ve seen from testing the options, The tag used in the ‘-fields’ parameter is either simple or complex. A complex tag must be formatted with q, a simple tag must be formatted with s. Adding the ‘\n’ to the format option adds a carriage return to the output. If you use the wrong format parameter, it will display an error like this: “Error 2110: Invalid query syntax: the tag (‘[Tag Option]’) corresponding to this format specifier (“%q”) is not a complex tag”.

-format:’%s’ : Simple Formatting
-format:’%q’ : Complex Formatting

Below are some examples of using the query option. I will add more useful examples in the future after I’ve had more time to dive in to it.

To get the file system ID:

nas_fs -query:Name==[file system name] -format:’%s\n’ -fields:VolumeID

List all file systems with their sizes:

nas_fs -query:inuse==y:type=uxfs:IsRoot=False -Fields:Name,Id,StoragePoolName,Size,SizeValues -format:’%s,%s,%s,%d,%d\n’

List all file system quotas on the array:

nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’

List quota info for all file systems:

nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’

List all Checkpoint file systems:

nas_fs -query:inuse=y:type=ckpt:isroot=false -fields:ServersNumeric,Id,Name,SizeValues -format:’%s,%s,%s,%s\n’

List all the Server_params for a specific server_X:

nas_server -query:Name=server_2 -format:’%q’ -fields:ParamTable -query:Name== -fields:ChangeEffective,ConfiguredDefaultValue,ConfiguredValue,Current,CurrentValue,Default,Facility,IsRebootRequired,IsVisible,Name,Type,Description -format:’%s|%s|

List the current Wins/DNSDomain Config:

nas_server -query:Name=server -fields:Name,DefaultWINS,DNSDomain -format:”%s,%s,%s\n”

For a detailed file system deduplication report:

nas_fs -query:inuse=y:isroot=false:type=uxfs -fields:Deduplications -format:’%q’ -query:RdeState=On -fields:Name,FsCapacity,SpaceSaved,SpaceReducedDataSize,DedupeRate,UnreducedDataSize,TimeOfLastScan -format:’%s,%s,%s,%s,%s,%s,%s\\n’

12 thoughts on “Using the database query option on Celerra & VNX File commands”

  1. The command to report all Filesystems using a quita would be great but it seems that it doesn’t work.

    [user1@nas1 ~]$ nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’
    Error 2110: Invalid query syntax: (in nested query) every field must have a format; add format(s) to accommodate fields
    [user1@nas1 ~]$

    1. Thanks for commenting, Patrick. I copied and pasted a few of the commands on this blog post from another source and didn’t test them. I don’t remember the source. I’ll take some time to review the commands and see if I can find the syntax error.

      1. I tested this command for viewing filesystems with a quota and it works:

        nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’

        I don’t have quotas implemented, but here’s what my output looked like:

        [nasadmin@scelerra01 ~]$ nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’ | more

        1. Thats strange, since on my Systems (VNX5300 and VNX5700) with Treequotas on almost every filesystem the command still doesn’t work:

          [ammannpa@nas1 ~]$ nas_fs -query:\* -fields:ID,TreeQuotas -format:’%s:\n%q#\n’ -query:\* -fields:FileSystem,Path,BlockHardLimit,BlockSoftLimit,BlockGracePeriod,BlockUsage -format:’%s : %s : %s : %s : %s : %s\n’
          Error 2110: Invalid query syntax: (in nested query) every field must have a format; add format(s) to accommodate fields
          [ammannpa@nas1 ~]$

          Probably we don’t have the same Code Level:
          [ammannpa@nas1 ~]$ nas_version
          [ammannpa@nas1 ~]$

          I will try to find out why it doesn’t work and if i found the problem i will let you know.

  2. I noticed a problem when cutting and pasting the command direclty from the blog post into a putty session. I was just testing it again and couldn’t figure out why it worked the last time I tried it but not this morning. After closely looking at the command, I noticed the single quotes around the format command (-format:’%s:\n%q#\n’) transformed into periods (-format:.%s:\n%q#\n.) when I pasted the command. Edit the line after pasting it and change the periods back to quotes, and the command should work.

  3. Hi, thank you for this post. I found it extreamly informative. I was wondering if you have used the RWServers tag before? I can’t seem to get it to respond with the information that I need:

    /nas/bin/nas_fs -query:IsRoot=False,Type=uxfs -fields:RWServers -format:’%s\n’
    LINKED_LIST [0xB7CAF660]
    active: Void
    first_element: Void
    object_comparison: BOOLEAN = False
    before: BOOLEAN = True
    after: BOOLEAN = False
    count: INTEGER_32 = 0

    active: LINKABLE [STRING] [0xB7CB4658]
    first_element: LINKABLE [STRING] [0xB7CB4658]
    object_comparison: BOOLEAN = False
    before: BOOLEAN = True
    after: BOOLEAN = False
    count: INTEGER_32 = 1

      1. I got some help from a co-worker with this. Turns out there is a %L format option. I’m still not sure exactly what it does, but it works. Now I am trying to get the ReplicationSessions field to work. Any ideas, please let me know.

        $ /nas/bin/nas_fs -query:Name=index2 -format:’%L,%L,%s,%s,%s\n’ -fields:RWservers,rwvdms,name,Size,MaxSize

  4. from the output of query (nas_fs -query:inuse==y:type=uxfs:IsRoot=False -Fields:Name,Id,StoragePoolName,Size,SizeValues -format:’%s,%s,%s,%d,%d\n’) – what’s the last value in the ‘SizeValues’ list? If this the ‘blockcount’ it is not being reported the same as in the nas_fs -size command.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.