Restoring NetBackup files using command line utilities

This is a simple post providing the steps necessary in restoring files backed up with NetBackup using the bpclimagelist, bplist and bprestore command line utilities.

List all available backup images

Firstly, using the bpclimagelist command we can list all the available backup. For example:

root@nbulab# bpclimagelist
Backed Up         Expires       Files      KB     C Sched Type      Policy
----------------  ---------- -------- ----------- - --------------- ------------
03/11/2016 14:00  06/11/2016     9674      197147 N Incr Backup     SOLARIS
03/10/2016 14:00  06/10/2016     9654      182651 N Incr Backup     SOLARIS
03/09/2016 14:00  06/09/2016     9705      193146 N Incr Backup     SOLARIS
03/08/2016 14:00  06/08/2016     9892      299354 N Incr Backup     SOLARIS
03/07/2016 14:00  06/07/2016    10006      596202 N Incr Backup     SOLARIS
03/06/2016 14:00  06/06/2016     9629      169000 N Incr Backup     SOLARIS
03/05/2016 21:00  06/05/2016    93291    17590695 N Full Backup     SOLARIS

List files available to restore

Using the bplist command, we will list all files and directories found in the full backup taken on 03/05/2016 that are available to restore. For example:

root@nbulab# bplist -s 03/05/2016 -e 03/05/2016 -R 99
/data/docs/
/data/docs/howto/
/data/docs/howto/list-files-in-a-saveset.sdd
/data/docs/howto/list-files-in-a-saveset.sdw
/data/docs/howto/move-client-index-on-a-unix-networker-server.sdw
/data/docs/howto/move-client-index-on-a-windows-networker-server.sdw
/data/docs/howto/remove-a-networker-client.pdf
/data/docs/howto/remove-a-networker-client.sdw
/data/docs/misc/
/data/docs/misc/networker-licence-troubleshooting-guide-v1-1.sdw
/data/docs/misc/networker-licence-troubleshooting-guide-v1-2.sdw

where:

  • -s mm/dd/yyyy — the start date
  • -e mm/dd/yyyy — the end date
  • -R # — specifies the 'recursive' level, how many file systems/directories to drill down.

Restoring the files

Using the bprestore command we can specify what we want to restore. In the following example we will restore /data/docs/. For example:

root@nbulab# bprestore -t 0 -s 03/05/2016 -e 03/05/2016 -L /tmp/restore.log /data/docs/

NOTE: There will be no output once the command is executed.

To view the progress of the restore you can tail the log file specified with the -L logfile argument on the bprestore command line. For example:

# tail -f /tmp/restore.log
    11:58:11 (84838.001) Directory /data/docs already exists.
    11:58:11 (84838.001) Directory /data/docs/howto already exists.
    11:58:11 (84838.001) /data/docs/howto/list-files-in-a-saveset.sdd
    11:58:11 (84838.001) /data/docs/howto/list-files-in-a-saveset.sdw
    11:58:11 (84838.001) /data/docs/howto/move-client-index-on-a-unix-networker-server.sdw
    11:58:11 (84838.001) /data/docs/howto/move-client-index-on-a-windows-networker-server.sdw
    11:58:11 (84838.001) /data/docs/howto/remove-a-networker-client.pdf
    11:58:11 (84838.001) /data/docs/howto/remove-a-networker-client.sdw
    11:58:11 (84838.001) Directory /data/docs/misc already exists.
    11:58:11 (84838.001) /data/docs/misc/networker-licence-troubleshooting-guide-v1-1.sdw
    11:58:11 (84838.001) /data/docs/misc/networker-licence-troubleshooting-guide-v1-2.sdw
    11:58:11 (84838.001) INF - TAR EXITING WITH STATUS = 0
    11:58:11 (84838.001) INF - TAR RESTORED 11 OF 11 FILES SUCCESSFULLY
    11:58:11 (84838.001) INF - TAR KEPT 0 EXISTING FILES
    11:58:11 (84838.001) INF - TAR PARTIALLY RESTORED 0 FILES
    11:58:11 (84838.001) Status of restore from copy 1 of image created Fri 30 Jun 2016 11:58:12 AM BST = the requested operation was successfully completed
    11:58:12 (84838.xxx) INF - Status = the requested operation was successfully completed.

Once completed, all files should be restored under the /data/docs/ directory.