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, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

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