公司最近把存储设备从NetApp换成了Nimble Storage,连接ESXi6的方式也从NFS变成了iSCSI。上周,豆子对一个很大的虚拟机执行了一个Storage Vmotion操作,发现尽管在VCenter上面显示成功了, 在Nimble的存储界面上,原先的LUN占据的存储空间并没有自动清掉。研究了一下,原来在ESXi6的系统上,执行了snapshot consolidate,storage vmotion等等操作之后,这些‘死掉’的空间并不会自动回收,而需要用户手动执行esxcli命令才会执行。

下面是具体操作的步骤。

Nimble 本身支持PowerShell,所以我可以通过脚本或者图形界面来进行对比。

首先看看PS的脚本

connect-nsgroup -Group 10.1.1.23 -Credential abc\admin -IgnoreServerCertificate

$Report = @()
$Volumes = get-NSVolume

    #Iterate through the volumes and store the usage (compressed and uncompressed) in GB in variables
    foreach ($Volume in $Volumes){
        Write-Verbose "Gathering data from $($Volume.Name)"

        $CompressedGB = $Volume.vol_usage_compressed_bytes / 1GB
        $UnCompressedGB = $Volume.vol_usage_uncompressed_bytes / 1GB

        #Write the data to a new object
        $hash = [Ordered]@{            
            VolumeName = $Volume.name                 
            CompressedGB = $CompressedGB
            UnCompressedGB = $UnCompressedGB
        }                                
        $Object = New-Object PSObject -Property $hash
        #Add the data to the array
        $Report += $Object

    }

$report

结果如下所示:


VolumeName       CompressedGB   UnCompressedGB
----------       ------------   --------------
SYD-Silver   4185.06537832227 6562.82331466675
SYD-Veeam    9378.09976012446 9311.72917175293
SYD-NASUNI   5775.57624073327 6381.53183746338
SYD-Archive  28585.6416311869 31313.0306777954
SYD-Platinum 1330.75676030945 2491.81824493408
SYD-Bronze   2716.69601499569 3588.08150863647
SYD-Gold     100.053084951825 219.250961303711

执行下面的命令

这个取决于LUN的大小,我的这个Thin 配置的LUN有10T,大概等了1个多小时才结束

结束之后,再次执行脚本或者登陆web console查看空间 结果如下

VolumeName       CompressedGB   UnCompressedGB
----------       ------------   --------------
SYD-Silver   4187.84719586652  6567.3570022583
SYD-Veeam    9376.82992831524 9311.73175430298
SYD-NASUNI   5773.28081614058 6381.55347824097
SYD-Archive  28585.5442300336  31313.041885376
SYD-Platinum 1331.21670859773 2492.49526596069
SYD-Bronze    817.28842341993 1402.45195007324
SYD-Gold      99.936622262001 219.308860778809

成功释放了1.9T的空间!

如果每次都需要这样手动操作释放的话,比较麻烦。目前一个比较好的方案是升级到ESXi6.5, 同时把文件系统升级到VMFS6。在VMFS6里面,上面的流程就是自动执行了。不过因为VMFS6的架构完全改变了,因此对于现有的VMFS5系统,他不支持直接升级,只能重新创建新的。