Windows Server 2012–Failed Backup Disk
November 12, 2013 6 Comments
This is a quick post just based on something i have done this morning for a charity i do some volunteer support for. This year i installed a new server for them running Windows Server 2012, and two Hyper-V guests as a Domain Controller and Exchange server. Due to budget restraints they only had a single USB drive available for backups, and of course, recently that failed.
Unfortunately since Windows Server 2008 (i think) it has become slightly more involved to use Windows Server Backup and USB Disks for rotation. You cannot simply add another disk and run the wizard to add it into the disk set – all drives must be connected at the same time.
This presents a unique challenge if the disk is not available, and that is the only disk in the set. You cannot simply run the wizard and choose to remove the failed disk from the destinations, because it will error saying ‘you need to add more disks first’. Ok –so you try to add a disk, but no, it cannot do that because the original disk is not connected. The same applies if using WBAdmin command line tool.
Enter Windows Server Backup PowerShell.
It is not immediately obvious though in which order you need to run the commands, however i do think this is one of the best written PowerShell articles and examples i have seen for a long time. (er, not this article, the TechNet pages)
So, firstly we need to ‘get’ the WBPolicy, and in an editable state.
C:\PS>$policy = Get-WBPolicy -Editable
Now that we have our Policy we can begin to edit it.
Remember that my example is only for a situation where we have a single backup target only.
We can now query our $policy for the backup targets, and then we can remove the target.
C:\PS>$backupLocations = Get-WBBackupTarget -Policy $policy
So now we have our failed target under $backupLocations and our policy is of course $policy.
C:\PS>Remove-WBBackupTarget -Policy $policy -Target $backupLocations[0]
We append [0] to our $backupLocations variable to let the command know it is ‘Backup Target 0’ we want to remove. If for example we had multilple disks in our Target we could select the right disk using its corresponding number.
Now we need to create a new target for our backup.
C:\PS>$disks = Get-WBDisk
Now stored in the disks variable are all of the disks on the system. You can type out $disks to view the available disks to select as targets. In my system i have a single C drive and the USB Disk attached, making my USB Disk, disk 1.
We now need to create a new backup target using our disk number.
C:\PS>$diskBackupLocation = New-WBBackupTarget -Disk $disks[1]
This command adds $disk[1] to the $diskBackupLocation variable. Now we can run the Add Backup Target command to add this new target to our policy.
C:\PS>Add-WBBackupTarget -Policy $policy -Target $diskBackupLocation
Finally we can ‘save’ our policy by using the ‘Set Policy’ command.
You will be prompted to format the disk at this point.
C:\PS>Set-WBPolicy -Policy $policy
Now your backups should be able to run again!
Hopefully this shows you why using a single backup disk as your backup location is not a good idea, but also how to get around it if you absolutely must do.
I’ve ran into this a few times. Can you not just disable the backup and start again? saves having to much about with PS.
yeah you could, but wheres the fun in that?
Meant to say, good on you for doing some charity work, very commendable Sir! If you’re doing any more free work for non-profits and the client needs kit (like USB disks) you should reach out to your blog readers and see what’s available. I’ve got a room full of old servers, switches, routers, monitors etc that I recycle periodically. If someone could reuse the items, then great!
thanks will keep it in mind, had not considered that.
It probably boils down to: Dont use any backup software from by MS. Just had a nightmare trying to restore a PC that I had backed up with the integrated backup solution of SBS Essentials 2011. Feels like they want to pull your leg.
Good resume.
A good document from Microsoft, regarding PS cmdlets for WSB, is at https://technet.microsoft.com/en-us/library/ee849849.aspx Written for 2008R2 but much more comprehensive than the terse documentation you linked to.