Basics – Labelling and Relabelling without Unmounting

Here’s a common scenario – you want to label a volume, or relabel a volume, and use it straight away. The default behaviour of NetWorker after labelling or relabelling a volume is to then unmount it, which means having to then manually mount the volume after it has been (unnecessarily) ejected.

Getting around this behaviour is quite easy, and just requires a bit of typing on the command line.

Let’s look first at relabelling, since this is arguably the most common scenario. Say you’ve got a volume in slot 21 of your tape library that you want to relabel and have it remain mounted so you can immediately start using it. For a normal relabel operation you’d consider something like:

# nsrjb -LRYvvv -S 21

Note 1: I always put in the ‘-vvv’ option whenever dealing with a jukebox. These days I practically consider it to be ‘best practices’.

Note 2: In the examples in this article I’m using the -Y switch, which means NetWorker does not prompt for any confirmation on the operation (it assumes Yes in response to any question it may have); this is done only for the purposes of keeping example output simplified, and I don’t recommend you get in the habit of using it.

Instead of using the -L option here, we switch to -l (for load); thus the command becomes:

[root@tara ~]# nsrjb -lRYvvv -S 21
setting verbosity level to `3'
Info: Preparing to load volume `BIG990S3' from slot 21 into device `/dev/nst0'.
Info: Loading volume `BIG990S3' from slot `21' into device `/dev/nst0'.
Info: Load sleep for 5 seconds.
Info: Performing operation `Verify label' on device `/dev/nst0'.
Info: Operation `Verify label' in progress on device `/dev/nst0'
Info: Performing operation `Label' on device `/dev/nst0'.
Info: Operation `Label' in progress on device `/dev/nst0'
Info: Recycling volume `BIG990S3'

That’s it – those of you familiar with highly verbose nsrjb output will recognise that there’s no “Unmount in progress” style message; the volume remains mounted and instantly ready for use once the relabel operation is complete.

Now, moving on to a tape that hasn’t previously been labelled, we’d usually use a command such as:

# nsrjb -LYvvv -b poolName -S x

However, to keep the tape mounted after labelling, we need to include the ‘-m’ option; thus, if we wanted to label the tape in slot 1 into the “Default Clone” pool and keep it mounted after labelling, our command would look like the following:

[root@tara ~]# nsrjb -mLYvvv -b "Default Clone" -S 1
setting verbosity level to `3'
Info: Preparing to load volume `800843S3' from slot 1 into device `/dev/nst0'.
Info: Loading volume `800843S3' from slot `1' into device `/dev/nst0'.
Info: Load sleep for 5 seconds.
Info: Performing operation `Verify label' on device `/dev/nst0'.
Info: Operation `Verify label' in progress on device `/dev/nst0'
Info: Expected volume `800843S3' in slot `1'. The actual volume is `<NULL>'.
Info: Cannot read the current volume label `no tape label found'.
Info: nsrmmgd assumes the volume is unlabeled and will write a new label.
Info: Performing operation `Label' on device `/dev/nst0'.
Info: Operation `Label' in progress on device `/dev/nst0'
Info: Label: `800843S3', pool: `Default Clone', capacity: `<NULL>'.

There you go … and don’t forget Note 2 above! It’s not wise to get into the habit of throwing a -Y into nsrjb commands; the examples only show it to keep the examples simpler.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.