Today while trying to export a large sub-site using Export-SPWeb command through powershell, we got error “There is not enough space on the disk”. The command that we tried is as under:
Export-SPWeb -Identity "$siteurl" -Path "$exportfilepath" -IncludeUserSecurity -IncludeVersions all
Now the drive in which we were to export the contents had more then 250 GB of free space, and our content to export was around 170 GB. So the message didn’t seem to make valid sense. Then after some research we came to know that the export command, exports all contents to the windows TEMP folder (specified by %TEMP% environment variable) which normally is located in C drive, and then after completion of export command, transfers the result to our specified export file location. Our C drive had only 50 GB of free space, and so the message make sense now as 50 GB was not enough to store 170 GB of data.
So the solution, we changed our %TEMP% environment variable to point to an empty folder on the drive with size more then our export file size.
Environment variables on windows 7 can be reached at: my computer > advance system settings > Advanced tab > environment variables button.
To check your current %TEMP% folder location, type “ECHO %TEMP%” using command prompt.
Thus, while exporting sites in SharePoint, always make sure that the drive where the %temp% (environment variable) folder is located, has space more then your export file size (this can be known through the content database size), and if needed change %temp% environment variables location to drive with enough free space available.