Archive

Archive for the ‘Command Line’ Category

NetApp Save Config Command

April 27th, 2009

I think it’s very important to save a config of a good setup. Firstly it’s a great reference if you ever need to go back and refer to things, secondly it’s a great way to show what you did was actually correct and that you did configure things correctly from the start!

There is a handy tool provided within ONTAP to do entire config dumps, compares and restores. This is limited to the filers base configuration and doesn’t necessarily include areas like volume setup.

b2net-filer01> config
Usage:
config clone <filer> <remote_user>
config diff [-o <output_file>] <config_file1> [ <config_file2> ]
config dump [-f] [-v] <config_file>
config restore [-v] <config_file>

The command is very simple and straight forward. You start by dumping out the configuration from the filer. This automatically goes into /etc/configs. From here you can then clone the config if needed, or compare (diff) the config. Running diff is a very good way of comparing a config between 2 points in time, if you aren’t sure what has changed, or even if you are comparing a filer upgrade and you copy the config files between the 2 systems (checkout NetApp File Copy). And finally you can also use the restore feature, although this would probably require a reboot, and may have a knockon affect to what may or may not be required in various other config files within /etc.

Overall a very useful command. I use this most for taking backups of filer configs and comparing them between similar systems (for instance primary and DR), or even comparing configs over time.

VN:F [1.7.8_1020]
Rate this post:
Rating: 10.0/10 (2 votes cast)

Command Line , , , ,

NetApp File Copy

April 11th, 2009

It always comes up, how can I copy single files, or large areas directly from the NetApp console? Generally the answer comes back, you can’t, use RoboCopy or rsync or another file migration tool. However there are definitely ways of copying files around directly from the filer itself, and often this is the most efficient way of doing it! However, these aren’t the most intuitive or well documented commands.

There may be other methods, and if you have something you have used in the past or you know of, please feel free to share! Not all methods are suitable for all tasks, but each has it’s own individual uses.

ndmpcopy

This is often overlooked as a file / folder copy command, and is often just used to migrate entire volumes around. In fact it can be used to copy individual folders or filers around, and even better can be used to copy data to other filers! Make sure ndmp is enabled first (ndmpd on). The syntax is quite simple…

ndmpcopy /vol/vol_source_name/folder/file /vol/vol_dest_name/file

Just to break this down, we are choosing to copy a filer from “/vol/vol_source_name/folder” and we want to copy it into “/vol/vol_dest_name”. This isn’t too restrictive, we don’t have to keep the same path, and we can even copy things about in the same volume (such as copying things into QTrees if you need). You can copy things from an entire volume, to a single QTree, down to single folders way down in the directory tree. The only real restriction is you cannot use wildcards, and you cannot select multiple files to copy.

If you want to copy files from one filer to another, we simply extend this syntax…

ndmpcopy -sa <user>:<pass> -da <user>:<pass> source_filer:/vol/vol_source_name/folder/file destination_filer:/vol/vol_dest_name/file

Command Line , , , , ,

Moving / Renaming vol0

February 13th, 2009

There’s been many occasions where I’ve wanted / needed to move the vol0 to somewhere else. Just last week I had a customer that wanted to destroy the root aggregate and move some disks around, but they’d already setup the filer and didn’t want to lose this

The process is actually very simple!

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line , , , , ,

Creating iGroups on the DR filer

January 22nd, 2009

This is another script I wrote to aid in site failover. Basically the snapmirror script works great to bring volumes online, but if everything is in VMware (and as such iSCSI from within the VM), you want these to be automatically re-mapped, and save you some leg work!

Well, this script would run from a server sat in the DR location that has access to the primary filers. I’ve tried to make this script pretty dynamic, so you can put in as many primary filers as you want (create a ‘primary_filers.txt’ file with 1 filer name per line). However it only fails over to one filer on the DR side. This would be easily remedied, but again, just showing a concept of how easy this sort of thing is to achieve.

The difficulty here is that ‘igroup show’ outputs ‘FCP’ and ‘iSCSI’, where as ‘igroup create’ requests you use ‘f’ and ‘i’, so a bit more scripting in the middle to solve this.

This script creates a script (and if run as a cron, simply overwrites it each time) that can be run to recreate all the iGroups on the DR filer. Really handy if you have a few LUNs that need mapping. Even doing this manually for 10 is a pain. Most of my customers have at least 50+

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line , , ,

SnapMirror failover

January 22nd, 2009

So I helped a customer a few months ago (before SRM) to script a complete site failover. It will bring the DR site online within about 30 minutes, the scripts are a bit clunky and need a massive re-design, so I thought I’d post the originals here.

This, I think, is a great example of how flexible the NetApp systems are in that you can quickly and easily setup SSH access from a management host and script your heart away! Soon as I get the hang of the API, I’m sure there’ll be plenty more info coming along too.

This script will bring all volumes online on the DR filer, what’s more, an volume that is labelled as “_vm” at the end (which is a nice naming convention to use for all VMware volumes anyway), will get re-mapped to a new igroup you choose and already have setup for the DR ESX servers.

I’ve modified this script slightly since writing it to remove filer names, so I don’t expect it to work out of the box, as with my other scripts, it’s just meant to as an example of how this can be achieved.

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line , , , ,

Virtual Machine Creation

January 20th, 2009

This script can help track when a VM was created. I’m not sure if it’s technical correct however as it works on the create time of a .vmsd file. Anyway, the principles are there, and should do the job.

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line ,

Virtual Machine Sizes

January 20th, 2009

This can be useful to keep track of what people are creating. Get an index of the Virtual Machine sizes and the free space in the datastores (very important).

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line , ,

Virtual Machine Logs

January 20th, 2009

I hate the VM logs, and in a lot of cases you can end up with thousands of them which are very hard to delete or even browse to the directory. I have this script running on a cron to do a regular clear up. As a matter of course I disable VM logging now, but it can still be a challenge to clear up all the log files.

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line , ,

Find Virtual Machine

January 20th, 2009

Can’t remember which datastore a certain virtual machine is on and you’re on the command line only? Can happen, honest! In conjunction with other scripts, this can be quite helpful though. Just call the script and pass it the server name you are looking for.

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line

Catalog Virtual Machines

January 20th, 2009

This script is useful if you want to keep an eye on new machines. I had a customer that couldn’t keep track of who was creating machines and the datastores filling up all the time. You don’t want full datastores!!!

VN:F [1.7.8_1020]
Rate this post:
Rating: 0.0/10 (0 votes cast)

Command Line ,



This site is not affiliated or sponsored in anyway by NetApp or any other company mentioned within.

Bad Behavior has blocked 3761 access attempts in the last 7 days.

© 2009-2010 Chris Kranz All Rights Reserved
This site is not affiliated or sponsored in anyway by NetApp or any other company mentioned within.