• There have been many articles on this subject and all them rely on xp_fixeddrives to report total and free disk space.  This works well in smaller environments but in much larger environments, especially those including a SAN, this approach will fall short.  Most larger organizations, ones which hire Sr. Level DBAs are moving towards Mount Points on the Windows Servers.  The lack of drive letters, the need to spread multi-terabyte databases over dozens of filegroups, failover and DR environment integration, all facilitate the need for a different approach to space consideration and how to address the disk space.

    WMI and many other tools in our SQL bag of tricks, fail to recoginize mountpoints in the environment.  If you xp_fixeddrives or even a WMIC query to look a drive which has a mount point with a terabyte of dataspace, all that is returned in the available space on the local disks.  This is really not going to help you and trust me, it looks "strange" on a report which you show 1.1 terabytes of data on a 17 Gb disk with 16 Gb Free. 

    There are ways to gather this information in C#, such as walking the directory tree, and adding the functionality through an extended stored procedure  but then you have to roll that out to all the servers and in secure/large environment, that is not always an easy or well received task. 

    The other factor to consider is support for the developed solution.  Writing C# is great for many add-ons but not all DBAs are comfortable with creating, maintaining and/or deploying C# applications or SQL stored procedures/functions.  

    The lack of this particular functionality (ability easily and accurately determine available/used disk space) and other similar functionaility is concerning and leaves many DBAs, who want to maintian a TSQL codebase, even if it uses COM XPs, at the mercy fo the monitoring software vendors out there.  Since CHKDSK can return the correct information on drives which have Mount Points, which is what I currently use to gather space information for TSQL by parsing the output, then I feel Microsoft should have updated the xp_fixeddrives routine to report the correct information or at least provided and documented a way of gathering that information.  Especiallys since SQL Server is by far the greatest benefactor of utilizing mount points to store the large amounts of data the want to boast the capability of being able to address.

    This article and the use of the email system is well thought out and helpful but not as much in larger SQL farms which managing the data environment is even more critical.  I would also suggest adding a table in your database to store sent alerts (emails) and build in the functionality of storing the messages as part of the routine.  This will allow someone to do historical reporting and analysis of the alerts, this one and others, which have been sent out over a period of time without being dependent on reviewing the emails through a mail server and its client or through a mail interface.

    Bob Wright

    Sr. DBA/.NET Architect/SQL Architect