Volume info for all LUNS

Volume info for all LUNS that have database files on the current instance

Last updated:

Warning: Review and test in a non-production environment before running.

Back to results

-- Source: "SQL Server Diagnostic Information Queries" by Glenn Berry (altered) – https://glennsqlperformance.com/resources/
-- Copyright (C) Glenn Berry. All rights reserved.
-- You may alter this code for your own *non-commercial* purposes. You may republish altered code as long as you include this copyright and give due credit.
-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.

SELECT DISTINCT vs.volume_mount_point, vs.file_system_type, vs.logical_volume_name, 
CONVERT(DECIMAL(18,2), vs.total_bytes/1073741824.0) AS [Total Size (GB)],
CONVERT(DECIMAL(18,2), vs.available_bytes/1073741824.0) AS [Available Size (GB)],  
CONVERT(DECIMAL(18,2), vs.available_bytes * 1. / vs.total_bytes * 100.) AS [Space Free %],
vs.supports_compression, vs.is_compressed, 
vs.supports_sparse_files, vs.supports_alternate_streams
FROM sys.master_files AS f WITH (NOLOCK)
CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.[file_id]) AS vs 
ORDER BY vs.volume_mount_point OPTION (RECOMPILE);

 

-- Being low on free space can negatively affect performance