none
Storage Space : How to get real disk usage outside server manager? (Powershell ?)

    Question

  • Hi

    I use Storage space on a headless windows2012 server. 

    Server is fully remotely managed and I use a tool like MobilePcMonitor  to monitor it and being alerted when something appends (update, cpu/ram workload, temperature, drive health, etc)

    But with Storage Spaces (with fin provisionning) I can't manage the real free space on the real drive.
    I have a 50TB StorageSpaces, but "only"  10TB of real disk space, and almost the half is used.

    With the monitoring tool I can only check the 50TB virtualDrive, I can't find a way to know the real disk space, and the real free space. .
    These values exists, and you can find them under the proprieties of the StoragePool into the Windows Server Manager.

    I've checked performances counter, but find nothing Storagepool related.
    I'm looking to find theses value with Powershell, but I find nothing like this (checked all the docs I can find on technet, unsuccessfully)

    The goal is to be notified when real drive start to be full so I can manage to add a new drive on the Pool... Today I need to manually check on the server manager, where everything else can be monitored through a simple tool like mobilePCMonitor or SNMP.

    Does someone here know how we can fetch these datas ?

    Thanks

    Tuesday, November 27, 2012 5:09 PM

Answers

  • Thanks to yours answers I finally found what I was looking for, having a direction to search:

    http://msdn.microsoft.com/en-us/library/windows/desktop/hh830532(v=vs.85).aspx

    Get-WmiObject -Namespace "root/Microsoft/Windows/Storage" -Class MSFT_PhysicalDisk -Property Friendlyname, Size, AllocatedSize, Healthstatus,model | Format-Table Friendlyname, model, Size, Allocatedsize, healthstatus

    Thanks !


    • Marked as answer by Le_Poilu Thursday, December 06, 2012 1:40 PM
    • Edited by Le_Poilu Thursday, December 06, 2012 1:55 PM
    Thursday, December 06, 2012 1:40 PM

All replies

  • Looking for this values:


    Wednesday, November 28, 2012 4:35 PM
  • Hi,

    Right click on the storage pool and choose Properties, which could show the Used space and Free space.

    Also right click on the VHD you created on the storage pool could show the Allocated space and Used pool space.


    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.

    Thursday, November 29, 2012 8:18 AM
    Moderator
  • Hi. 

    I know this.. This is how I made the screenshot above. 

    I'm looking an alternate way to fetch this datas : powershell, performance counter, snmp, wmi, etc... 

    It's strange that nothing is documented for this... 

    • Edited by Le_Poilu Thursday, November 29, 2012 8:50 PM
    Thursday, November 29, 2012 8:50 PM
  • Here is a document for managing Storage Spaces with PowerShell:

    http://www.microsoft.com/en-us/download/details.aspx?id=30125


    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.

    Tuesday, December 04, 2012 8:15 AM
    Moderator
  • Powershell is your friend:

    Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2" -computername "servername" | where {$_.DriveType -eq "3"}

    Will give you all kinds of information about your drives.

    If you post over on the powershell forum you will get a lot more answers.

    This is a script I use to check physical disk space and email me if it gets too low.

    # Send an email with a specified Subject, To, and Body.
    function EmailNotification {
         param($emailSubject, $emailTo, $emailBody)   
                    
            $smtpServer = "ipaddress"
            # Create the Message/SmtpClient objects
            $msg = new-object Net.Mail.MailMessage
            $smtp = new-object Net.Mail.SmtpClient($smtpServer)
            $msg.From = “you@your.org”
            $msg.To.Add($emailTo)
            $msg.Subject = $emailSubject
            # Build the message body
            $msg.Body = $emailBody
            # Send the report
            $smtp.Send($msg)       
    }

    $server = "servername"

    # You can also loop through a collection of servers.
    # $server = get-content C:\Scripts\Myservers.txt

    $colItems = Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2" -computername $server | where {$_.DriveType -eq "3"}
    $diskalert = ""
    foreach ($objItem in $colItems) {
     ## Iterate through the objects and notify if values are wrong.                 
                     
                     # 1.5 GB = 1610612736
                     # 5 GB = 5368709120
                     
                     # test with -gt but switch to -lt in prod.
                     if ($objItem.FreeSpace -gt 110612736) {
                     
                     #$diskalert =  $diskalert + "Warning: " + $objItem.Name + " " + [math]::truncate($objItem.FreeSpace / 1GB) + " GB" + "`n"
                     $diskalert =  $diskalert + "Warning: " + $objItem.Name + " " + [math]::round($objItem.FreeSpace / 1MB) + " MB" + "`n"
                    
                     
                          }      
               
                          
                          }
                     if ($diskalert.Length -gt 0) {
                     
                    # Build your email
                    $mySubject = “Disk Capacity Alert"
                    $myTo = "you@your.org"
                    $myBody = $diskalert
                    
            # Send it
                    EmailNotification -emailSubject $mySubject -emailTo $myTo -emailBody $myBody
                     
                     }

    Tuesday, December 04, 2012 8:24 PM
  • Here is a document for managing Storage Spaces with PowerShell:

    http://www.microsoft.com/en-us/download/details.aspx?id=30125


    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.

    Hi

    This is the first thing I've checked, but there's absolutly nothing about what I asked.

    Wednesday, December 05, 2012 5:06 PM
  • Powershell is your friend:

    Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2" -computername "servername" | where {$_.DriveType -eq "3"}

    Will give you all kinds of information about your drives.


    This command give me the datas for the logicalDisk.

    Nothing about the physicalDisk that are used into a StoragePool.
    When a PhysicalDisk is pooled, there's no more "logical" volume on it. The LogicalDisk you'll find are the storage spaces you've create. This is not what I asked.

    There should be a WMI-Objet for the physicalDisk that are pooled .. but I really find no litterature on this...  :(

    Wednesday, December 05, 2012 5:14 PM
  • Thanks to yours answers I finally found what I was looking for, having a direction to search:

    http://msdn.microsoft.com/en-us/library/windows/desktop/hh830532(v=vs.85).aspx

    Get-WmiObject -Namespace "root/Microsoft/Windows/Storage" -Class MSFT_PhysicalDisk -Property Friendlyname, Size, AllocatedSize, Healthstatus,model | Format-Table Friendlyname, model, Size, Allocatedsize, healthstatus

    Thanks !


    • Marked as answer by Le_Poilu Thursday, December 06, 2012 1:40 PM
    • Edited by Le_Poilu Thursday, December 06, 2012 1:55 PM
    Thursday, December 06, 2012 1:40 PM