NetWorker Client Index Management

The NetWorker client index mechanism has historically been one of the most problematic areas within the NetWorker system. The most common problems encountered are corrupted indexes and file systems running out of space because of massive index growth.

You can help minimise these index related issues by implementing a comprehensive index management process.

This article will illustrate the tools, concepts and techniques that you can use to develop your own custom NetWorker index management procedure.

Index Overview

Before we jump into the tools available for index management, we must first have a firm understanding of exactly what the NetWorker index is used for and how it functions within the NetWorker system.

Each NetWorker client has it's own client index database. The client index database file typically resides under /nsr/index/client_name. This database is populated each time a backup of the client is performed. When a backup of a client is performed, a record of each file backed up is placed in the clients index database. This mechanism allows you to view the different "versions" of the files that have been backed up.

The main purpose of the client index file is to aid in restoring files. When you restore a file using the "NetWorker User" program, you use the "Change Browse Time" and "View->Versions" options to browse through the client index database, displaying the different versions of the file to be restored as show in figure 1.

The "browse policy" controls the number of records kept in a client index database. The browse policy is specified in the client configuration, as shown in figure 2. In example, we will retain one month of index records.

The index records are automatically pruned by the NetWorker system. After a server-initiated backup is performed, the savegrp program calls nsrim. nsrim will compare the date of the client index records with the browse policy. If the index records are older than the browse policy, these records will be deleted from the client index database. nsrim will also delete client index records if the data has exceeded the retention policy or if the volume containing the data is eligible for recycling.

Figure 1 - The index records record the different "versions" of a backed up file.

NetWorker automatically backs up each client index after the client backup completes. These indexes are backed up according to the clients schedule. For example, if the client is

Figure 2 - Client index size is controlled bt the browse policy

scheduled to run a full backup, a full backup of the clients index will be performed. If the client was scheduled to run an incremental backup,a level 9 backup of the clients index will be performed. You can stop this automatic backup of the client indexes by enabling the "No index save" option on the clients group. You may be wondering why you would want to disable this automatic index backup. We will discuss reasons for this later in this article.

Index Management Tools

NetWorker provides several tools that you can use to control your client indexes. Thee tools include:

  • nsrim - prunes client index records
  • nsrck - provides consistency checking and compression
  • nsrls - generates index statistics
  • uasm - used to copy or move an index database
  • nsrinfo - use to extract information from the index database

In the following sections, we will explore the functions provided by each of the above utilities. After we have a firm understanding of each of these utilities, we will explore methods that you can implement, using these utilities, to give you more control on the index management of your NetWorker server(s).

nsrls - View index statistics

nsrls is the NetWorker utility that displays statistics on the client index database(s). The format of the command follows:

  • NetWorker version 5.x: nsrls [client_name] [-f filename]
  • NetWorker version 6.x: nsrls [ {client_name}...| -m} ]

The -m and the -f flags allow you to view statistics on the media database. Let;s take a look at a couple of NetWorker version 6.x commands and their associated output:

root@alpha99# nsrls alpha99
/nsr/index/alpha99: 84248 records requiring  8917  KB
/nsr/index/alpha99 is currently 100% utilized
root@alpha99# nsrls -m
Database id 0: /nsr/mm/mmvolume6
 Fld |       Size |      Count | Name
   0 |      16 KB |          2 | vol
   1 |      48 KB |         97 | ss
   2 |      16 KB |          3 | clients
   3 |      16 KB |          2 | vol_i0
   4 |      16 KB |          2 | vol_i1
   5 |      16 KB |          2 | vol_i2
   6 |      16 KB |          2 | vol_i3
   7 |      16 KB |          0 | vol_i4
   8 |      16 KB |         97 | ss_i0
   9 |      16 KB |         97 | ss_i1
  10 |      16 KB |          0 | ss_i2
  11 |      16 KB |         97 | ss_i3
  12 |      16 KB |          3 | clients_i0
  13 |      16 KB |          3 | clients_i1

Usig the GUI to display index statistics

You can also use the NetWorker Administrator GUI to display statistical information about your client indexes. For UNIX, the nwadmin,click on the "Indexes" button.

For Windows NT/2000 NetWorker servers, click on the "Index" tab, then double-click on a client. A screen similar to the one shown in fgure 3 will b displayed.

Figure 3 - Vewing Index statistics using the NWAdmiin GUI.

nsrinfo - Viewing index recods

The nsrinfo utility display records contained in the cllient index databases. There are many options available with the nsrminfo command, far to many to cover in this article. For a complete exlanation of these optios, please refer to the nsrinfo man page.

If you wish to view all of the records in a client index database, you could issue the following command:

nsrinfo client_name
root@alpha99 nsrinfo bravo01
scanning client 'bravo01' for all savetimes from the backup namespace
/data/66, date=1009737817 Sun Dec 30 13:43:37 2001
/data/article65.doc, date=1009737817 Sun Dec 30 13:43:37 2001
/data/admin.doc, date=1009737817 Sun Dec 30 13:43:37 2001
/data/figure1.jpg, date=1009737817 Sun Dec 30 13:43:37 2001
/data/figure2.jpg, date=1009737817 Sun Dec 30 13:43:37 2001
/data/figure3.jpg, date=1009737817 Sun Dec 30 13:43:37 2001
/data/figure4.jpg, date=1009737817 Sun Dec 30 13:43:37 2001

Note: Notice that you can see the date and time when each file was backed up.

nsrck - Index consistency check/repair and compression utility

Each NetWorker adinistrator should become familiar with the nsrck utility. nsrck is used to compress, repair and perform consistency checks on the client index databases. NetWorker version 6 added many new functions and command-line switches to the nsrck utility. Please refer to the man page for the syntax on the nsrck command

nsrim - The index pruning uutility

nsrim is the index pruning utility. nsrim is called by savegrp after a server-initiated backup has been performed. nsrim will compare the index records with the clients browse policy and will delete records that are older than the period specified in the browse policy. nsrim will also delete records in the index if the saveset containing the corresponding files has exceeded the retention policy, or if the tape containing the saveset has become eligible for recycling.

Note: nsrim is not invoked when a client-initiated backup is performed

nsrim is usually not run manually as the NetWorker system automatically calls nsrim after a savegrp completion. There are certain situations where you many wish to run nsrim manually. There are many options available to you when manually running nsrim. Some of the more common command options include:

Use a differnt browse policy to prune records:

nsrim -b browse_policy

Remove the oldest full saveset and dependent saves from the client index:

nsrim -l -c client_name

Test to see how many records a differnt browse policy would prune (the -n switch causes nsrim to do nothing except print statistics on what it "would" have done).

nsrim -b browse_policy -n -c client_name

To perform a consistency check and to initiate the pruning process for a single client:

nsrim -X -c client_name

To perform a consistency check and to initiate the pruning process for all clients:

nsrim -X

Scheduling nsrim

nsrim is automatically started once a day to prune your client indexes. Unfortunately, nsrim is usually invoked at the worst possible time...right in the middle of your backup cycle. nsrim is a CPU and disk intensive utility, and it also locks your media database while it is running. This can wreak havoc on your NetWorker system if nsrim does in fact run during your backup cycle. You can turn off this automatic invocation of nsrim, allowing you to manually run nsrim at non-peak hours.

Note: The procedures shown in this section will show you how to disable the automatic invocation of nsrim. If you choose to turn this feature off, you must provide another method to run nsrim. Failure to run nsrim in a consistent manner will result in your indexes never being pruned, and possibly consuminf all available disk space. See the "Alternative Methods of Running nsrim" section for information on manually running nsrim

Turning Off the automatic nsrim processing

To turn off the automatic nsrim index pruning mechanism, you must create an empty file name:


You must also touch this file at least once every 24 hours. The UNIX command to perform this is:

touch /nsr/mm/nsrim.prv

The touch command modifies the date and time that the nsrim.prv file was last modified. Executing the touch command without any options, as shown in the above example, causes the files last modified date/time to be replaced with the systems current date and time.

There is no comparable native Windows NT/2000 command that will perform the "touch" function. To work around this, you can download a shareware NT touch command, or simply delete and re-create the nsrim.prv file once every 24 hours using a script. The script shown below, can be used as an example of performing this process:

unlink ("c:/program files/legato/nsr/mm/nsrim.prv");
chdir("c:/program files//legato/nsr/mm");
open (MAKEFILE, ">nsrim.prv");

The script below is a comparable UNIX script that will issue the "touch" command to update the date on the /nsr/mm/nsrim.prv file.

system "touch /nsr/mm/nsrim.prv";

Alternative methods of running nsrim

Now that you have disabled the automatic nsrim processing, you must implement an alternative method of running nsrim. You can either do this by running a script, or you can maually enter the appropriate commands yourself. After running nsrim, it is a good idea to run nsrck to compress your indexes.

Note: Indexes of NetWorker version 6 servers do not reuire periodic compressions. However, it is still a good idea to run nsrck after running nsrim to perform a consistency check.

Using a script to run nsrim and nsrck

In order to run nsrim and nsrck with a script, the script must perform the following functions:

  • List the /nsr/idex directory to obtain the client names
  • Issue the following commands for each client:
    • nsrim -X client_name
    • nsrck -F client_name

Manually running nsrim and nsrck

If you do not like the idea of running nsrim and nsrck individually for each client via a script, you could simply enter the following commands from your NetWorker server console:

  • nsrim -F
  • nsrck -F

These commands wil run nsrim and nsrck on all clients defined to your NetWorker server.

New NetWorker version 6 nsrck commands

One of the main enhancements of the NetWorker version 6 is the revamped index structure. This new structure promises to reduce the nagging client index corruptions issues that plagued previous version of NetWorker. According to Legato, the new client indexes do not require periodic compressions!

This new index structure required major modifications to the nsrck utility. There are many new options available with the new nsrck. You now have seven "levels" of index checking that can be initiated from nsrck. Each level performs a more intensive index check than the previous. For example a level 3 check performs all of the level 2 functions and also reconciles the client index file with the media database. The most rigorous check is the level 6 check.

The level 7 check initiates a new function that will restore client index records from a given period of time. For example, the following command wil recover client index records from the date of 10th December 2001:

nsrck -L7 -t 12/10/2001 -c client_name

Final thoughts

NetWorker client indexes are a crucial part of the NetWorker system. These indexes must be cared for in order to prevent backup and recovery problems. The utilities, scripts and concepts can be used to develop your custom index management system, based on the needs of your environment. All of the examples shown in this article have been tested with NetWorker versions 5.x and 6.x on both Windows NT/2000 and UNIX based NetWorker servers.

When working with client index files, be very careful. A slip of the command cam wreak havoc. Also, be VERY careful when working with the client file index file of the NetWorker server itself. This index is critical to the operation of the NetWorker server and can only be recovered using the mmrecov command, on NetWorker version 5.x systems, or nsrck, on NetWorker version 6.x systems.