SharePoint storage gives us a very useful report to understand the size of a site, sub site, list and library. To view the Storage Metrics report you have to follow simple steps

Go to Site Collection Settings –> Site Collection Administration –> Storage Metrics

SharePoint Online Storage Metrics

You can drill down the document library or sub site to view further detail, this can show you the size of any particular document including the size of its versions. Storage matrix is available in both SharePoint Online and SharePoint On-Premise versions.

Why Storage Matrix value not changing

We can see the size of a document and we can also check its versions sizes by checking the version history but how to check the actual size of a document library. Recently I faced similar issue where the response of a specific document library got really slow, customer reported one specific document which getting too slow, the size of document was around 33 MB, then I checked the versioning detail which was terrible, they have over 13 major versions and each major version having 300 to 400 minor versions. It was a SharePoint 2010 document library and Storage Matrix shown over 26 GB size for a single document, check the below screen.

SharePoint 2010 Storage Metrics

So, we suggested to delete older major and minor versions to reset the document size. We deleted the document first major versions and all the minor versions under them. When we rechecked the Storage Matrics value, it still showing the same result, but document library performance was not bit better.

When user adds/deletes document to a versioned library SharePoint is updating TotalSize field in Storage Metrics table to add/deduct the document size from the existing value.

It appears that the usage of web folders to add/delete files is only adding size value to TotalSize field in Storage Metrics and not deducting size value for delete. I also have queried the specific document in SQL Server database to verify the size, but database also showing the same result

SQL Server Storage Metrics

((28216479333/1024)/1024) = 26909.33 MB

Solution: Reset or recalculate the Storage Metrics output

If you are getting this issue on SharePoint 2013 or SharePoint 2016 farm, you need to run the following PowerShell command to recalculate metrics.

$web = get-spsite https://MSTechtalk.com/

$web.RecalculateStorageMetrics();

If you are using SharePoint 2010 then use the below PowerShell cmdlet to recalculate Storage Matrix

$web.RecalculateStorageUsed();

* SP1 is required for SharePoint 2013 to run above cmdlet.

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply

One reply on “SharePoint Storage Metrics to Check size of a document Library”

  • March 2, 2018 at 2:02 pm

    Hi Adnan,

    how about the wrong data in storage metrics? I just ran the codes for a SharePoint 2013 foundation site and i get wrong sizes from folders, only the files get the right size. This farm is up to date by the way.

    Thanks