HI
I am reclaiming storage at this point doing the following
ssh to the esxi
and run esxcli storage vmfs unmap -l DS
can I accomplish the same using PSC to connect to the esxi host and run that command and not SSH to it
I can connect to the esxi by connect-viserver but I dont know how to run the esxcli storage vmfs unmap -l DS from within Powershell cli
Thanks for any help
You can use the Get-EsxCli cmdlet for that (while connected to the vCenter).
$esxcli = Get-EsxCli -VMHost $esxName -V2
$argHash = @{
volumelabel = 'DS'
}
$esxcli.storage.vmfs.unmap.Invoke($argHash)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the Get-EsxCli cmdlet for that (while connected to the vCenter).
$esxcli = Get-EsxCli -VMHost $esxName -V2
$argHash = @{
volumelabel = 'DS'
}
$esxcli.storage.vmfs.unmap.Invoke($argHash)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
I am glad you dont sleeeeeepppppp
I get this error
any thought
You would need to provide more info about the storage and its backing.
In KB2048466 it says
"The VAAI primitive UNMAP only works on SAN arrays where the partition offset is a multiple of 1 MB"
VMFS 6 requires unmap granularity of 1MB.
It could be that your SAN has a larger unmap granularity block size than 1MB.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
where would I go getting more info on this cmdlet
does it matter if the vmfs is 5 or 6 ? they have to be thin provisioning correct ?
Thanks
L.
learning curve
what is wrong with this statement
$Esxcli=get-esxcli -vmhost xxx.xxx.xxx.xxx
$Esxcli.storage.vmfs.unmap("DS")
when ran I get
It could be that port 902 is not open on the ESXi node (FW rule).
You can test with the curl command.
Something like: curl esx.domain:902
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
I ran your script and It came back with the following error
Index(zero Base) must be greater than or equal to zero.....
any ideas why
Thanks
Which PowerCLI version are you using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
5.1.1798
Really?
Any specific reason for that?
That is a very old version.
Can you upgrade?
See Welcome PowerCLI to the PowerShell Gallery – Install Process Updates for detailed instructions.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
Just came with my VDI , my bad I did not check on version and upgrade for a most up-to-date one
on my way
L.
I am getting somewhere!!!
after running the script (while on vcenter)
I got the following error
Then I connected to the esxi directly and ran the script again but now I get the following
suggestions chief
Thanks
You are most probably hitting the timeout mentioned (and solved) in PowerCLI for SCSI Unmap
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
How can I go on your script and check when the entire process is done?
Thanks a bunch
You mean something like this?
$esxName ='MyEsx'
$esxcli = Get-EsxCli -VMHost $esxName -V2
$argHash = @{
volumelabel = 'DS'
}
$esxcli.storage.vmfs.unmap.Invoke($argHash)
}
Measure-Command -Expression $code
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
I would like to know when the process is completed, so I can close the ps session?
I will check on your code
Thanks
That depends how you are running this.
Are you starting a .ps1 script from your PS session?
If yes, adding the following line at the end should work.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
L.
I would like to convert this on a PS1 that can be used on a schedule to run twice a week.
Thanks
Hi LuCD,
About your script, is there a way to apply this to all Datastore in vCenter. This issue is currently killing our environment. We are not big company with limited storage. When storage is full and all VMs will go down and it happens many times.
We ussually do the reclaiming when issue arises on one cluster. If this can be modified for all DS in a vCenter, I can run the script weekly.