Need script that totals free disk space AND free space in files

  • We have a number of ways, including Quest Spotlight in our case, to get either free space on the drives holding the data files, or the free space within the files, but no easy way to get both output in one query. It always includes manual editing of a spreadsheet to add up the two, and I think you really want both in addressing the need for more disk space -- for example you've created a new data file at 100GB and it starts out empty on a drive with 20GB free space. Before asking for more space you need to look at both, not just the 20GB free on disk.

  • The problem is that you are asking for two fundamentally different things. I think you'd have to combine two scripts, perhaps though some union to get this.

    Here's one: http://www.sqlservercentral.com/scripts/Maintenance+and+Management/30881/

    This might be the other.: http://www.sqlservercentral.com/scripts/Database+Maintenance/94850/

  • I think a powershell script would be your best friend for this kind of requirement.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Tried a few things including the suggested scripts from Steve. Since our production environment uses mount points and because sp_databases returns null for larger databases, etc etc, I'll probably just use our Quest spotlight tool. It will provide both disk free and free inside files, just not in one view. We only have one data file, which needs work, that has a substantial amount of free space in the file -- substantial meaning over 100GB, so free space on disk is probably good enough as something to watch, set up alerts, and request more disk space as needed.

    Tried this powershell on our prod environment but it isn't reporting "inside" the mount points, just free space on the folder hosting the mount points.

    Get-WmiObject -ComputerName Remoteserver -Class Win32_LogicalDisk | Select -Property DeviceID, @{Name=’FreeSpaceMB’;Expression={$_.FreeSpace/1MB} } | Format-Table -AutoSize

  • Here's one that is supposed to gather the mount point free space

    http://www.powershellneedfulthings.com/?p=36

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • For free space monitoring and alert lepide's & redgate having excellent tool

    in case you can check them

    http://www.sqlservermanagement.net/

    http://www.red-gate.com/products/dba/sql-monitor/

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply