Powershell script to age out Netapp snapshots
I had a an incident where i had to recreate the SMVI jobs on one of our Filers , we have a requirement to keep 26 days of backups online.
As always space was at a premium so What i wanted to do was to delete the old version of the SMVI
Snapshot each time after the new snapshot was taken...
so i created a script which loops through decreasing the value of the number of backups we want to keep
$days = -26
for ($loops = 26;$loops -ge 0; $loops --)
{
$BackupstoKeep = (get-date).adddays($days)
Connect-nacontroller "Filer1"
Get-Navol | Get-NaSnapshot | where-object { $_.name -like "smvi_*" -and $_.created -lt $Backupstokeep } | remove-nasnapshot
Connect-nacontroller "Filer2"
Get-Navol | Get-NaSnapshot | where-object { $_.name -like "smvi_*" -and $_.created -lt $Backupstokeep } | remove-nasnapshot
$days++
Start-sleep 86400
}
Thursday, July 25, 2013
Wednesday, July 10, 2013
Enable SSH on all hosts and set the policy to automatic
(in a non production lab obviously)First , have a look at the current state of the SSH service on all of the hosts
Get-VMHost | Get-VMHostService | Where {$_.label -like "SSH"} | select VMhost , running , policy , Label
Then start the SSH service on each of your hosts
Get-VMHost | Get-VMHostService | Where {$_.label -like "SSH"} | Start-VMHostService
Then ensure that it starts up each time on startup
Get-VMHost | Get-VMHostService | Where {$_.label -like "SSH"} | Set-VMHostService -Policy AutomaticMonday, July 8, 2013
Migration of Netapp Filer in one geographic location whilst maintaining large snapmirror relationship with original destination.
I was upgrading a filer in one of our remote sites , part of the project called for the migration of our CIFS data , the CIFS volume contained over 1 TB of data and our link back to our Primary datacenter was 20Mbps. Snapping all of this data back down would have been a time consuming excersize
and needless waste of resources.
What follows are the high level steps i took to ensure that the new source filer replaced the old source filer in the snapmirror relation ship
Filer A = Old Regional Filer
Filer B = New Regional Filer
Filer C = Primary Datacentre Filer
1. Snapmirror relationship between FilerA(FilerAcifsvol1) already exists to FilerC(FilerAcifsvol1M)
2. Create Snapmirror relationship between FilerA(FilerAcifsvol1) and FilerB(FilerBcifsvol1)
3. Allow all Snapmirrors to become consistent
4. Change Snapmirror trigger to manual
5. Stop CIFS Service on FilerA
6. Perform final snapmirror in the following sequence
FilerA(FilerAcifsvol1) ->FilerC(FilerAcifsvol1M)
FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1)
Make sure that the correct snapshots exist on each filer
7. Quiesce and break FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1) snapmirror relationship
8. Modify \\filerC\c$\etc\snapmirror.conf on FilerC as follows
replace
FilerA:FilerAcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...
With
FilerB:FilerBcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...
9. Putty into filerC and execute the following command
snapmirror update -S FilerB:FilerBcifsvol1 -w FilerC:FilerAcifsvol1M
I was upgrading a filer in one of our remote sites , part of the project called for the migration of our CIFS data , the CIFS volume contained over 1 TB of data and our link back to our Primary datacenter was 20Mbps. Snapping all of this data back down would have been a time consuming excersize
and needless waste of resources.
What follows are the high level steps i took to ensure that the new source filer replaced the old source filer in the snapmirror relation ship
Filer A = Old Regional Filer
Filer B = New Regional Filer
Filer C = Primary Datacentre Filer
1. Snapmirror relationship between FilerA(FilerAcifsvol1) already exists to FilerC(FilerAcifsvol1M)
2. Create Snapmirror relationship between FilerA(FilerAcifsvol1) and FilerB(FilerBcifsvol1)
3. Allow all Snapmirrors to become consistent
4. Change Snapmirror trigger to manual
5. Stop CIFS Service on FilerA
6. Perform final snapmirror in the following sequence
FilerA(FilerAcifsvol1) ->FilerC(FilerAcifsvol1M)
FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1)
Make sure that the correct snapshots exist on each filer
7. Quiesce and break FilerA(FilerAcifsvol1) ->FilerB(FilerBcifsvol1) snapmirror relationship
8. Modify \\filerC\c$\etc\snapmirror.conf on FilerC as follows
replace
FilerA:FilerAcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...
With
FilerB:FilerBcifsvol1 FilerC:FilerAcifsvol1M KBS=XXX ... ... ... ...
9. Putty into filerC and execute the following command
snapmirror update -S FilerB:FilerBcifsvol1 -w FilerC:FilerAcifsvol1M
Subscribe to:
Posts (Atom)