Large restore challenge
I've been asked to complete a restore of multiple user drives, across multiple servers, over multiple years....I know...sounds like fun, right? Here are my challenges...
1. Generate a list of files to be restored. I have the user list, but they could be on any of 20 different client servers. I was thinking of using bplist to find them, but can't for the life of me get past the dreaded 227 error when I run it from the Master server. Oh, and some of those clients don't exist anymore....just the backups.
- I've tried variations for bplist such as: bplist -S master -C client -t 13 -R c:\pathname on client
2. Use powershell, to take the list from above and generate the restores with the files being directed to another location using bprestore is my guess.
I'm running NBU 7.6.0.1 on W2K8 and my install path is not the default.
Any help would be really appreciated as this is probably going to take weeks as it is.
cd to your working folder where your script resides...you should have two files already:
list-of-source-clients.txt (contains 7 to 20 old server - i.e. backup client names)
list-of-usernames.txt (contains 50 to 51 old usernames, partial strings, i.e. not full paths)
...then use this to generate a list of all MS-Windows type backup images in a two year date range:for each record in list-of-source-clients.txt
extract clientname
bpimagelist -idonly -d twoyearsagodatetime -e todaydatetime -pt MS-Windows -client $clientname > images.txt
for each record in images.txt
extract imagename
extract imagedatetime
for each record in list-of-usernames.txt
extract username
bplist -C $clientname -s $imagedatetime -e $imagedatetime -t 13 -I -PI -R 999 -nt_files *$username* >>files-$imagename.txt
next
next
next...then you would end up with a bunch of files named "file-*.txt" which contain a list of files to be restored from each image.
The above was the easy part.
Here comes the tricky part:dir /b files-*.txt > list-of-files.txt
set targetserver = blahblah (i.e. the name of the server that restores will be written to)
delete restore-commands.txt
for each record in list-of-files.txt
extract backupfilename
extract imagename (from $backupfilename)
extract clientname (from $imagename)
extract imagectime (from $imagename)
convert imagectime to imagedatetimeset renamefile = restore-$imagename.txt
for each record in $backupfilename
extract sourcefilename
set sourcelen = len( sourcefilename )set targetfilename = "F:\$imagename\" + Mid( $sourcefilename, 4, 999 )
set targetlen = len( targetfilename )write $renamefile "rename $sourcelen $sourcefilename $targetlen $targetfilename"
next
write restore-commands.txt "bprestore -B -R $renamefile -C $clientname -s $imagedatetime -e $imagedatetime -f $sourcefilename -D $targetserver"
next
FYI - it is important that there is a one-to-one relationship between each file name entry in:
-f sourcenames
-R renamenames
...and so the above should achieve:
- separate restore folder for each file in backups
- restored folder structure maintainted underneath F:\imagenames\- and then you can run a tool to detect duplicate files and delete, so that only unique files are left.
- and a list of restore commands in "restore-commands.txt"
...and so could pick the first one to test an actual restore.
It may be possible to also capture and calculate the total size of what is to be restored. But I'll let you work out how to do that :)
HTH.