Prevent and Detect Orphaned Mksysb NIM resources
brian_s 270002K5X3 Visits (4907)
In order to have a working mksysb resource in a NIM environment you need to have 2 items: a NIM mksysb resource which points to a mksysb file in the filesystem.
A good NIM mksysb resource looks like the image below. The NIM mksysb resource is stored in the ODM and has a "location" attribute that points to a file in the filesystem.
However, if something (or someone) deletes the mksysb file from the filesystem, but doesn't delete the NIM mksysb resource, you are left with an orphaned mksysb NIM resource. The mksysb resource will still show up in NIM and still appear to be useable, however any operations that try to use it will fail since its backing mksysb file isn't present. An oprhaned mksysb resource looks like the image below:
How to prevent orphaned NIM mksysb resources:
The best way to prevent a orphaned NIM mksysb resource is to never delete mksysb files from the filesystem using "rm". Instead, if you no longer need a NIM mksysb, use the "nim" command to delete it and also specify that the backing mksysb file should be deleted as well. This can be done with a command such as this:
Substitute "aix3_mksysb" for the name of the mksysb that you want to delete. The "-a rm_image=yes" tells NIM to not only delete the NIM resource from the ODM, but to also delete the backing mksysb file from the filesystem.
Detect orphaned NIM mksysb resources
Here is a handy one-line script that will check all your NIM mksysb resources and tell you if you have any orphaned mksysb resources that don't have a backing file present:
The output looks like this:
Based on the output we can clearly see all of the mksysb's are good except for aix6_mksysb which doesn't have a a backing mksysb file present in the filesystem.