none
Script to shrink all recovery points RRS feed

  • Question

  • Hi,

     

    I have more than 8 DPM servers and i have to go through each server to shrink the recovery points to free disk space in the DPM storage pool.

     

    Is it possible to run a powershell script to shrink all the recovery points?

     

    // Laith.

    Thursday, September 22, 2011 9:29 AM

Answers

  • You can download the shrink-diskpart.zip file from the following location.  This may be updated at a later time and is supplied as-is.

    Shrink-diskpart.zip

    It has three modes of operation and will prompt to select one during execution.

    R = Report, S = Shrink with confirmation, A = Automatically Shrink all possible volumes:


    Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, October 7, 2011 5:51 PM
    Moderator

All replies

  • Any ideas?
    Thursday, October 6, 2011 8:13 AM
  • You can download the shrink-diskpart.zip file from the following location.  This may be updated at a later time and is supplied as-is.

    Shrink-diskpart.zip

    It has three modes of operation and will prompt to select one during execution.

    R = Report, S = Shrink with confirmation, A = Automatically Shrink all possible volumes:


    Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, October 7, 2011 5:51 PM
    Moderator
  • whenever i tried to download the script i get

    There's a temporary problem

    There's a temporary problem with the service. Please try again. If you continue to get this message, try again later

    Will get back to you as soon as i download it!

    Tuesday, October 18, 2011 5:34 AM
  • Hi Mike,

    I still cannot download the file. Still getting the same error. Is it possible to post it some where else?

    // Laith.

    Tuesday, October 18, 2011 9:32 AM
  • Hi, I tested it and had a few colleagues also test it and there were no problems getting to it - do you have another system you can try connecting from ?   Can you access other https sites ?
    Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, October 18, 2011 4:00 PM
    Moderator
  • I downloaded from a colleague computer.

     

    THANK YOU VERY MUCH mike... You saved couple of hours per week just shrinking the volume manually. Maybe a good idea to add in DPM 2012 "SHRINK ALL"  it will be helpful and really appreciated!

     

    I noticed that the script is not shrinking the volume if the shrinking space is less than 10 GB which is different from the shrink inside DPM. But it worked like a magic! And actually it worked better than the shrink in DPM!!!

     

    Thanks again!

    Laith.

    Wednesday, October 19, 2011 9:57 AM
  • Hi,

    I'm glad that you were able to get it.  We do not encourage the frequent usage of shrink because that leads to fragmented volumes and may cause other larger problems down the road.  It's much better to "PLAN" your storage requirements per data source ahead of time so you don't need to grow or shrink volumes.


    Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, October 19, 2011 8:49 PM
    Moderator
  • Hi,

    The problem is that data will grow by time and it will allocate more space as well. thats why i need to shrink my recovery points from time to time. it free up around 2 TB for each 18 TB.

    Is that script using the same method as the shrink in DPM GUI?

     

    // Laith.

    Thursday, October 20, 2011 3:33 PM
  • Hi,

    Yes, both DPM and Diskpart.exe call into the defrag engine and shrink code in the virtual disk service and will attempt to shrink a volume.   The powershell script tries to mimic what DPM does and will not shrink if there are not enought recovery points created yet, or if we cannot shrink more than 10GB.  The script will shrink 90% of the maximum reclaimable space to allow for future growth of data wirhout having to regrow.

    You can look in the application event log for defrag events to see why a volume cannot be shrunk further.

     


    Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, October 20, 2011 4:17 PM
    Moderator
  • Im running it once a month and i didnt have any problem.

    Im thinking about schdeuling running this script once a month on all DPM servers. Do you recommend that?

     

    // Laith.

    Friday, October 21, 2011 6:47 AM
  • I found a bug in your script, on line 169.

    The part that sets the shrinkable size (  $shrinkvalue = ($shrinkvalue * .9).tostring() ) allows decimals to be parsed into the string.

    E.G.: 9048 * .09 = 8143.2
    The desired shrink size gets set to 81432 which is too much.

    I've replaced the line with the following:
    $shrinkvalue = [Math]::Truncate(($shrinkvalue * .9)).tostring() so the var get truncated to 8143.

    I didn't get any errors from diskpart since I changed the script.

    Kind regards,

    Robbert


    • Edited by ChaoZero Wednesday, June 27, 2012 8:10 AM
    Wednesday, June 27, 2012 7:47 AM
  • I know I'm a bit on the 'drag' but cool script !
    Tuesday, December 31, 2013 2:30 PM
  • Hi Robert,

    Thanks for the feedback, I have updated the script on the download site to include your change.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, December 31, 2013 4:23 PM
    Moderator
  • Would it be possible to modify the script so that it will shrink when space available to be shrank is 5GB instead of 10GB?  I have many targets that fall below the 10GB threshold and space could be recovered if it was allowed.
    • Edited by Tech FA Friday, October 24, 2014 5:21 PM correction
    Friday, October 24, 2014 5:19 PM
  • Hi,

    That really would not be a good idea because then you end up with more fragmented free space in the storage pool which can lead to other longer term problems.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, October 24, 2014 10:13 PM
    Moderator
  • Mike,

    Understood, but what if you could consolidate the dynamic disks and make them contiguous with a utility like Mini Tool Partition Wizard?  I'd post the links but not verified yet.

    www. partitionwizard. com/help/moveresize-volume.html

    I found this post of yours where you were looking for such a 3rd party utility:

    social.technet.microsoft.com /Forums/en-US/cbb03be7-1c45-49d9-8878-c6e757257f0a/dpm-2010-and-contiguous-partitions?forum=dpmstorage

    I have not tried this yet but what if that does the job?

    Tuesday, October 28, 2014 2:49 PM
  • Hi,

    It all depends on if that effects shadow copies when a partition is shrunk or moved.  I would test on a small scale against a datasource that you don't mind losing recovery points for.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, October 29, 2014 4:36 AM
    Moderator
  • hello - I appreciate that this post is a few years old - I could really do with this PS script to reclaim some space via 'shrinking' but the link is no longer available.

    Does anyone have a link to where this can be downloaded please.

    thanks in advance

    Lee

    Friday, December 23, 2016 11:52 PM