Tuesday, July 24, 2012

DPM 2010 - How to force DPM to erase tapes without stopping the group

Scenario ;


I'm running DPM 2010 with a HP 1x8 G2 AUTOLDR Ultrium 4-SCSI autoloader that has an Ultrium LT0-4 drive. For some apparent reason DPM filled all 8 tapes in the autoloader. In DPM marked them all as belonging to a group, and now refuses to allow me to mark them as free or erase them without stopping my protection group and deleting my data. Stopping the protection group, removing replica data, and so forth is not an acceptable solution.

Now I need to know if there's a way to force DPM to erase tapes without stopping the group. 
So, how do you force DPM to erase tapes without having to delete the entire backup job and associated replica data???

Error Message Screenshot ;

Navigate DPM console > Management > Libraries > right click and select "Mark as free " , you would get following error




Solution ;

In this case we can use a power shell script to free that tapes so that new jobs would be able to utilize the tapes without deleting the data in it.

I am gonna show you the step-by-step procedure to run this script.

Save below script as ForceFree-Tape.ps1


param ([string] $DPMServerName, [string] $LibraryName, [string[]] $TapeLocationList)
if(("-?","-help") -contains $args[0])
{
    Write-Host "Usage: ForceFree-Tape.ps1 [[-DPMServerName] <Name of the DPM server>] [-LibraryName] " `
        "<Name of the library> [-TapeLocationList] <Array of tape locations>"
    Write-Host "Example: Force-FreeTape.ps1 -LibraryName "My library" -TapeLocationList Slot-1, Slot-7"
    exit 0
}
if (!$DPMServerName)
{
    $DPMServerName = Read-Host "DPM server name: "
    if (!$DPMServerName)
    {
        Write-Error "Dpm server name not specified."
        exit 1
    }
}
if (!$LibraryName)
{
    $LibraryName = Read-Host "Library name: "
    if (!$LibraryName)
    {
        Write-Error "Library name not specified."
        exit 1
    }
}
if (!$TapeLocationList)
{
    $TapeLocationList = Read-Host "Tape location: "
    if (!$TapeLocationList)
    {
        Write-Error "Tape location not specified."
        exit 1
    }
}
if (!(Connect-DPMServer $DPMServerName))
{
    Write-Error "Failed to connect To DPM server $DPMServerName"
    exit 1
}
$library = Get-DPMLibrary $DPMServerName | where {$_.UserFriendlyName -eq $LibraryName}
if (!$library)
{
    Write-Error "Failed to find library with user friendly name $LibraryName"
    exit 1
}
foreach ($media in @(Get-Tape -DPMLibrary $library))
{
    if ($TapeLocationList -contains $media.Location)
    {
        if ($media -is [Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.ArchiveMedia])  
        {
            foreach ($rp in @(Get-RecoveryPoint -Tape $media))
            {
                Get-RecoveryPoint -Datasource $rp.Datasource | Out-Null
                Write-Verbose "Removing recovery point created at $($rp.RepresentedPointInTime) for tape in $($media.Location)."
                Remove-RecoveryPoint -RecoveryPoint $rp -ForceDeletion -Confirm:$false
            }
            Write-Verbose "Setting tape in $($media.Location) as free."
            Set-Tape -Tape $media -Free
        }
        else
        {
            Write-Error "The tape in $($media.Location) is a cleaner tape."
        }
    }
}

 
Now , navigate to Start Menu >  All Programs > System Centre Data Protection Manager > DPM Management Shell




Now Navigate to the file location : I have saved script in "Documents " see the screenshot



As soon as you hit the enter button , it will ask you type DPM server Name  ; type DPM server name and hit enter





 Next step : You need to type Library Name ..


** How do you get tape library name ?

Navigate DPM console > Management > Libraries >


Now you got the library name : type library name and hit enter ...Now you need to enter the slot name which you need to mark as free so that other job can utilize this tape without erasing the data in it.

In this scenario I am gonna free the tape which is in slot 2 :




There you go..!!! now we have freed the tape which is in slot 2

Navigate DPM console > Management > Libraries > right click on slot 2 and select "Mark tape as free "
It should be freed without any error message ...






6 comments:

  1. Thanks so much...
    Rohan

    ReplyDelete
  2. hi
    I have stand alone tape drive , I followed the steps but no error neither DATA is getting cleaned from Tape Drive.

    PS C:\Users\ganesh.nalawade\Documents> .\ForceFree-Tape.ps1
    DPM server name: : dpm.kpdlcorp.koltepatil.com
    Library name: : IBM ULTRIUM-HH4 SCSI Sequential Device
    Tape location: : slot-0
    PS C:\Users\ganesh.nalawade\Documents>
    I there any problem with Tape Location, kindly let me.
    I have tried this before successfully but now ?????

    ReplyDelete
  3. Hello Ganesh..make sure that you entered correct Library name

    ReplyDelete

US-CERT : Indicators Associated With WannaCry Ransomware

National Cyber Awareness System: TA17-132A: Indicators Associated With WannaCry Ransomware 05/12/2017 09:36 PM EDT Ori...