Disk Usage Analysis with Data Mounts

We currently have some servers that use data mounts but the disk analysis does not return the results from the mounts.

For example, the D disk on the server has several data mounts that are 511GB, 512GB and 300GB in size yet when the analysis runs it does not return the values from the mounts. See below. Does anyone know of a way to get the data mount disk info?

Q:(name of it & " - " & type of it) of drives
A: C: - DRIVE_FIXED
A: D: - DRIVE_FIXED
T: 2.924 ms

Q:(name of it & " " & (free space of it / 1024 / 1024 / 1024) as string & " GB") of drives whose (type of it = “DRIVE_FIXED”)
A: C: 10 GB
A: D: 0 GB
T: 2.762 ms

Q:(name of it & " " & (free space of it * 100 / total space of it) as string & " percent free") of drives whose (type of it = “DRIVE_FIXED”)
A: C: 20 percent free
A: D: 98 percent free
T: 1.969 ms

Q:(name of it & " " & (total space of it / 1024 / 1024 / 1024) as string & " GB") of drives whose (type of it = “DRIVE_FIXED”)
A: C: 49 GB
A: D: 0 GB
T: 0.730 ms

How would you get the sizes on the command line?

Hey Jason

We would probably use the powershell command Get-Volume. Is this something we could use in an analysis?

I was actually trying to find the right thing to Google to figure out what you mean by a ‘data mount’. I haven’t heard it called that before, but I think you mean a volume mounted in a directory path, where the volume itself does not have a drive letter?

You are exactly right. The volume is mounted to a directory path instead a drive letter. Sorry for the confusion.

It’s been a long time since I encountered a setup like this but if we don’t get a better answer here I’ll try to reproduce it.

My recollection is that our native inspectors don’t handle it, but I think you should be able to get this through a WMI query

Check whether this gives the information you need. On mine, in addition to the normal drive letters, it shows the Recovery and EFI volumes that aren’t assigned drive letters, so I think this should reflect your path-mounted volumes as well

q: (concatenation "; " of (name of it & ": " & (string value of it | "N/A")) of properties ("BootVolume"; "Description"; "Caption";"Capacity";"DriveLetter";"Name";"FreeSpace";"FileSystem") of it) of select objects "BootVolume, Description, Caption, Capacity, DriveLetter, Name, FreeSpace, FileSystem from Win32_Volume" of wmis
A: BootVolume: True; Description: N/A; Caption: C:\; Capacity: 375084019712; DriveLetter: C:; Name: C:\; FreeSpace: 157388316672; FileSystem: NTFS
A: BootVolume: False; Description: N/A; Caption: \\?\Volume{49ea1b4a-0ba7-4dfa-9816-151746c4b3ad}\; Capacity: 600829952; DriveLetter: N/A; Name: \\?\Volume{49ea1b4a-0ba7-4dfa-9816-151746c4b3ad}\; FreeSpace: 120553472; FileSystem: NTFS
A: BootVolume: False; Description: N/A; Caption: \\?\Volume{07053d1b-5540-4c37-89b4-49a4c5862406}\; Capacity: 100663296; DriveLetter: N/A; Name: \\?\Volume{07053d1b-5540-4c37-89b4-49a4c5862406}\; FreeSpace: 70458368; FileSystem: FAT32
A: BootVolume: False; Description: N/A; Caption: D:\; Capacity: 532060160; DriveLetter: D:; Name: D:\; FreeSpace: 0; FileSystem: CDFS
T: 18.443 ms

For a list of all the available properties from Win32_Volume, we can use this query (I’m only showing the results from the first volume)

q: selects "* from Win32_Volume" of wmis
A: Access
A: Automount=True
A: Availability
A: BlockSize=4096
A: BootVolume=True
A: Capacity=375084019712
A: Caption=C:\
A: Compressed=False
A: ConfigManagerErrorCode
A: ConfigManagerUserConfig
A: CreationClassName
A: Description
A: DeviceID=\\?\Volume{eaa04d62-a8cd-45f2-b410-6b220549a699}\
A: DirtyBitSet=False
A: DriveLetter=C:
A: DriveType=3
A: ErrorCleared
A: ErrorDescription
A: ErrorMethodology
A: FileSystem=NTFS
A: FreeSpace=157388316672
A: IndexingEnabled=True
A: InstallDate
A: Label
A: LastErrorCode
A: MaximumFileNameLength=255
A: Name=C:\
A: NumberOfBlocks
A: PageFilePresent=True
A: PNPDeviceID
A: PowerManagementCapabilities
A: PowerManagementSupported
A: Purpose
A: QuotasEnabled=False
A: QuotasIncomplete=True
A: QuotasRebuilding=False
A: SerialNumber=-1061386913
A: Status
A: StatusInfo
A: SupportsDiskQuotas=True
A: SupportsFileBasedCompression=True
A: SystemCreationClassName
A: SystemName=BES-ROOT
A: SystemVolume=False

Jason, I think this will work. How difficult would it be to convert the capacity and free space to GB?

Thanks

You could use this if GB in integer is ok, understanding that anything smaller than a GB will be truncated to 0.

q: (string value of property "Caption" of it, string value of property "Capacity" of it as integer / 1024 / 1024 / 1024, string value of property "FreeSpace" of it as integer / 1024 / 1024 / 1024) of select objects "Caption, Capacity, FreeSpace from Win32_Volume" of wmis
A: C:\, 349, 146
A: \\?\Volume{49ea1b4a-0ba7-4dfa-9816-151746c4b3ad}\, 0, 0
A: \\?\Volume{07053d1b-5540-4c37-89b4-49a4c5862406}\, 0, 0
A: D:\, 0, 0

If we need to show something like 0.5 GB as a floating point, it’s possible but I didn’t want to go into that unless you think it’s needed

This is great. Thanks Jason!