#454 Issue closed: Change Netbackup Restore behavior

Labels: enhancement

wzwei opened issue at 2014-09-03 08:43:

Hi!

When running "rear recover" one has to enter the timestamp where you want the Point-In-Time recovery
or hit the ENTER key. Hitting the ENTER key IMHO should restore from the last Full backup and all
incremental backups afterwards to get a complete system recovery. But actually it restores only the
last backup, be it Full or incremental only.

I would change /usr/share/rear/restore/NBU/default/40_restore_with_nbu.sh to not set the start-date
option when running bprestore. For example:

ARGS="-B -H -L /tmp/bplog.restore -8 -R /tmp/nbu_change_file -t 0 -w 0 -C ${NBU_CLIENT_SOURCE} -D ${NBU_CLIENT_NAME} -f $TMP_DIR/restore_fs_list"

This would also lead to the removal of the Get_Start_Date function.

Regards,
Wolfgang

gdha commented at 2014-09-03 10:08:

The Get_Start_Date function was added by someone (forgot who) for a purpose so I wouldn't remove it blindly. We just need to improve the code in such way if no valid date is given that a full restore will be requested. Makes sense, no?

wzwei commented at 2014-09-03 10:27:

Well, the important part is to get the last Full Backup. The current code blindly gets the last backup image without knwoing if its full or incremental. to do it right we have to replace the bplist command (by bpclimagelist) and code around it. This will lead to a complete new Get_Start_Date function. And this will change the semantic of the function.

wzwei commented at 2014-09-04 07:09:

Investigated the Get_Start_Date function again. All it does is list the backup times of a filesystem
in the last 5 days. Eg.:

 u1ru173 ~ # LANG=C bplist -C u1ru135.lksdom21.lks.local -l -s `date -d "-5 days" "+%m/%d/%Y"`
 dr-xr-x--- root      root                0 Sep 03 11:29 /root/
 dr-xr-x--- root      root                0 Sep 02 09:48 /root/
 dr-xr-x--- root      root                0 Aug 28 17:18 /root/
 dr-xr-x--- root      root                0 Aug 28 17:18 /root/
 dr-xr-x--- root      root                0 Aug 28 17:18 /root/

What you cannot see here is that all of these backups are incremental only!

Then Get_Start_Date grabs the first line and converts the timestamp into the "mm/dd/yyyy" format and returns it to the caller where it is fed to bprestore as start date.

This could be done easier (and safe) with bpclimagelist:

 u1ru173 ~ # bpclimagelist -client u1ru135.lksdom21.lks.local -t Full
 Backed Up         Expires       Files      KB     C Sched Type      Policy
 ----------------  ---------- -------- ----------- - --------------- ------------
 08/31/2014 06:49  09/14/2014   142141    10695915 N Full Backup     OS_LINUX_TESTSYSTEM
 08/24/2014 06:48  09/07/2014   140883    10175090 N Full Backup     OS_LINUX_TESTSYSTEM

Here you have the timestamp in the first column. You don't have to mangle the output and can hand it
over to bprestore as it is. But: you get the exact same behavior without feeding any timestamp at
all to bprestore!

So because Get_Start_Date function is of no use I would remove it.

Regards,
Wolfgang

gdha commented at 2014-09-04 08:27:

if you go that path (which is ok for me as it looks solid) then do not forget to add bpclimagelist into the file conf/default.conf and adapth the line COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt )
Looking forward to a pull request '-)

wzwei commented at 2014-09-04 10:33:

I am too busy at work today. I think you get the pull request tomorrow.

gdha commented at 2014-09-05 08:31:

just merged https://github.com/rear/rear/pull/456

gdha commented at 2014-09-05 08:34:

@wzwei will you introduce bpclimagelist later on to replace in-time-restores?

wzwei commented at 2014-09-05 08:53:

Point-In-Time Recovery is O.K. the way it's implemented. Therefore we don't need bpclimagelist.

OTOH we could implement bpclimagelist and present the listing to the recovery user prior to date selection. This would make life easier as there is no need to have a look at Netbackup Console when doing a recovery.

BTW, the bpimagelist command is already included in the rescue images. It resides in the bin directory under /usr/openv/netbackup.

gdha commented at 2014-09-09 07:12:

@wzwei the rpms of rear-1.16.1-git201409051031 are now available at http://download.opensuse.org/repositories/Archiving:/Backup:/Rear:/Snapshot/

wzwei commented at 2014-09-11 07:50:

Thanks a lot! Everything is fine now :-)


[Export of Github issue for rear/rear.]