1)
"When NB calls the tape for the first time the barcode is read and that same number, or a slight varation of that numer as specified by the media id generation rule is written to the tape as the Media id. "
Above is when we do inventory.
No - why would an inventory want to label tapes.
Think about the 'meaning' of the word 'Inventory' - forget NBU, "To check what is there and update records" would be an acceptable explanation of the word.
I presume you have at some point put tapes into a library, run an inventory and then run some backups to your new tapes. What did you notice - hopefully that you did not personally have to run bplabel, or label from with the GUI, it just worked right ?
If you have not done this, you can accept my explanation above as being correct.
Therefore, what does this tell you about when NBU labels a tape ?
2)
What bplabel does?It sets the internal media id obtained from media id generation rules of that media?
More or less, yes.
3) Why do we physically write a media id to the media header on a tape ?
So that NBU can recognize that tape.
Yes, I would say that is an acceptable answer. Really, a better answer would be to say that it uses the media id written to the tape to perform a physical inventory (vmphyinv command) which is an inventory carried out by reading the headers on the tapes, as opposed to barcodes.
BUT ...
The real reason it is written to the tape, is so that NBU can check that the correct tape has been loaded into the drive before it starts to write to it, relabel it, or in fact do anything with it.
There have been cases where certain companies (who I will NOT name) attempted to prevent legal investigations into their business by swapping barcode labels on backup tapes. I DO NOT know if the software used was NBU or some other product. Most if not all enterprise backup products write the media id (or whatever the term used by the other products) to the tape which prevents against this sort of thing.