MOSS 2007 and SharePoint 2010 keep a record of the total storage consumed by each Site collection; this is presented in Central Administration within the Site Collection Quotas and Locks page and also the Storage Space Allocation page within each Site collection in MOSS 2007. This figure is used by SharePoint to determine if a Site collection is exceeding its configured storage quota.

Both the "Space Used" value on the "Storage Space Allocation site (_layouts/storman.aspx), and the "Current storage used" value under "Site

Collection Quotas and Locks" in Central Administration get their value directly from the "DiskUsed" value in the Sites table. The value of the "DiskUsed" column is size in bytes.

Moss 2007:

clip_image002

 

Moss 2010 :

clip_image004

Occasionally this figure can be incorrect and may not accurately reflect the total amount of storage that is actually being consumed by the Site collection. If you ever encounter this scenario you can tell SharePoint to recalculate this figure by using the Windows PowerShell commands below, these use the RecalculateStorageUsed method as described in -

 http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.recalculatestorageused.aspx.

Simply replace the highlighted URL with that of the Site collection that you want to recalculate and then either run the commands manually or save as a .ps1 file and execute as a script.

MOSS 2007

[void][system.reflection.assembly]::loadwithpartialname("Microsoft.SharePoint")

$URL = "http://Moss2007"

$Site = New-Object Microsoft.SharePoint.SPSite($URL)

$Site.RecalculateStorageUsed()

SharePoint 2010

$URL = "http://Sp2010"

$Site = Get-SPSite -identity $URL

$Site.RecalculateStorageUsed()

 

Disclaimer

=========

By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, one of its affiliates) and you. Any materials (other than sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code form of the sample code, provided that you agree:  to not use Microsoft's name, logo, or trademarks to market your software product in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a reasonable limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of the sample.

 

Thanks to  Brendan Griffin  for his valuable inputs for the post

 

POST  BY :Rajan Kapoor [MSFT]