Hi Vamika... your question was an interesting one. Do you still need to expire any copies of images on disk, but only those images which do actually already have a copy on tape?
If so, I might have a script for you... and I say "might have" because the script that I have developed might not work in your environment.
Let me know if you want to try the script.
BTW, the script will be safe to run... as it will NOT actually expire anything anywhere. What the script does is produce a file containing commands that you might want to run.
Here's the header of the script. Have a read through it, and then let me know if you want a copy of the script to test with.
REM ******************************************************************************************************
REM * File: expire-oldest-images.bat
REM * Desc: Determine oldest images on disk and/or on tape, and...
REM * ...optionally choose to retain any copies on tape...
REM * ...and thus potentially select only those copies of images residing upon disk...
REM * ...and write a ".zap" file which could be used to expire only the selected copies.
REM *
REM * Vers Date Who Description
REM * ---- ---- --- -----------
REM * v0.01 23-JAN-2016 sdo Initial version.
REM * v0.02 24-JAN-2016 sdo Improved copy number loop. Added more comments.
REM ******************************************************************************************************
REM * !!! WARNING and DISCLAIMER !!!
REM * !!! WARNING and DISCLAIMER !!!
REM * !!! WARNING and DISCLAIMER !!!
REM *
REM * Before using this script, be aware of the following points:
REM * - Use of this script is entirely at the end user's own risk.
REM * - Carefully read the entire header section of this script. Read all of the notes and make sure
REM * you have an understanding of the purpose of this script before using it.
REM * - Neither the author of this script, nor Veritas, will accept any responsbility for issues or
REM * problems or data loss caused by use, or mis-use, of this script, in either its original form or
REM * a modified form.
REM * - This script is not endorsed by Veritas.
REM * - This script is not supported by Veritas.
REM * - This script has not been tested by Veritas.
REM * - This script may not be suitable for use in any given NetBackup environment.
REM * - This script is furnished on an example basis only.
REM * - Whilst every effort has been made (by the author of this script) to produce something that is
REM * both useful and viable, be aware that bugs and errors may remain which may cause data loss.
REM ******************************************************************************************************
REM * Sharing
REM * -------
REM * This script is free to share and modify, as long as this entire header section is kept with
REM * the script, and maintained and updated appropriately as any changes are made.
REM ******************************************************************************************************
REM * Notes
REM * -----
REM * 1) This script was developed and tested using:
REM * Windows 2008 R2, with NetBackup Server v7.7.1
REM * Windows 2012 R2, with NetBackup Server v7.7.1
REM * ...but should work with any Windows version since 2003 and any v7.* of NetBackup Server.
REM * 2) This script is a form of "What if?" analysis script. This script should be safe to run on any
REM * system, for several reasons:
REM * i) this script will not actually exire any backup images. What this script does...
REM * is to identify specific copies of backup images which could be expired, and write
REM * the commands to achieve this to a separate file.
REM * ii) The commands will be REM'd out, so even an accidental run of the file created by
REM * this script will not expire anything either.
REM * iii) The net effect is... the only way that specific copy numbers of backup images
REM * could actually be expired is that the administrator has to make a concious effort
REM * to edit the the created file and de-REM it, and rename it, so that it can be run.
REM * 3) This script tries to detect the date format, and also check that the date enterred by the
REM * user is a valid date, and also checks that the entered date is less than today's date.
REM * 4) This script does not check for, nor handle, SLP incomplete backup images.
REM * 5) The v7.6.0.3 commands manual shows an example date format "mm/dd/yy" but says actual usage
REM * is based upon NetBackup's locale setting. Luckily, we can make several different dummy
REM * calls to bpexpdate, because bpexpdate will return a status 227 if a backup image does
REM * does not exist, but will return status 20 if one or more of the input parameters is
REM * incorrect. We know that our parameters are correct, except for the date, so... any
REM * status 20 must indicate a bad date format. Thus, multiple dummy calls to bpexpdate can
REM * be used to validate its own parameter formats, and depending upon which call generates
REM * a status 227, we can thus determine the correct date format for bpexpdate.
REM * 6) This script could result in making many calls to bpimagelist and bpverify and so could take
REM * some time to run on medium to large NetBackup systems.
REM * 7) This script was written because it can be even more time consuming to manually check many
REM * images, and check that any given copy number applies to the desired storage unit type.
REM * 8) This script will probably fail if you have 'spaces' or any strange characters in any of your
REM * client names, or image names, or storage unit details, or disk pool details, or disk volume
REM * details, or tape media IDs. Basically, if your NetBackup environment is in a bit of a mess
REM * then you probably wouldn't want to bother attempting to run this script.
REM ******************************************************************************************************
REM * List Of Files Created By This Script
REM * ------------------------------------
REM * <script>.csv filtered images in: YYYY-MM-DD,image-name,copy-number,stu-type,stu-ident,stu-server
REM * <script>.det the bpimagelist of the last image inspected
REM * <script>.eva the list of images to evaluate for copies to potentially expire
REM * <script>.ima the bpimagelist -idonly of all SLP complete images
REM * <script>.lis list of filtered images before selected date in: YYYY-MM-DD image-name
REM * <script>.log the log of the most recent run of this script
REM * <script>.med list of unique tape media id discovered
REM * <script>.srt the sorted list of filtered images in: YYYY-MM-DD image-name
REM * <script>.stp list of all NetBackup disk pools
REM * <script>.stu list of all NetBackup storage units
REM * <script>.stv list of last NetBackup disk volume inspected
REM * <script>.ver output of bpverify -pb for the last image copy inspected
REM * <script>.xxx the accumulated log of all completed runs of this script
REM * <script>.zap the purpose of this script, is to write this file, which is a date filtered,
REM * and storage unit type filtered, list of commands which could be used to
REM * expire the specific copies of images on selected storage unit types.
REM * N.B: the commands written to this file are REM'd out.
REM ******************************************************************************************************
REM * Advice About Using This Script
REM * ------------------------------
REM * If you do want to use this script, then my advice is to run this script several times, and choose
REM * different options each time. Whilst it may take some time to run on medium to large environments,
REM * it is useful to run it several times in order to gain an understanding of how it selects copies of
REM * images to potentially expire. So, check the log output, and check to make sure that it really is
REM * only selecting the images that you think that you need/want to expire.
REM ******************************************************************************************************
REM * How To Test This Script At Your Site
REM * ------------------------------------
REM * 1) Identify a media server with a little bit of space.
REM * 2) Create a basic disk storage unit on that media server.
REM * 3) Use the management console GUI to identify one of the oldest images that you have.
REM * 4) Use the management console GUI to duplicate that image to your new basic disk storage unit.
REM * 5) Run this script in an attempt to select only that image for expiry.
REM * Remember, this script won't actually expire anything, all it does is write a list of REM'd out
REM * commands to the ".zap" file.
REM ******************************************************************************************************
REM * Ideas For Future Development
REM * ----------------------------
REM * 1) Instead of selecting images only by storage unit type, also select only copies of images
REM * residing within specific storage units, or specific volumes pools, or specific volume groups.
REM ******************************************************************************************************