Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently using SQL Server 2005 and (undocumented I believe) master..xp_fixeddrives to get free space on my database volumes as part of my monitoring.

However, this only gives me an absolute number of MB free. What I really need is percentage free.

Is there another way in SQL Server 2005 to get this? If not, is there some other light-weight way to get it? If I can, I want to avoid installing a Java JRE, or Perl, or Python on my database server. Perhaps vbscript, or a small Windows executable on the file system?

Yes, I know I can Google this, and I have. It looks like there are a few ways to accomplish it, and I'm curious how my DBA brethren have handled this.

share|improve this question

migrated from Jan 10 '13 at 15:14

This question came from our site for system and network administrators.

Personally, I don't know why you need to do this from within SQL Server. You can get this as often as you want and fairly straightforward using PowerShell, or C#, or even VBScript in a scheduled task of some kind, and then have that program update a table if you really need this stored in the database (and frequency would be dictated by how volatile your disks are and how current you need the data to be). I recommend against shelling out to the OS to collect this information while an end user is waiting.

That said, in SQL Server 2012 (and 2008 R2 SP1+) there is a new DMV called sys.dm_os_volume_stats. This DMV has total size and available size so you can perform any resulting calculations from there. I haven't tested how current this data is - it may be seconds behind or more.

share|improve this answer
Tara Kizer put out a CLR script that can also provide this info that reads from perfmon. It's advantage over xp_fixeddrives is it also reads mountpoints. We currently use this. – Mike Fal Jan 10 '13 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.