How to get SQL associated mount point drive details using query
Using below SQL query we can get drive details (only we can get drives which are associated to SQL server )copy the below query to the new query window and hit F5
SELECT DISTINCT dovs.logical_volume_name AS LogicalName,
dovs.volume_mount_point AS Drive,
CAST(total_bytes / 1048576 as decimal(12,2)) [TotalMB],
CAST((CAST(available_bytes / 1048576 as decimal(12,2)) ) - (CAST(total_bytes / 1048576 as decimal(12,2))) as decimal(12,2)) [Used Space MB],
CAST(available_bytes / 1048576 as decimal(12,2)) [FreeSpaceMB],
ISNULL(ROUND(available_bytes / CAST(NULLIF(total_bytes, 0) AS FLOAT) * 100, 2), 0) as percent_available
FROM sys.master_files mf
CROSS APPLY sys.dm_os_volume_stats(mf.database_id, mf.FILE_ID) dovs
ORDER BY FreeSpaceMB ASC
GO
we can get mounted volume details using above query.
Post a Comment