Windows Tip Sheet
Fill ‘Er Up!
Create filler files that can be deleted when disk space seems low.
- By Jeffery Hicks
As a consultant I’ve seen my share of servers that are practically running on empty. That is, no more free disk space. Without adequate free space, you can’t defrag drives (which they often need) and if it is a file server, your users will start screaming that they can’t save their MP3 files! When this happens we usually start digging through the drive looking for files and folders that can be deleted -- which is time consuming and not a lot of fun when the boss is breathing down your neck. Fortunately, there is a better way.
Using CREATFIL.EXE from the Windows Resource Kit you can create dummy "filler" files of any size. If you create enough of these files, when the server starts complaining about low disk space, simply delete as many of the filler files as necessary to get you back in business. This technique is only intended to provide some breathing room until you can deal with the root cause of your low disk space issue.
To start, create a folder called FILLER. Open a command prompt. Assuming CREATFIL.EXE is in your path, run:
Creatfil \filler\file1.dat 1048576
It will take a few minutes, but this will create a 1GB file (the specified file size is in KB). It doesn’t matter what file name or extension you use. Repeat as needed with a new file name until you have enough filler files. I recommend blocking out 10 to 15 percent of the total disk. In the event of a disk space emergency, you can get back in business in no time simply by deleting as many filler files as necessary. By the way, my recommendation for clients is to maintain at least 15 to 20 percent free disk space.
Finally, if you want to automate the process, use the FOR command. Here’s how you can create 10 1GB files:
FOR /L %i in (1,1,10) do @ Creatfil \filler\file%i.dat 1048576
With a little planning, you can avoid the pain of running out of disk space and look like the hero when the server starts running on empty.
[Editor's note: This column has been updated with a correction.]
Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.