2/08/2008

SharePoint: Site Collection Quotas


To limit the storage of a site collection you can create and apply Quota Templates.

Some important things to know about quotas:
  • Quotas can only be applied to Site Collections, not to single sites or entire applications
  • Quota space includes library files, list contents (announcements, etc), master pages, etc (ie. Everything)
  • Files in the Recycle Bin are part of the quota calculation
  • The warning e-mail is only sent once!
  • Once the quota has been reached, no more uploads are permitted
  • Once the quota has been reached, many site edits are prohibited! For example adding an announcement or even modifying an existing view displays this: "Your changes could not be saved because this SharePoint Web site has exceeded the storage quota limit."
  • When a site is limited by a quota there is a new option in Site Actions -> Site Settings: "Storage space allocation". Here the site admin can see where quota is being used.
  • The last item uploaded that exceeded the quota will be uploaded successfully, even if it takes the site way over quota.

To create quotas:

Go to Central Administration and drill down to Application Management and Quota Templates. Create as many quota templates as needed.



When a user exceeds their quota
During a Multiple Upload they may see:


During a single Upload or other edit such as adding an announcement they will see:


To track quotas

Site administrators can go to Site Actions -> Site Settings and click "Storage space allocation" to review space usage. Here they can display lists of libraries, documents, lists and Recycle Bin contents. These lists are by default sorted on size, descending. They can be resorted on Date Modified or Size.


9 comments:

Larry W. Virden said...

Mike, I'm seeing a 12 hive log file entry for this sort of error repeatedly for the past few days. However, the sharepoint site does not have a quota template defined in central admin.

The 12hive error doesn't indicate which SharePoint site on this instance has exceeded the storage quota. There are many sharepoint sites on the instance, so it would be non-trivial to check the hundreds of sites to figure it out from the site settings option you mention. Also, we're using SharePoint / MOSS 2007 and I don't see the storage space allocation link on the site settings page. Do you have any additional things that could be tried?

Mike Smith said...

Larry,

You say you have many sites... only site collections have quotas, so you may not have too many to check.

To find site collections with quotas:

Do you have PowerShell on your server? If so try this to:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$uri = new-object uri("http://maxsp2007")

$app = [Microsoft.SharePoint.Administration.SPWebApplication]::LookUp($uri)

$sites | where {$_.quota.StorageMaximumLevel -gt 0} | % {$_.url}


Or here's a console app:


using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace AllSitesWithQuotas
{
class Program
{
static void Main(string[] args)
{
Uri appUri = new Uri("http://maxsp2007");

SPWebApplication app = SPWebApplication.Lookup(appUri);

foreach (SPSite site in app.Sites)
{
if (site.Quota.StorageMaximumLevel > 0)
Console.WriteLine(site.Url);
}
Console.ReadLine();
}
}
}


Mike

Mike Smith said...

In the PowerShell example above I left out one line, just after the $apps = line. It should be:

$sites = $apps.sites

Edgar Corona said...

I never get the warning mail. Who is suppose to get this mail?

Mike Smith said...

Edgar Corona,

The Site Collection Administrator setup in Central Administration for that site collection should get it. (The admin also must have checkmarked the "Send warning e-mail" option.)

Check with your SharePoint server administrators to see who is listed as the first (or second) site collection administrator.

Mike

Larry W. Virden said...

Mike, I apologize for the long delay. I just recently got PowerShell going on my server and am trying out your suggestion. In my case, the results of the code, with the adjusted line, is that nothing is displayed - no error, no sites, etc. I presume that would imply no quotas. Which is what Central Admin appears to indicate. And yet users still get this error...

Mike Smith said...

Larry,

Your farm may have multiple applications. Here's a shorter form of the PowerShell script that will search all SharePoint Applications and all Site Collections: (assuming you are logged in with proper permissions)

Get-SPWebApplication | Get-SPSite | Where {$_.Quota.StorageMaximumLevel -gt 0} | Select Url, {$_.Quota.StorageMaximumLevel}

Here's the same thing with a little nicer formatting of the output:

Get-SPWebApplication | Get-SPSite | Where {$_.Quota.StorageMaximumLevel -gt 0} | Select Url, @{Label="Quota (MB)"; Expression{$_.Quota.StorageMaximumLevel / 1MB}} | Format-Table -AutoSize

Mike

Mike Smith said...

Larry,

I just looked back at your original question and it looks like you have SP 2007. The script I just added above is for 2010.

Check back for a 2007 version...

Mike

Mike Smith said...

Larry,

Here's the 2007 version:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local

$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}

$websvcs | Select -ExpandProperty WebApplications | Select -ExpandProperty Sites | Where {$_.Quota.StorageMaximumLevel -gt 0} | Select Url, {$_.Quota.StorageMaximumLevel}


Here's an alternate last line with better formatting of the output:

$websvcs | Select -ExpandProperty WebApplications | Select -ExpandProperty Sites | Where {$_.Quota.StorageMaximumLevel -gt 0} | Select Url, @{Label="Quota (MB)"; Expression{$_.Quota.StorageMaximumLevel / 1MB}} | Format-Table -AutoSize

Mike

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.