3

I am a newbie in administering systems (as I am a developer), but lately, I am doing basic admin tasks on windows servers. We have an automated process that restores a database that failed with the message:

There is insufficient free space on disk volume 'c:\' to create the database. The database requires 2218459136 additional free bytes, while only 1219432448 bytes are available.

When I looked at C: drive -> properties, it says the free space is 3GB. Why this discrepency? (As per the message, the database needs 2.1 GB)

I guess I have to free up some space. I checked for any files that can be deleted and didnt find any. As a temporary solution, should I do a defrag on the system (Would that screw up anything)?

Also, is there a way to find out which folders are taking most of the disk space?

Thanks

EDIT: Also, I read about Disk cleanup utility. Is that risky?

3
  • 1
    you may find useful ideas here serverfault.com/questions/8894/… Nov 20, 2009 at 16:28
  • Does the database engine in use want 2.1 GB of contiguous space?
    – Mike Chess
    Nov 20, 2009 at 17:12
  • 1
    Since this isn't your primary job function, you probably shouldn't be unnecessarily spending time trying to free up space unless you're doing it as a stopgap measure while you're waiting for FedEx to deliver the newer (bigger) disk. Disks are cheap. Developer time isn't. :)
    – rob
    Nov 20, 2009 at 17:28

10 Answers 10

7

Not to throw more software suggestions around, but I use windirstat (http://windirstat.info/) to find files that are taking up too much space.

2
  • Ok, we found that the database log file was taking too much space. We shrunk it and now have a lot of space!
    – user25164
    Nov 20, 2009 at 21:32
  • If the database is in "fully logged" recovery mode - remember, you have to schedule transaction log backups, else your transaction log will grow constantly (until there's no disk space left). Nov 23, 2009 at 9:59
3

If your system drive is down to 3gb then you have much more serious problems than trying to restore a database.

Also, is there a way to find out which folders are taking most of the disk space?

TreeSize Free is your handy little helper here.

TreeSize Free screenshot
(source: jam-software.com)

2

Defragging won't screw anything up, but probably won't help the disk space either. Clear out the temporary directory, but also dig around the file structure for "temporary" data and downloads and service-packs and - if you're seriously short on space and willing to befall irony in the future - system restore points.

(Back things up before you do any of this. If you're thinking of deleting something you don't recognise, rename it first and see if anything notices that it's gone)

However, if you're at 3GB remaining and your DB needs 2GB, now's a wonderful time to consider investing in some more hard-drive space.

3
  • 1
    Upgrading ftw. Spend an hour on clearing out disk space and you've just spent the same amount of money as buying another hard drive.
    – womble
    Nov 20, 2009 at 16:19
  • I don't know about the original poster, but in my experience it is often more like: Spend an hour clearing out the disk or a whole day with paperwork to order a disk which will be shipped 6 months later if you are lucky. Nov 20, 2009 at 18:51
  • 1
    @Ludwig - Sounds like you need to explore some new employment opportunities.
    – MDMarra
    Nov 23, 2009 at 2:03
1

A defrag will not harm your system or free up disk space.

1

Usually when problems get to the point of "cleaning up a harddrive" it means one of two things:

  1. Occasionally someone put something REALLY big on the drive; and shouldn't have.
  2. The drives are just too small.

I suggest you use the Windows FIND utility to find files > 200mb. If you don't find a stash of DVD iso's, budget two new larger drives.

0

I prefer TreePie - a nice little utility that shows you where all the big folders are.

0

Some of the space may be reserved for System Restore, which is why you see a difference between the amount of space physically available and the amount allowed for installing your database. You could try to decrease the amount of reserved space, but if you're already running that low on space, you're better off adding disk space or deleting things you don't need.

Since you mentioned you are administering Windows Servers and it's not your primary job function, you should buy a new disk rather than spending unnecessary time on non-development tasks.

In the meantime, while you're waiting for the new disk to arrive, your best shot at freeing up disk space is uninstalling any unnecessary applications or services. The rest of your disk space is probably used for storing data stores for various services (such as e-mail), or other users' data.

Defragmenting your hard disk will not be effective with so little space, and it won't free up any space, anyway. The built-in Windows defrag utility recommends having at least 15% of your hard drive free. Other defrag utilities can work with less free space, but they still won't solve your low disk space problem.

Try emptying your browser caches and shrinking the browser cache size. With broadband, it's not as important to cache web pages any more. In some browsers, it's set as a percentage of your hard drive--the bigger your hard drive, the more space you're wasting on browser cache. You can type in a fixed amount (say, 50 or 100 MB) and it will adjust the percentage to match.

Empty out your temp folders. CCleaner can help with this (and also with clearing the browser caches, but it won't let you adjust the browser cache size).

Finally, use WinDirStat to find any large files or directories which you can remove from the hard drive. If users' directories are on the server, you should double-check whether any large files are needed before deleting other people's stuff. If necessary, you can set up filesystem quotas.

0

A likely cause is uninstall files for Windows Update. Have a look here for further discussion and "how to" stuff.

I've also seen a case where out-of-control and unmonitored Backup Exec logging chewed up some 19GB (!!!) of space on a C drive.

Also, if your swap file is on the C drive, now might be a good time to consider moving it to another partition.

Regarding the size discrepancy, I'm guessing that the restore job temporarily stages files somewhere, so you might potentially need free space that's approx double the size of what you're trying to restore. Depending on the technology you're using, the location of this staging folder might be configurable.

0

if your system is vista / 2008 / 7 you can run COMPCLN to remove uninstall files for microsoft's patches.

COMPCLN.exe is part of windows - you dont need to install anything.

0

This sounds like the SQL Server error message one get's when trying to do a restore with insufficient disk space.

Why this discrepency? Can you paste the code or describe what your automated process does? What i suspect is happening is that even though you have 3GB of disk space free & the database only requires 2GB, your script is copying the SQL Server .BAK file locally,& then attempting the restore, before deleting the .BAK file & moving your free disk space back up to 3GB.

Should I do a defrag on the system (Would that screw up anything)? As others have explained, defragging isn't going to do anything for making more disk space available, but only re-arrange the ways files are allocated on disk to give you better sequential read performance.

I'm not going to lecture you on why its a bad idea to put your database on the c drive, but assume you understand the risks. Assuming you've exhausted all you can do in saving disk space at a server level, here are some SQL Server things you can do to fix your situation. Also understand that some options come with their own risks that you should also investigate/consider before using them:

  • Restore from a UNC path over the network. You will need to run SQL Server under a user account to get this to work, but it will save you having to copy the .bak file locally.
  • If your using SQL Server 2008, then enable backup compression, so that your backup will take up less room.
  • If your using SQL Server 2008 then turn on page/row compression in the source database to save on disk space, which will reduce the space required for the database
  • As a last resort, shrink your source database before you take a backup so that it consumes less space on disk. This will have serious performance implications!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .