Quick and Easy Datastore Usage Discovery

Have you ever had a full datastore and needed to easily discover which folder was the main culprit?  I’m sure that there are a thousand ways to do this, but one easy one is available from the ESXi host command line.  Either pull up the local console (with the local Shell enabled) or open an SSH session remotely (I know, we’re not supposed to do that anymore!).  Then, navigate to the datastore that you wish to examine with a command like:

cd /vmfs/volumes/MyDatastore

Once you’re on the datastore, use the “du” command to display disk usage.  If you use the command by itself, it will recursively display the disk usage of all folders/subfolders from your current location in kilobytes.  While that’s useful, it’s not the most user friendly thing in the world.  Instead, I like to use this command:

du –m –d 1


That will display the disk usage in megabytes (it would be nice if it had a gigabytes option, but oh well) and will only display the total size of the child folders of the current folder (and, at the bottom, the total usage of the current directory).  With that display on screen, you can swiftly scan the size column on the left to determine which folders are eating up the most space.  Bear in mind that this is showing the actual disk usage, not allocation, so if you have a 200 GB thin provisioned hard drive that only has 16 GB in use, it will only attribute 16 GB to that folder.

Comments

Popular posts from this blog

Clone a Standard vSwitch from one ESXi Host to Another

PowerShell Sorting by Multiple Columns

Deleting Orphaned (AKA Zombie) VMDK Files