Forum Discussion

T_N's avatar
T_N
Level 6
8 years ago
Solved

how to change change retention on media existing

I have netbackup 7.7.2 running on solaris. I want to change retention on media existing. My question is how can I change the media existing from 2 weeks retention to 1 month retention. Anyone has script, please share it to me, thank you.

 


Tom

  • I keep these type of commands in a file, so I can find them again - 

    This find images for clients (x) in list, with backups from (d) to (e) with Schedule (sl), cuts the image and then uses these image values ($i) and recalculates copy 2 to retention 13 

    for x in `ls -1d /usr/openv/netbackup/db/images/client*`
    do
    for i in `bpimagelist -idonly -d '01/01/2017' -e '03/23/2017' -client $x -sl Weekly_Full_Backup | cut -d " " -f10`
    do
    echo "Changing Backup ID: "$i at `date +%Y%m%d.%H%M`
    /usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 2 -ret 13 -force
    done
    done

     

    p.s .I just realized, I did not update my dates in the last post - you cannot end date before start date, lol

2 Replies

  • Depending on what you are asking, the answer will vary.

    Say you have media with an image on it that is retention 10, and retention 10 is set to 2 weeks.

    Do you want to change retention from 10 to 12 on these media and recalculate the expiration?

    Do you want to change retention 10 from 2 weeks to 4 weeks on these media and recalculate?

    Do you want to leave the retention value alone, and just change the expiration date on the image?

    Do you want to change the expiration for everything on a media?

    You are tag says Solaris. 

    You can use some loops to find all images and update the expiration, etc.

    Please be careful since it is really easy to do more than you expect!

    You can use bpimagelist and values for date/client/policy/etc to select images, like

    /usr/openv/netbackup/bin/admincmd/bpimagelist -media -U -d "08/10/2017 00:00" -e "08/10/2013 23:56" -client "client-backup" | cut -c0-6 | sort -u >  /var/tmp/tape.move.list ( this is for entire media )

    This creates a list you can then run bpexpdate against the list 

    /usr/openv/netbackup/bin/admincmd/bpexpdate -m $i -d "12/31/2017 23:59" -force -notimmediate ( changes all images on media )

    I am pretty sure to recalculate, you need to find all the images, instead of the media

    You should man the commands, since some need image values, and some need media values, depending on what you need.

     

    • Genericus's avatar
      Genericus
      Moderator

      I keep these type of commands in a file, so I can find them again - 

      This find images for clients (x) in list, with backups from (d) to (e) with Schedule (sl), cuts the image and then uses these image values ($i) and recalculates copy 2 to retention 13 

      for x in `ls -1d /usr/openv/netbackup/db/images/client*`
      do
      for i in `bpimagelist -idonly -d '01/01/2017' -e '03/23/2017' -client $x -sl Weekly_Full_Backup | cut -d " " -f10`
      do
      echo "Changing Backup ID: "$i at `date +%Y%m%d.%H%M`
      /usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 2 -ret 13 -force
      done
      done

       

      p.s .I just realized, I did not update my dates in the last post - you cannot end date before start date, lol