3

I've a requirement to list all files across all datastores in my moderately sized VMware vSphere environment (30 ESXi hosts).

Knowing a bit of Powershell I thought this would be easy but the process is proving to be remarkably slow.

Am I going about this the wrong way or missing something simple?

dir vmstores:\ -Recurse | Select-Object Name,DatastoreFullPath,LastWriteTime

4
  • Can you give some information about why you need this? It's an odd request, so perhaps understanding the real goal can help us help you with a better recommendation.
    – ewwhite
    Aug 24, 2015 at 2:29
  • Of course; just through browsing datastores I've noticed there are a number of old and seemingly unused files. I'd like to list all of the files in all datastores before taking a closer look at those which stick out. Aug 24, 2015 at 3:01
  • Why is this a concern? What problem is this going to solve?
    – joeqwerty
    Aug 24, 2015 at 3:17
  • Why do you care if there are old files on a datastore? Are they posing a problem?
    – ewwhite
    Aug 24, 2015 at 3:17

1 Answer 1

3

Hmmm,

This is not a common thing to do. Why would you be concerned about datastore files if you're not having a space issue or investigating bad behavior/performance?

(30 ESXi hosts isn't a modest environment either)

  • View from your storage array (assuming shared storage).
  • View from a host that can see the datastores. Heck, a well-crafted find from the ESXi shell can do this.
  • Use the Storage Views functionality in the vCenter client to show you if there are any heavy consumers or extraneous VM snapshots on the datastores.

Or...

  • Don't worry about it. Looking at your Powershell, you're looking at LastWriteTime. That's fraught because some VM-related files don't change often or aren't written to on a regular basis.

For example, nothing here should be deleted:

/vmfs/volumes/8f8b6a6b-d2d609d9/ChiFG # ls -l
total 7929008
-rw-r--r--    1 42949672 42949672        73 Aug 23 23:56 ChiFG-8e270ef3.hlog
-rw-------    1 42949672 42949672 2147483648 May  3 17:18 ChiFG-8e270ef3.vswp
-rw-------    1 42949672 42949672        13 Feb 10  2014 ChiFG-aux.xml
-rw-------    1 42949672 42949672   2359808 Aug 24 03:02 ChiFG-ctk.vmdk
-rw-------    1 42949672 42949672 38654705664 Aug 24 03:26 ChiFG-flat.vmdk
-rw-------    1 42949672 42949672      8684 Aug 24 03:20 ChiFG.nvram
-rw-------    1 42949672 42949672       622 Aug 24 03:02 ChiFG.vmdk
-rw-r--r--    1 42949672 42949672        45 Aug 24 03:02 ChiFG.vmsd
-rwxr-xr-x    1 42949672 42949672      4597 Aug 24 03:02 ChiFG.vmx
-rw-------    1 42949672 42949672         0 Aug 23 23:56 ChiFG.vmx.lck
-rw-r--r--    1 42949672 42949672      3433 Feb 10  2015 ChiFG.vmxf
-rw-------    1 42949672 42949672   1180160 Aug 24 03:08 hbr-persistent-state-RDID-47660b7b-ef63-4cd7-b6a0-66e3056a776d.psf
-rw-r--r--    1 42949672 42949672    161127 Aug 23 11:26 vmware-2112.log
-rw-r--r--    1 42949672 42949672    161342 Aug 23 12:06 vmware-2113.log
-rw-r--r--    1 42949672 42949672    160726 Aug 23 12:21 vmware-2114.log
-rw-r--r--    1 42949672 42949672    161139 Aug 23 13:26 vmware-2115.log
-rw-r--r--    1 42949672 42949672    161288 Aug 23 23:16 vmware-2116.log
-rw-r--r--    1 42949672 42949672    160356 Aug 23 23:56 vmware-2117.log
-rw-r--r--    1 42949672 42949672    171262 Aug 24 03:04 vmware.log
-rw-------    1 42949672 42949672 856686592 Aug 23 23:56 vmx-ChiFG-2384924403-2.vswp

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .