Editing Files from the Data ONTAP CLI

While setting up a Network Appliance storage system today for a customer, I ran into a situation that was a bit puzzling for a moment.  I needed to change the IP address on the storage system’s clustered controllers, but in order to do that I needed to edit some files in the /etc directory on the root volume.  Normally, that wouldn’t be a big deal; I’d just mount the root volume (vol0) via CIFS or NFS from my MacBook Pro and go from there.

However, in this particular instance, the customer hadn’t licensed the CIFS and NFS protocols because this storage system would be used strictly as an iSCSI target for a VMware ESX Server deployment.  That meant there would be no mounting the root volume this time.  So how does one go about editing files in the Data ONTAP CLI?

Excellent question.  The answer is the “priv set advanced” command.  Rightly so, NetApp warns you that running “priv set advanced” exposes functionality that can be dangerous; don’t muck around in there or you’re likely to find yourself with a non-functional NetApp storage system.  However, with a bit of caution, the advanced commands are just what we need in this situation.

The advanced command set includes useful commands like “ls” (to list the files in the /etc directory, for example), “rdfile” (think of “cat” or “more” from a Linux/UNIX system), and “wrfile” (for redirecting standard input to a text file).  While there’s no text editor per se, these three tools can get us most of the way there.

So here’s how I used the advanced command set to change the IP addresses of the storage system:

  1. Enabled the advanced command set with “priv set advanced.”
  2. Displayed the current contents of the /etc/hosts file with “rdfile /etc/hosts”.
  3. Created /etc/hosts.new (containing the contents of /etc/hosts with the changes I needed) using “wrfile /etc/hosts.new”.
  4. Verified the contents of /etc/hosts.new using rdfile.
  5. Renamed /etc/hosts to /etc/hosts.setup using “mv”.
  6. Renamed /etc/hosts.new to /etc/hosts using “mv”.
  7. Rebooted the storage system for the change to take effect.

Upon the reboot, the storage system was now using the new IP addresses requested by the customer.  Problem solved!

Tags: ,


  1. munkey’s avatar

    You don’t need Ontap to be in advanced mode to use rdfile or wrfile they will run in administrative mode. ls and mv are advanced commands

  2. Ausmith1’s avatar

    One of the little things that NetApp don’t usually tell people is that CIFS can be started without a valid license unlike any of the other licensed parts of Data ONTAP. Their field engineers use this trick to upload OS updates quickly on iSCSI/FCP only filers. It will complain about being unlicensed and if you don’t turn it off as soon as you are finished it will end up having it’s status sent back on your autosupports. If this continued I’m sure that a sales person from NetApp would be by sooner or later to see if you would like to buy a CIFS license…
    I’m guessing that there are limits on how many CIFS clients you can have in the unlicensed mode but it certainly works fine for a single user to edit/upload files.

  3. slowe’s avatar

    Ah, now THAT is a helpful piece of information to have. Next time I run into this situation, I’ll give that a whirl and see how it works (and, of course, post more information here as well). Thanks for sharing that with us!

  4. Timo’s avatar

    “java netapp.cmds.jsh” is useful for somethings. Not so much for editing, but for looking around.

  5. clive’s avatar

    FTP is also very useful in this situation – lets you create files and directories (I can’t find a command to do the latter in the ontap CLI, and needed to create a .ssh directory for keys).

  6. ezaton’s avatar

    java netapp.cmds.jsh does not work with paths with spaces in their names. It does weird things, and does not allow escaping of spaces (and probably other special characters).

  7. dave’s avatar

    here is another one that might come in handy priv set diag

  8. Tushar Karande’s avatar

    Create CIFS share of vol0 and then modify /etc/hosts file which is availble in CIFS share

Comments are now closed.