tkdreamer2
Enthusiast
Enthusiast

Reclaim spcae with PowerCLI - https://kb.vmware.com/s/article/2057513

Hi,

I am working with vSphere 6 (no upgrade schedulded)

My problem can be resolved with the KB2057513, nonetheless I need to reclaim space in PowerCLI, not with SSH (internal process, cannot explain here)

Do you know how to reclaim space with PowerCLI?

esxcli storage vmfs unmap --volume-label=volume_label|--volume-uuid=volume_uuid --reclaim-unit=number

Regards

Gary

0 Kudos
12 Replies
LucD
Leadership
Leadership

You can do something like this.

$esxName = 'MyEsx'

$datastoreName = 'MyDatastore'

$esxcli = Get-EsxCli -VMHost $esxName -V2

$sParam = @{

    volumelabel = $datastoreName

}

$esxcli.storage.vmfs.unmap.Invoke($sParam)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tkdreamer2
Enthusiast
Enthusiast

Thank you. It seems to be okay, unfortunately I have an error message saying " device or resource busy"

I don't have yet the password of the other VMs to check is someone is connecting and working on them.

After that I've personnalized the script like this:

"$esxname= 'my esx'

$esxcli= ' Get-Esxcli -VMhost $esxname - V2

$esxcli.storage.vmfs.unmap.Invoke"

Here's the result:

OverLoadDefinition: {boolean Invoke(Hastable args)}

Membertype:

TypeNameOfValue:

Value:

Name:

IsInstance:

0 Kudos
LucD
Leadership
Leadership

Can you share a screenshot of the error?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tkdreamer2
Enthusiast
Enthusiast

Here it is

0 Kudos
LucD
Leadership
Leadership

You might want to have a look at the last bullet in KB2057513


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tkdreamer2
Enthusiast
Enthusiast

I used this: -u|--volume-uuid=volume_uuid

but I have a timeout message...

0 Kudos
LucD
Leadership
Leadership

Sorry, not following.
You didn't use the Get-EsxCli cmdlet?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tkdreamer2
Enthusiast
Enthusiast

I did, but I thought you were suggesting to use the -u option.

I already knew about this KB VMware Knowledge Base , but as I said, I have to do it with PowercLI...

0 Kudos
LucD
Leadership
Leadership

No, I was referring to the last bullet in that KB, the one that starts with 'If the UNMAP operation fails and you see an error...'

To try and find why you get the error


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tkdreamer2
Enthusiast
Enthusiast

I read the article but I have to activate the SSH to enter the command "vmkfstools"

Unfortunately, my client doesn't want me to activate the SSH --'

It seems we can not unmap a datastore with PowerCLI in vSphere 6.

Thany you anyway

0 Kudos
baburaju
Contributor
Contributor

Hi Lucd,

I am trying below command but it was not freeing up the space on the datastore as I have created  datastore from scaleio.

regards,

babu

0 Kudos
LucD
Leadership
Leadership

Did you check all the possible reasons why unmap might not work in the KB I referenced earlier?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos