Hello,
Is there a way to set datastore space reclamation rate via PowerCli? I looked number of examples but they all mention about setting via esxcli. I am looking to set the space reclamation rate from 100 MB/s to 400 MB/s? for number of datastores.
Thank you
You can use all esxcli commands through the Get-EsxCli cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use all esxcli commands through the Get-EsxCli cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Would be great to have some more of that .
PowerCLI and Datastore ( Reclamation ) , there is not to much content from "Mister Google" and "Mister ChatGPT" is not currently answering
Mayb @LucD has a Link he can Post .
What would be the Synthax to use something like
esxcli storage vmfs reclaim config set --volume-label datastore_name --reclaim-method fixed -b 100
with PowerCLI ?
https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-AAEB5C55-A815-4F9D...
You mean like this?
Solved: Re: reclaim storage - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If that would help yes , but I run into error like the other User in the Thread.
So thanks for the Answer, but It would be nice to pole all Datastores
Like that ( from someone else, which provide Infos to the Datastores )
$Datastores = Get-Datastore
foreach($DS in $Datastores)
{
$DSInfo = $DS.ExtensionData.Info
if($DSInfo -is [VMware.Vim.VmfsDatastoreInfo] -and $DSInfo.Vmfs.MajorVersion -eq 6)
{$DSInfo.Vmfs | select Name, BlockSizeMb,Version, UnmapPriority, UnmapGranularity, Uuid, Extent}
else {
$prop = [ordered]@{Name = $DSInfo.vmfs.Name
BlockSizeMb = $DSInfo.Vmfs.BlockSizeMb
Version = $dsinfo.vmfs.Version
UnmanPriority = "VMFS Version is below 6"
UnmapGranularity = "VMFS version is below 6"
}
New-Object -TypeName psobject -Property $prop | ft -AutoSize
}
}
And then have the ability to change Unmap Priority in a Bulk.
Not sure I understand what you are trying to do.
That script just lists the datastores, where does the unmap come into play?
And what do you mean by "change Unmap Priority in a Bulk"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
"change Unmap Priority in a bulk" sorry , maybe that is wrong english .
I try identify all those Datastores which have a UnmapPriority "none" and change the UnmapPriority then to "low" .
If the UnmapPriority is "none" there will be no Space Reclamation going on , if it is "low" Reclamation rate is around 100 MB/s
Something along these lines
Get-Datastore -PipelineVariable ds |
Where{$ds.Type -eq 'VMFS'} |
ForEach-Object -Process {
$obj = [ordered]@{
Name = $ds.Name
BlockSizeMb = $ds.ExtensionData.Info.Vmfs.BlockSizeMb
Version = $ds.ExtensionData.Info.Version
UnmanPriority = ''
UnmapGranularity = ''
Uuid = $ds.ExtensionData.Info.Uuid
}
if (([version]$ds[0].FileSystemVersion).Major -lt 6) {
$obj.UnmapPriority = "VMFS Version is below 6"
$obj.UnmapGranularity = "VMFS version is below 6"
}
else{
$obj.UnmapPriority = $ds.ExtensionData.Info.Vmfs.UnmanPriority
$obj.UnmapGranularity = $ds.ExtensionData.Info.Vmfs.UnmapGranularity
if ($ds.ExtensionData.Info.Vmfs.UnmapPriority -eq 'none'){
$esx = Get-VMHost | Get-Random -Count 1
$esxcli = Get-EsxCli -VMHost $esx -V2
$arguments = $esxcli.storage.vmfs.reclaim.config.set.CreateArgs()
$arguments.volumelabel = $ds.Name
$arguments.reclaimmethod = 'fixed'
$arguments.reclaimpriority = 'low'
$arguments.reclaimbandwidth = 100
$esxcli.storage.vmfs.reclaim.config.set.Invoke($arguments)
}
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks .. for solving the puzzel
