I'm trying to check a content database's size. I want to use Powershell, but the method I've found examples of online is giving me a result that is inconsistent with other ways of looking at the database.

If I do

$db = Get-SPContentDatabase | ? { $_.Name -eq $myDbName }
$dbSize = [Math]::Round(($db.DiskSizeRequired/1GB),2)
Write-Host $dbSize

I get 71.22 GB.

If I go to SQL Server Management Studio and look at the database properties through that, it tells me that the database is 83664.00 MB. But 83664 / 1024 = 81.703125 (or 83664 / 1000 = 83.664), which is not the same either way.

But then, if I go to the filesystem and find the database file, it tells me it's..... 16 GB.

Why the discrepancies?

1 Answer 1


Do you have blob storage configured by any chance? It might explain why your MDF file is smaller on disk.

db.DiskSizeRequired shows how large is database in terms of consumed spaced. This should include your total content size + log file size minus unused space.

Database size in SSMS shows how much space your content and logs take, plus reserved space that's not yet consumed.

If your SQL database's auto-growth setting is set to 10GB, then the database size will increase by 10GB, and at one point DiskSizeRequired might be significantly lower than what SSMS shows.

I can't explain a small MDF file size, but some guesses:

  • blog storage
  • wrong database file, maybe?
  • Unlikely, but maybe there are file partitions created and it means some tables are stored in a different location.
  • 1
    Actually, it was the log. The log file was on a completely different drive. Filesystem content file size + log file size does equal SSMS reported size. I'm guessing the 10 GB difference between SSMS vs. DiskSizeRequired does have to do with unused/reserved space. Commented Oct 18, 2021 at 16:13
  • Ah of course! That's so obvious now that I think about it. Logs are typically stored on a different drive. Commented Oct 18, 2021 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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