<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Powershell script to resize snapmirror destinations? in ONTAP Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64369#M19233</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever find an answer?&amp;nbsp; I'm actually working on this very thing.&amp;nbsp; I have an alpha-script.&amp;nbsp; It worked as a proof of concept, but I'm not positive it's ready for Prime Time.&amp;nbsp; If you're interested, let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Feb 2012 23:38:28 GMT</pubDate>
    <dc:creator>docwebster</dc:creator>
    <dc:date>2012-02-15T23:38:28Z</dc:date>
    <item>
      <title>Powershell script to resize snapmirror destinations?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64364#M19232</link>
      <description>&lt;P&gt;I'm still very much a novice with Powershell, so writing a script like this is likely to take a lot of my time - therefore, I figured I'd throw it out there and see if anyone had already written one like this or might have a good one that I could use as a "jumping off point".&amp;nbsp; I have a customer that constantly has problems with SnapMirror relationships failing to transfer because the source volume has autosize enabled and grows beyond the size of the destinaton volume.&amp;nbsp; This customer is scared to death of thin provisioning, due to a bad experience with a prior storage vendor.&amp;nbsp; They've asked me to come up with a way for them to quickly and easily resize their sm dest volumes.&amp;nbsp; I figure to do it like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Get a list of the sm dest vols using get-nasnapmirror&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Get the size of the sm dest vols&lt;/P&gt;
&lt;P&gt;3.&amp;nbsp; Get a list of the sm src vols&lt;/P&gt;
&lt;P&gt;4.&amp;nbsp; Get the size of the sm src vols&lt;/P&gt;
&lt;P&gt;5.&amp;nbsp; Compare the size of the sm dest vols to the sm src vols&lt;/P&gt;
&lt;P&gt;6.&amp;nbsp; If sm dest &amp;lt; sm src, then resize sm dest to the same size as sm src&lt;/P&gt;
&lt;P&gt;7.&amp;nbsp; Update snapmirror&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any sugestions would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 07:08:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64364#M19232</guid>
      <dc:creator>dearmon</dc:creator>
      <dc:date>2025-06-05T07:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell script to resize snapmirror destinations?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64369#M19233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever find an answer?&amp;nbsp; I'm actually working on this very thing.&amp;nbsp; I have an alpha-script.&amp;nbsp; It worked as a proof of concept, but I'm not positive it's ready for Prime Time.&amp;nbsp; If you're interested, let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2012 23:38:28 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64369#M19233</guid>
      <dc:creator>docwebster</dc:creator>
      <dc:date>2012-02-15T23:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell script to resize snapmirror destinations?</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64372#M19234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I've refined my script a bit.&amp;nbsp; I realize this question is about a year and a half old, but I'm answering it anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script is provided as-is with no warranty or guarantee.&amp;nbsp; I've not tested it beyond my own environment.&amp;nbsp; I assume no liability or responsibility for its use.&amp;nbsp; That being said, I hereby present:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# resizemirs.ps1&lt;/P&gt;&lt;P&gt;# Copyright © 2012, Jim Haddad&lt;/P&gt;&lt;P&gt;# &lt;/P&gt;&lt;P&gt;# This script will query mirror pairs between filers&lt;/P&gt;&lt;P&gt;# to check the source and destination sizes of each volume.&lt;/P&gt;&lt;P&gt;# If the destination volume is smaller than the source volume,&lt;/P&gt;&lt;P&gt;# The destination volume will be resized.&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function GetVolSize ($Filer, $VolName) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Connect to the specified filer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Get the size of the source volume in bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $FilerObj = connect-nacontroller $Filer -rpc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $VolSize = Get-NaVolSize $VolName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $VolBytes = $VolSize.VolumeSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; return $VolBytes&lt;/P&gt;&lt;P&gt;} # function GetSourceSize&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function GetNewVolSize ($SourceVolBytes) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Starting with the size of the source volume,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # add on an additional 3% to pad the new size&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # for the destination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Convert that to megabytes, and round it off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Add an "m" to the end of the string to match&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # the required syntax for sending the command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # to the Filer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $Padding = $SourceVolBytes*.03&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $NewVolBytes = $SourceVolBytes + $Padding&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $NewVolMB = $NewVolBytes/(1024*1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $NewVolRounded = ([math]::round($NewVolMB,0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $NewVolSize = [string]::join('',($NewVolRounded,'m'))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; return $NewVolSize&lt;/P&gt;&lt;P&gt;} # function GetNewSize&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function SetNewVolSize ($Filer, $VolumeName, $NewVolSize) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $FilerObj = connect-nacontroller $Filer -rpc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Set-NaVolSize $VolumeName $NewVolSize&lt;/P&gt;&lt;P&gt;} # function SetNewVolSize&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Main {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Get the SnapMirror status for each filer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # For each SnapMirror, parse out the source and destination filers and volumes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Call the function to get the size for each source volume.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Call the function to get the size for each destination volume.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # If the destination size is less than the source size:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp; Call the function to calculate the new size for the destination volume.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp; Set the destination volume to the new size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Import-Module DataONTAP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $Report = @()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $BlankLine = ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; #### Insert your own filer names in the following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; $FilerList = "filer1","filer2","filer3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ####&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Foreach ($Filer in $FilerList) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FilerObj = connect-nacontroller $Filer -rpc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FilerMirrors = Get-NaSnapMirror&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Foreach ($Pair in $FilerMirrors) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Source = $Pair.source.split(":")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SourceFiler = $Source[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SourceVolName = $Source[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SourceVolBytes = GetVolSize $SourceFiler $SourceVolName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ReportLine1 = $SourceVolName + ": " + $SourceVolBytes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Destination = $Pair.destination.split(":")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DestFiler = $Destination[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DestVolName = $Destination[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DestVolBytes = GetVolSize $DestFiler $DestVolName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ReportLine2 = $DestVolName + ": " + $DestVolBytes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($DestVolBytes -lt $SourceVolBytes) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewVolSize = GetNewVolSize $SourceVolBytes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ReportLine3 = "Destination volume will be resized to: " + $NewVolSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetNewVolSize $DestFiler $DestVolName $NewVolSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ReportLine3 = "Destination Volume Size is OK."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } # if ($DestVolBytes -lt $SourceVolBytes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Report = $Report + $ReportLine1 + $ReportLine2 + $ReportLine3 + $BlankLine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } # Foreach ($Pair in $MirrorPairs)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; } # Foreach ($Filer in $FilerList)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $Report &amp;gt; ResizeReport.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;# } Main&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2012 20:49:07 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Powershell-script-to-resize-snapmirror-destinations/m-p/64372#M19234</guid>
      <dc:creator>docwebster</dc:creator>
      <dc:date>2012-02-17T20:49:07Z</dc:date>
    </item>
  </channel>
</rss>

