How to force NetWorker to clean a tape drive

A question often raised is how to force NetWorker to clean the tape drives immediately?

There are many answers to this and it all depends in auto-cleaning is enabled within NW or not; Best practices suggest that auto-cleaning within NetWorker be turned off and allow the library to perform that task; Otherwise NetWorker will pick up the TapeAlert to clean the drive and will action.

Define a slot for cleaning tape by going to library properties in NMC and then put a tape in that slot and turn on autocleaning . When drive will require cleaning, NetWorker will automatically pick up cleaning tape and will clean the drive.

From within NMC, On the "general" tab of the library's properties there's a section to set/unset auto clean and set the slot range for your cleaning tapes.

Generally, Cleaning works in NW provided its configured properly. I have seen issues when cleaning have been configured (unintentionally) in both NW and on the drive. I have reverted to let only the drive handle cleaning and I have had bo issue. The library is intelligent enough to perform this action when it is in idle status.

If AUTO cleaning is configured on your Library then there should not be any need for any manual cleaning. The Library should be able to initiate cleaning as soon as this is required for any drive when the drive is available ( Not performing any backup).

CAUTION: either configure it on the library or in NetWorker. If you set it in both it will lead to unpredictable behaviour!

Auto cleaning can be configured in NW by going to Drive/Properties then Tick the Auto Clean box. You must also enter the slot no where the cleaning cartridge is located. and the number of times the cleaning cartridge can be used. When cleaning is required NW should be able to invoke the cleaning job and reset the cleaning flag.

If NW does not initiate the task then there will not be any information in the NW log file. However the library should have some logs that can be accessed by the administrator.

As I said before only one of the two options must be used to avoid issues. I use the Library option and have disabled Auto Clean in NW. This works fine for me.

A simple procedure to mount a cleaning cartridge into a drive:-

Mount your cleaning tape in the drive - if you know either the slot or the volume name:

  • nsrjb -l -f drivepath -S slot
  • nsrjb -l -f drivepath volume

replace drivepath with the device path name assigned to a drive while configuring, for example:

  • UNIX: /dev/rmt/0cbn
  • Windows: \\.\Tape0

You can also mount it from the GUI