Have a Question?
How to Check Actual Usage of vmdk file
Steps on how to check actual usage of vmdk file
Using PowerCLI
(Get-VM -Name IB-MBX02).ExtensionData.LayoutEx.file | ? Name -like "*flat*" | Select Name, `
@{N="Size";E={[math]::Round(($_.size)/1GB)}}
Output
Name Size
---- ----
[SAN1-Datastore] IB-MBX01/IB-MBX01-flat.vmdk 89
[SAN1-Datastore] IB-MBX01/IB-MBX01_1-flat.vmdk 27
[SAN1-Datastore] IB-MBX01/IB-MBX01_2-flat.vmdk 1285
[NFS-QUANTUM] IB-MBX01/IB-MBX01-flat.vmdk 3072
Using du -h
Login to ESXi via SSH / Console, and
[root@IB-ESX01:/vmfs/volumes/56791c92-2dd6912d-4683-44a84228b775/IB-MBX01] du -h IB-MBX01_2-flat.vmdk
1.3T IB-MBX01_2-flat.vmdk
Report for all VMs with PowerCLI
$Report =@()
foreach ($VM in Get-VM) {
$view = Get-View $VM
$Row = '' | Select Name, VMDKs, VMDKSize, VMDKUsed, Thin
$Row.Name = $VM.Name
$Row.VMDKs = $view.config.hardware.Device.Backing.Filename | Out-String
$Row.VMDKsize = $view.config.hardware.Device | where {$_.GetType().name -eq 'VirtualDisk'} | ForEach-Object {($_.capacityinKB)/1048576} | Out-String
$Row.VMDKUsed = ($VM.ExtensionData.LayoutEx.file | ? Name -like "*flat*") | % {[math]::round(($_.Size/1GB),2)} | Out-String
$Row.Thin = $view.config.hardware.Device.Backing.ThinProvisioned | Out-String
$Report += $Row
}
$Report | Select Name, VMDKs, VMDKSize, VMDKUsed, Thin | Export-Csv C:\Temp\Report1.csv -NoTypeInformation
Sample of Report