SharePoint on MGDC FAQ: What is the size of my sites?

IMPORTANT NOTE: This blog post is no longer current. Please visit the latest version of this blog in the official Microsoft Graph Data Connect for SharePoint blog in the Tech Community web site.


1. Introduction

How much storage is being used by your SharePoint sites? Sounds like a simple question, but there are lots of details behind it. Do you mean the total size of the latest versions of the files, or do you include previous versions? Do you count the metadata size? How about deleted files in the recycle bin?

In this blog post, we’re going to dive into Storage Metrics for SharePoint (and OneDrive), using the SharePoint UX, the Admin Center, PowerShell, and the Microsoft Graph Data Connect for SharePoint. We’ll do this by creating a few different sites and watching how their storage sizes are reported in different tools.

Note: I touched on the multiple ways to look at Site information in a previous blog post. You might want to review it before moving forward here: Four Options for SharePoint Site Analytics.

2. Sizes to look for

There are different storage sizes reported for a SharePoint site, including:

  • Storage Used – Typically refers to all storage, including metadata, previous versions and the recycle bins. This is the number you see when using PowerShell cmdlets and the Admin Center reports, typically reported in megabytes.
  • Storage Metrics, Total Size – This number represents the total storage for a site, including metadata and previous versions, but does not include the recycle bins.
  • Storage Metrics, Metadata Size – This is the amount of storage used by the file metadata (information about the files, not the contents of the files). It’s typically negligible, unless you have a large number of small files.
  • Storage Metrics, Total File Stream Size – The size of the latest versions of files, also known as the “tip version” size.
  • Previous Versions Size – The size of the previous versions of the files. This can be a significant number if your files are constantly changing. You can calculate this by subtracting the metadata size and the total file stream size from the total size.
  • Recycle Bin Size – The size of deleted files in the recycle bins (SharePoint has two layers of recycle bin). This is included in the Storage Used but not in the Total Size.  You can calculate it as the Storage Used minus the Total Size.

Note: There is also a Storage Quota number, which represents the maximum storage allowed in the Site. The Administrator can adjust this. If Storage Used reaches Storage Quota, we say the site is “full”.

3. Places to look at

To get started, there are many ways to check the amount of storage being used by your SharePoint sites. For instance, you could use many different tools:

  • SharePoint client UX – This covers how you see storage while using SharePoint as a site user or a Site Collection administrator. If you know your way around the product and have the right permissions, you can see the latest version size (file stream size) and the previous version size.
  • PowerShell cmdlets – An administrator using this command-line tool can look at the Storage Used for each site, reported in megabytes (rounded).
  • SharePoint Admin Center reports – An administrator can also use the Usage reports in the Admin Center to see the total Storage Used overall and per site.
  • Microsoft Graph Data Connect – Using the MGDC, you can pull a complete list of all the SharePoint sites and OneDrives, including Storage Used, Total Size, Metadata Size and Total File Stream Size. You can use those to calculate the Previous Versions Size and the Recycle Bin Size.

4. Four test sites

To make things more concrete, I performed a simple experiment by creating 4 different sites, as follows:

  1. “Empty” Site. Created a site using a “Standard Team” SharePoint site template. This will work as a baseline, since it includes some basic lists and libraries.
  2. Site with Files. Created a site using the same template, then added 4 files with 10MB each which were never changed.
  3. Site with Deleted Files. Created a site using the same template, then added 4 files with 10MB each and deleted 1 of these 4 files.
  4. Site with Previous Versions. Created a site using the same template, then added 4 files with 10MB each and overwrote 1 of these 4 files.

These 4 sample test sites will give us some information about how the different sizes are reported with the different tools we mentioned.

5. Creating test sites

In case you want to run your own experiment, here is some detail on how to create the 4 sites proposed in your own environment. Creating the four sites is straightforward if your tenant has self-service site creation enabled. You go to the main page for SharePoint and use the option to “Create Site”.

Create site

When creating the site, use a SharePoint Team site and the Standard Team template. Make sure to give each site a name that you can easily find later. In my case, I named them Storage Test followed by a number, like StorageTest1. You don’t need to add any members.

After the four empty sites are available, you will need to create 4 files with 10MB each. The simplest way to do that is to open a cmd.exe command prompt with the “run as Administrator” option to run these commands:

  • cd %USERPROFILE%/Downloads
  • fsutil file createNew test1.bin 10000000
  • fsutil file setValidData test1.bin 10000000

You can repeat those commands with different file names to create all 4 files. You get bonus points if you can code a loop in the old cmd.exe command prompt or do it in PowerShell.  With the 4 files created in your Downloads folder, you can upload them as follows.

  • For site 1, no need to upload anything. This site will remain “empty”, just with what comes by default with the Standard Team template.
  • For site 2, just upload the 4 files to the existing “Documents” library.
Uploading files
  • For site 3, upload the 4 files, then delete one of them. This will be our “recycle bin” example.
  • For site 4, upload the 4 files, then reupload one of them. When prompted, confirm that you want to overwrite the file. This will be our “previous versions” example.

6. Check sizes in the SharePoint client UX

The simplest way to find about the sizes of the files is to use the SharePoint client and look at the “Document” library. The File Size column might be hidden by default, so you will need to add that column to your view by clicking on “Add column”, then “Show or hide columns”.

Sizes in SharePoint UX

Note that the file sizes are converted to powers of 2 (1KB is 1024 bytes, 1MB is 1024KB), so 10 million bytes shows up as 9.54MB (10,000,000/1,024/1,024, rounded up to two decimals).

You can also use the option to view the version storage by clicking on the three dots (…) next to the file name you overwrote and choosing the option for “Version History”.

Sizes in version history

You can also use the SharePoint UX to view items in the recycle bin. Users can only see the first level of the recycle bin. Administrators can see the second level of the recycle bin.

7. Check sizes with PowerShell cmdlets

Another way to look at the Storage for sites is using PowerShell. If you’re not familiar with how to query site SharePoint information using PowerShell, check section 2 of this blog post.

In our scenario, the Get-SPOSite cmdlet shows the following:

Sizes in PowerShell

Note that the two storage-related properties are StorageUsageCurrent and StorageQuota. The first one is what we described earlier as Storage Used. Storage Quota also shows, with the site storage limit of 1 terabyte.

StorageUsageCurrent is shown here in megabytes, using base 2 and rounded up. Note that the “empty” site shows 1 megabyte usage because of what’s included in the template. Sites 2 and 3 show the same size, since they both have 4 files. The recycle bin is included, so the deleted file in Site 3 does count. Site 4 is larger because of the previous version for the overwritten file.

8. Check sizes in the Admin Center report

You can see a list of sites and sizes in the Admin Center report. Note that this report will take a few days to show the information, so if you go immediately to the report, you won’t find your newly created sites. After you wait patiently, you will see the files will show in the Admin Center reports.

Sizes in Admin Center

You will find one row for each site, with a column in the report for the Storage Used. Notice that it shows a slightly different rounding, but the numbers are close. The first “empty” site shows 1MB, second and third show 40MB and the fourth site with the extra version shows 49MB.

Note that the number of files shows 2 for the first site and 6 for the other 3, which is 2 more than we expected. It turns out that the template brings in some default files, like the icon for the team site. The files also use a little bit of storage, which explains why the “empty” site is not completely empty.

9. Check sizes with the Microsoft Graph Data Connect

Finally, you can check sizes using the MGDC. This option brings lots of details for each site, including several the different storage sizes we discussed earlier. You need to wait 48 hours before the data will be available on the MGDC SharePoint datasets.

If you’re not familiar with how to grab a detailed dataset for your SharePoint sites using the MGDC, read this blog post for an overview and this blog post for a detailed step-by-step.

Here is an excerpt from the JSON results from the MGDC dataset for SharePoint Sites for site 4:

"Url": "https://sitename.sharepoint.com/sites/StorageTest4",
"RootWeb": {
    "Id": "e9f81c10-bb5a-4a43-ace8-4034b909e0f8",
    "Title": "StorageTest4",
    "WebTemplate": "GROUP",
    "WebTemplateId": 64,
    "LastItemModifiedDate": "2023-07-29T20:20:00.000Z"
},
"WebCount": 1,
"StorageQuota": 1099511627776,
"StorageUsed": 51535126,
"StorageMetrics": {
    "MetadataSize": 73579,
    "TotalFileCount": 6,
    "TotalFileStreamSize": 40016480,
    "TotalSize": 51492522
},

You can see that the StorageUsage data matches what we’ve seen before, but it shows the number in bytes (not in megabytes). Many storage-related numbers are present inside the “Storage Metrics” structure and the two missing ones can be estimated using simple formulas:

  • Previous Versions = Total Size – Metadata Size – Total File Stream Size
  • Recycle Bin Size = Storage Used – Total Size

Here is a summary of the storage-related metrics for the 4 sites we’re tracking:

SiteStorage
Used
Metadata
Size
Total
File Stream
Size
Total
Size
Previous
Versions
Estimate
Recycle
Bin

Estimate
No files
uploaded  
1,532,37771,66416,4671,489,7731,401,64242,604
4 files
uploaded

41,534,48373,16140,016,46741,491,8791,402,25142,604
4 files
uploaded,
1 deleted

41,535,64472,82830,016,47631,490,6271,401,32310,045,017
4 files
uploaded,
1 overwritten
51,535,12673,57940,016,48051,492,52211,402,46342,604

As you can see, the bulk of the storage is related to the 4 large files uploaded, including the deleted file in the recycle bin and the previous version. Calculations for both the recycle bin and previous versions show a small amount of storage even when the site is “empty”, but growth is consistent as we add files. The metadata size changes only a few hundred bytes with each additional file in our case (metadata such as the file name can vary in size).

10. Conclusion

I hope this post helped you understand the many different metrics for storage size available for each SharePoint site (or OneDrive). We were able to observe some of the details here by creating a few tightly controlled test sites, making sure these sites stayed unchanged as the data was processed by the Admin Center and the Microsoft Graph Data Connect for SharePoint. In the real world, sites are constantly changing and it’s a lot more difficult to pinpoint the specific impact of metadata, versions and deleted files.

I recommend using the more detailed data in Microsoft Graph Data Connect for SharePoint to run detailed analysis of your SharePoint and OneDrive storage metrics. For more information, refer to the overview post at https://aka.ms/SharePointData.

2 thoughts on “SharePoint on MGDC FAQ: What is the size of my sites?

Leave a comment