Forum Discussion

day's avatar
day
Level 3
10 years ago

Deleting images manually

The images on disk will be deleted randomly after they are stored on the tapes. I know that many people are using SLPs to control the deletion. Unfortunately I haven't a license for Advanced Disk therefore I'm not able to use a SLP for doing me the job. But I want to have only the newest images on disk. So my idea is a script:

First I need a list with the backup IDs which are older than let's say 8 days. (With bpimagelist?)
The list will be then used in a loop. The current backup ID in the loop will be verified whether it is already on tape. If yes, the image will be marked as expired based on the backup id. (Expiring images with bpexpdate -notimmediate?)
At the end the expired images should be deleted from disk. (With nbdelete?)

Is the above train of thought right? I don't know exactly which command is the right and which options are needed. I hope you can help me :)

  • And here is my script. 

    #!/bin/sh

    DATE=`which date`
    BPIMMEDIA=/usr/openv/netbackup/bin/admincmd/bpimmedia
    BPEXPDATE=/usr/openv/netbackup/bin/admincmd/bpexpdate
    NBDELETE=/usr/openv/netbackup/bin/admincmd/nbdelete

    ENDDATE=`${DATE} --date='8 days ago' '+%m/%d/%Y %T'`
    BACKUPIDS=`${BPIMMEDIA} -disk -e ${ENDDATE} -dt 1 | grep '^IMAGE' | awk '{print $4}'`

    for BACKUPID in ${BACKUPIDS}
    do
            ${BPEXPDATE} -force -backupid ${BACKUPID} -d 0 -copy 1 -notimmediate
    done

    ${NBDELETE} -allvolumes

9 Replies

  • Have you considered to use the staging feature of the basic disk storage unit  (it comes with the base license) ?

    It will stage backup images from disk to tape for you - when the disk fills, NBU will delete the oldest images already copied to disk. Work really well.

    Some background details:

    http://www.symantec.com/docs/TECH44719

    http://www.symantec.com/docs/TECH33710

  • what is the disk storage unit that you are using?

    does it basic disk... if yes why dont you use Disk staging storage option or Vault to get this done... (though disk staging does not work on number of days.. it expires based on how fast it reaches the high water mark.)

    they will automate this job without using the any other scripts in place..

     

  • I have a storage unit group which contains three basic disks with a staging schedule.

    Although in the documentation is written that the oldest images should be deleted first, that's not true:

    Symantec NetBackup™
    Administrator's Guide,
    Volume I
    UNIX, Windows, and Linux
    Release 7.6

    When NetBackup detects a disk staging storage unit that is full, it pauses the backup.
    Then, NetBackup finds the oldest images on the storage unit that successfully
    copied onto the final destination. NetBackup expires the images on the disk staging
    storage unit to create space.

    The problem is that the documentation is outdated and the text has been in the admin guide since 5.1. The images will be deleted randomly. This confirmed me a technical support engineer who wrote a technote but which has not yet been published.

  • Cleanup behaviour has changed in NBU 6.5.

    This TN is still valid:
    Disk Staging Cleanup Behavior: http://www.symantec.com/docs/TECH66149  

    Whether or not cleanup happens randomly or based on age I cannot say.

    If you really need to control disk images based on retention levels, you need Advanced Disk license to make use of SLP.

    If you want to manually delete/cleanup, you need to use bpexpdate with image number and copy number.

    To find images on Basic Disk, you can use the GUI or use bpimmedia with something like this:

    bpimmedia -disk  -dt 1 
    More options available for bpimmedia in 
    NetBackup Commands Reference Guide 


     

  • And here is my script. 

    #!/bin/sh

    DATE=`which date`
    BPIMMEDIA=/usr/openv/netbackup/bin/admincmd/bpimmedia
    BPEXPDATE=/usr/openv/netbackup/bin/admincmd/bpexpdate
    NBDELETE=/usr/openv/netbackup/bin/admincmd/nbdelete

    ENDDATE=`${DATE} --date='8 days ago' '+%m/%d/%Y %T'`
    BACKUPIDS=`${BPIMMEDIA} -disk -e ${ENDDATE} -dt 1 | grep '^IMAGE' | awk '{print $4}'`

    for BACKUPID in ${BACKUPIDS}
    do
            ${BPEXPDATE} -force -backupid ${BACKUPID} -d 0 -copy 1 -notimmediate
    done

    ${NBDELETE} -allvolumes

  • Does this mean that you have solved your own query? And now sharing your solution?

  • Yes and yes. I marked the comment as solution.

  • For scripting you will need the -force parameter for bpexpdate