Array Setup and Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Reclaim space quickly (sdelete alternative)

 
Highlighted
Frequent Advisor

Re: Reclaim space quickly (sdelete alternative)

My test was performed on an iSCSI guest-connected volume - not a VMDK.  We're using a CS220GX2 with 10G connections - seemed like it took >2.5 hours.


Highlighted
Valued Contributor

Reclaim space quickly (sdelete alternative)

Hi David, I created a new vmfs volume on nimble and added a Datastore through vcenter. Added Vm disk to a windows 2008R2 VM and put 2GB of files into it. Deleted them and ran your script. BINGO once again. Works with vSphere 5.5.

Highlighted
Advisor

Re: Reclaim space quickly (sdelete alternative)

What command can one use to run the script against remote servers? I would like to run this task against more than one server, once per month for example.

Highlighted
Valued Contributor

Re: Reclaim space quickly (sdelete alternative)

Probably a few ways to do it but I would use invoke-command

try something like this

invoke-command -filepath <path>\NimbleFastReclaim.ps1 -computername $ComputerName -ArgumentList "<pathtorun>"

You can also specify a list of computers in the parameter if they all have consistent paths you want to run on. Can also pass variables to the argumentlist if you want to run programatically - this might help http://stackoverflow.com/questions/4225748/how-do-i-pass-named-parameters-with-invoke-command

Highlighted
Advisor

Re: Reclaim space quickly (sdelete alternative)

Hi David,

Thanks for your assistance thus far.  When I try to perform the script, I get a failure as indicated below, any ideas?:

PS C:\Users\labadmin> Invoke-command -filepath C:\NimbleFastReclaim.ps1 -ComputerName test-fs1 -ArgumentList "e:" -Credential domain1.lab\Administrator

[2014-02-04 21:14.20] --> Starting Reclaim on e:\ ...

[2014-02-04 21:14.20] --> Cycle Sleep = 0 sec

[2014-02-04 21:14.20] --> File Size = 1024 MB

[2014-02-04 21:14.20]   -->Writing e:\NimbleFastReclaim0.tmp

[2014-02-04 21:14.20] ##> Reclaim Failed. Cleaning up...

The user account being used is a domain admin account, and is able to run the script locally on the server being specified in this example. Any help you or anyone else can provide would be great. I realize we are starting to deviate off-topic a bit, but I thought this might come in handy for others who might face a similar problem. My powershell experience is very limited.

Highlighted
Occasional Advisor

Re: Reclaim space quickly (sdelete alternative)

Unfortunately I'm getting the same error on all my servers:

[2014-02-04 21:14.20] --> Starting Reclaim on F:\ ...

[2014-02-04 21:14.20] --> Cycle Sleep = 0 sec

[2014-02-04 21:14.20] --> File Size = 1024 MB

[2014-02-04 21:14.20]   -->Writing F:\NimbleFastReclaim0.tmp

[2014-02-04 21:14.20] ##> Reclaim Failed. Cleaning up...

Cheers,

Eric

Highlighted
Advisor

Re: Reclaim space quickly (sdelete alternative)

Glad to see this is not just me. I am sure we will be able to collectively come up with a solution. Unfortunately my knowledge of powershell is extremely limited, so I am of limited help, but it would be great to have an automated solution to handle all servers in a scripted and scheduled manner. I cant believe there are not others who would benefit from the same thing.

Highlighted
Valued Contributor

Re: Reclaim space quickly (sdelete alternative)

I'll try this out today and let you know. Will probably need some error handling so it spits out a useful error message. Btw - have you tried to run the invoke-command to a remote server with a simple command?

Eg invoke-command -computername <remotecomp> -scriptblock {get-wmiobject win32_computersystem}

Highlighted
Occasional Advisor

Re: Reclaim space quickly (sdelete alternative)

Howdy,

Yes, I was able to run your example invoke-command, once I ran ‘WinRM quickconfig –q’ on the target server. However, still no joy with either local drives or mapped remote drives.

Eric

Highlighted
Valued Contributor

Re: Re: Reclaim space quickly (sdelete alternative)

Hi Guys,

Turned out to be a memory error. Running powershell script remotely has finite memory limits depending on WinRM settings. This version should fix it by writing smaller chunks to the starting file in a loop. Now I know why Chris Duck did this in his script. Also spits out the error in the catch statement so it will at least tell you why it failed.

Cheers