6

I am working on a SP2010 farm. I need to backup a site collection. By using PowerShell

$site = Get-SPSite "http://sharepoint"
$site.usage.Storage

The size is about 38GB. However when I try to backup it with:

Backup-SPSite -Identity "http://sharepoint" -path "c:\backup" -usesqlsnapshot

The backup size grow to larger than 80GB. Because I don't have sufficient space in C drive so I have to stop it.

Why?

I have another site collection with URL http://sharepoint/new/. Will it be included in the backup even it is another site collection?

2
  • Does $site.usage.DiscussionStorage some value (more than 0)? How do you translate the returned bits to GBs - have you tried $site.usage.storage / 1Gb?
    – moe
    Oct 27, 2016 at 9:31
  • @moe yes, I do as you mentioned.
    – Mark L
    Oct 27, 2016 at 13:13

2 Answers 2

6

The use of

$site = Get-SPSite "http://sharepoint"
$site.usage.Storage

only includes SPSite.UsageInfo's Storage. The UsageInfo-class also includes DiscussionStorage-field which might differ from 0, i.e. its size is also added to the backup.

What's even more likely is that the size of the backup grows because of Audit logs. Audit logs increase the site collection's (=backup's) size but are not on shown in these records. Audit logs can be managed at http://sharepoint/_layouts/15/AuditSettings.aspx and viewed at http://sharepoint/_layouts/15/Reporting.aspx?Category=Auditing.

There might be other exluded content that's not shown with SPSite.UsageInfo.Storage-field. As already seen by the Audit log example, the definition of

The data of the Storage field is used to enforce storage quotas.

indeed doesn't cover everything. One way to explain what this storage covers is to have a look at your site collection with SharePoint Designer. Quite likely the Total Storage Used value is pretty close to the value you get with PowerShell.


To cover the further questions: if you wish to decrease the size of Audit log data, I'd recommend to trim the data. Instead of deactivating the audit logging (which, afterall, was activated for a reason and one day can save you from a trouble or two) you could trim the log files to let's say until yesterday.

Here's a PowerShell-script which does the job:

$site = Get-SPSite -Identity http://sharepoint
#To Get Yesterday
$date = Get-Date
$date = $date.AddDays(-1)
#Delete Audit logs
$site.Audit.DeleteEntries($date)

Credits to Salaudeen Rajack.

Monitor the content DB's size before and after the trimming.

To avoid the continuous growing of Audit log, make sure you have a reasonable number of days at your site collection's Audit logging settings at specify the number of days of audit log data to retain. This could be e.g. 30, 60 or 90 days. Also to have some room for the growth of your site collection, you should consider adding more disc space available as it seems you have space for more than 38 GB (which is needed currently) but less than 80 GB.

5
  • I don't see the "total storage used" in spd 2010. Is it only available new SPD2013?
    – Mark L
    Oct 27, 2016 at 10:11
  • It should also be visible on SPD2010 while browsing on the Home-view, in the Site Information -section. Anyway what I was after was only to give a way to understand what the storage covers - that is it covers the files/items that can be seen by SPD. Whether that's 100% true or not is harder to explain with the current documentation of SP.
    – moe
    Oct 27, 2016 at 10:15
  • In audit log settings I found "Automatically trim the audit log for this site? " have selected Yes already. Can I check and remove the audit log? Also I checked the content DB at SQL is about 150GB, while SPD2010 shows 39GB only.
    – Mark L
    Oct 28, 2016 at 6:02
  • @MarkL Have a look at my updated answer.
    – moe
    Oct 28, 2016 at 7:55
  • I followed the blog and checked that the audit data is less than 1 MB. At this moment I think my DB is corrupted.
    – Mark L
    Oct 31, 2016 at 3:07
2

Refer this blog to view storage from different tools , this might help to get the correct size. http://en.share-gate.com/blog/list-sharepoint-sites-with-size

3
  • Why using PowerShell will get incorrect size?
    – Mark L
    Oct 27, 2016 at 9:29
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Oct 27, 2016 at 11:01
  • @PaulStrupeikis - The link have different options to answer the question. Picking relevant section is not possible hence provided 1-line description along with reference link. Oct 27, 2016 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.