NSRIM(8)

NAME
nsrim - NetWorker index management program

SYNOPSIS
nsrim [ -c client ] [ -N saveset ] [ -x percent ] [ -lnqvMX ]

DESCRIPTION
The nsrim program is used to manage the NetWorker online file and media indexes. Normally, nsrim is invoked by nsrmmdbd(8) at startup, by the savegrp(8) command on completion, and by nsrd(8) when Remove oldest cycle is selected from the NetWorker Administrator program. nsrim is not normally run manually. However, the command's modes can be modified such that normal users may run the command while retaining root privileges; see nsr(8) for more details.

nsrim uses policies to determine how to manage online entries. (See nsr_policy(5), nsr_client(5), and the Legato NetWorker Administrator's Guide for an explanation of index policies). Entries that have been in an online file index longer than the period specified by the respective client's browse policy are removed. Save sets that have existed longer than the period specified by a client's retention policy are marked as recyclable in the media index. When all of the save sets on a volume have been marked recyclable, then the volume is considered recyclable. Recyclable volumes may be selected by NetWorker (and automatically relabeled by a jukebox) when a writable volume is needed to hold new backups. When a recyclable volume is reused, the old data is erased and is no longer recoverable.

Unless the -q option is used, nsrim prints header and trailer information for each group of save sets. The header lists the save set type, the client name, the save set name, and the applicable browse and retention policies that apply to the save set. (See the example in this man page). There are four types of save sets:

Normal
    All save sets backed up automatically using savegrp that are associated with a schedule, a browse policy, and a retention policy.

Ad hocs
    User-initiated save sets are designated by appending ad hocs to the header line.

Archives
    Save sets that never expire automatically are designated by appending archives to the save set line.

Migrations
    Save sets that never expire automatically, and were created by a file migration application, are designated by appending migrations to the save set line.

The trailer lists four utilization statistics of the save set after nsrim has applied the policies to it. The four statistics are the total number of browsable files remaining in the online index, the total of files currently associated with the save set, and the amount of recoverable data out of the total of data associated with the save set. For example, nsrim may print the following output for one save set name:
    mars:/usr, retention policy: Year, browse policy: Month, ad hocs
    8481 browsable files of 16481 total, 89 MB recoverable of 179 MB total
    mars:/usr, retention policy: Year, browse policy: Month, ad hocs
    0 browsable files of 13896 total, 163 MB recoverable of 163 MB total
    mars:/usr, retention policy: Year, browse policy: Month 43835
    browsable files of 427566 total, 6946 MB recoverable of 7114 MB total

When the -v option is used, the following information is also printed for each save set: the save set id, creation date, level, file count, size, and status. A save set's status is one of the following:

browse
    The file entries for the save set are browsable (the save set files still exist in the online index). These files are easily restored using the NetWorker recover mechanisms.

recover
    The age of the save set does not exceed the retention policy for the save set, but its entries have been purged from the NetWorker online index. This means that save set is recoverable from the backup media using recover. (See recover(8).) scanner(8) may be also be used to recover the save set, but users should use recover first.

recycle
    The save set is older than its associated retention policy and may be overwritten (deleted) once its backup media is recycled. Until the media is recycled, the save set is also recoverable from the backup media.

delete
    The save set will be deleted from the media database. nsrim deletes only recyclable save sets that have zero files.

The save set status may be followed by any of the following modifiers:

(archive)
    The save set never expires, and is exempt from any status change.

(migration)
    The save set was created by a file migration application and never expires, and is exempt from any status change.

(scanned in)
    The save set was restored using the scanner command, and is exempt from any status change.

(aborted)
    A save set of questionable size, consuming backup media space.

If nsrim changes the status of a save set, then it prints the transition symbol -> followed by the new status. For example:
    17221062  3/05/92  f  23115 files   158 MB recycle
    17212499  3/19/92  f    625 files    26 MB recover(aborted)->recycle
    17224025  5/23/92  i      0 files     0 KB recover->recycle->delete
    17226063  6/05/92  f   3115 files    58 MB recover
    17226963  6/09/92  f   3197 files   114 MB browse->recover
    17227141  6/10/92  f   3197 files   115 MB browse

Once nsrim has processed all of the save sets, it flags the file index for cross-checking in nsrindexd(8). If the -l flag is specified, the cross-check is attempted synchronously, otherwise, it is simply scheduled and nsrindexd performs the cross-check when the index is idle. At the same time, nsrim processes the status of any affected NetWorker volumes. With the absence of the -q flag, a line is printed for each volume. The line includes the volume name, the amount of space used, the total number of save sets, and the status. The status will be one of the following:

appendable
    More save sets may be appended to the volume. The status may also be modified with (currently mounted) which signifies that the volume could transition to the recyclable state if it was not mounted for writing.

read-only, full
    No more save sets can be appended to the volume, nor can the volume be reused since it contains some valuable save sets.

recyclable
    No more save sets can be appended to the volume, and all save sets on the volume have expired.

In addition, the following modifier applies to all three of these states:

(manual-recyclable)
    The volume will not be automatically eligible for recycling when all of its save sets have expired. Instead, the volume may only be recycled by a manual relabel operation. Note that a read-only volume can still be recycled unless the manual-recyclable flag is also set. The manual-recyclable flag can be set using the NetWorker Administrator GUI (nwadmin(8)) or the nsrmm(8) and nsrjb(8) commands when volumes are labeled or at any time thereafter. This flag is never set automatically.

If the volume status changes, then nsrim appends ->recyclable to the status. If the volume contains some browsable save sets, then this is noted; recoverable save sets are also noted. The odd case where an appendable volume has only recyclable save sets is also noted. For example:
    jupiter.20: 3474 MB used, 398 save sets, full->recyclable
    jupiter.21: 4680 MB used, 440 save sets, full, 249 recoverable
    jupiter.22: 4689 MB used, 351 save sets, full, 351 browsable
    jupiter.24: 1488 MB used, 141 save sets, appendable, 141 browsable

RETENTION AND BROWSE POLICIES
Under normal circumstances, the association between browse or retention policies and client save sets is obvious. However, since a save set may be listed by more than one client resource with the same name, and each client resource may specify different browse and retention policies, determining the policies applicable to a save set is not always straight forward. nsrim(8), uses the following steps to select an instance of a client resource with the client's name. Once the client resource is selected, its browse or retention policy is used for managing information about the save set.

1)  Locate all the client resources which belong to the same group that the save set belongs to. Within this set of client resources, apply the following rules to get the best match. If no client resource belongs to the save set's group, or if the group no longer exists, or if the saveset is from a backup earlier than version 5 (when group information was not recorded in the save set), apply the following rules to all the client resources to get the best match.

2)  Locate a client resource explicitly listing the save set. If more than one client resource lists the save set, choose the client resource with the longest policy.

3)  Search for a client resource listing the save set "All". If more than one client resource lists the save set "All", choose the client resource with the longest policy.

4)  Find the client resource listing a save set with the most common prefix (longest) of the target save set. If more than one client resource lists the save set with the most common prefix, choose the client resource with the longest policy.

5)  Among all of the client resources, choose the client resource with the longest policy.

Note that if two or more client resources with the same name exist, it is possible that the browse policy from one instance of the client resource and the retention policy of another instance may be used for managing save set information.

Save sets that have no corresponding NetWorker client resource use the NetWorker client resources of the server to determine the browse or retention policies.

A save set cannot be purged from the index or marked for recycling until all of its dependent save sets are also eligible for purging or recycling. See the Legato NetWorker Administrator's Guide for an explanation of dependent save sets.

The last (and only) Full save set will not be purged from the online index until it is also marked for recycling. In this case, the header line of the save set omits the browse policy and prints a message stating that only one browsable cycle exists.

With the exception of the -l option, manual ad hoc save sets are treated as full save sets that have no dependents. However, unlike true Full save sets, the last manual save set is not given any special consideration with regard to index purging.

The retention time applied to save sets is rounded up to midnight when the elapsed time implied by the policies is greater than or equal to a day. Therefore, nsrim should produce the same results whether it is run at 8 a.m. or 5 p.m. on the same day.

OPTIONS

-c client
    Only process the online file index for the specified client. Normally, all client indexes are processed. This option may be repeated to process multiple clients.

-l  Removes the oldest full save and all save sets dependant on it from the online index. Browse and retention policies are ignored. The save set header information will print the number of browsable full cycles currently in the online index. Archive and migration save sets are ignored. With this option, manual save sets are treated as normal incremental save sets. This option also sets the utilization threshold to 30 percent.

-M  Master mode (not advised for manual operation). Advises nsrim that it is being run by nsrd(8) or another NetWorker daemon and that it should log messages with timestamps, and perform any other behavior expected by nsrd.

-N save set
    Process only save sets named; all others are skipped. This option can be repeated to process multiple save sets.

-n  Do nothing. Instead, emulate the actions of this command without the index cross-check. Note that trailer statistics reflect current (and not emulated) results.

-q  Run quietly. This option will not generate header, trailer or save set messages.

-v  Produce a more detailed report. This may produce a large amount of output. When both -v and -q are issued, they cancel each other.

-X  Check the consistency of the data structures of the save set with the data structures of the volume. This is only required after a NetWorker crash. This option also sets the utilization threshold to 30 percent.

-x percent
    Sets the utilization threshold. If, after removing entries, the utilization of an online file index is less than the specified amount, the index is compressed automatically by passing this percentage to nsrindexd when requesting a cross-check. The default value is 50 (percent). Note that specifying -X or -l changes the default to 30 (percent).

FILES

/nsr/tmp/.nsrim
    nsrim locks this file, preventing more than one copy of itself from thrashing the media database.

SEE ALSO
nsr_client(5), nsr_layout(5), nsr_policy(5), nsr(8), nsrd(8), nsrindexd(8), nsrmm(8), nsrmmdbd(8), nwadmin(8), recover(8), savegrp(8), scanner(8).

DIAGNOSTICS

You are not authorized to run this command
    Only root or NetWorker administrators may run nsrim to modify the online indexes. However, any user may invoke the command with the -n option.

nsrim has finished (cross) checking the media db
    This notification message appears in the NetWorker messages window when nsrim completes and the command was invoked with the -q option, but without the -c and -N options.