Still Life

A Series of Mental Snapshots

Archive for the ‘Tools’ Category

Creating specific files in windows with fsutil

Posted by Steve on July 10, 2008

This post comes from a recent issue I had recently, that was actually solved very easily with a built in windows tool. While running a test scenario, I needed to fill up a 20 GB disk. I have had to do with before, and it is pretty simple to do, you just grab some large files a copy them over and over again. I will never be doing that again thanks to a fancy little tool, fsutil.

fsutil is a built in windows program that has a whole bevy of options. You can open up a command line window and type fsutil to get the following options:

—- Commands Supported —-
behavior Control file system behavior
dirty Manage volume dirty bit
file File specific commands
fsinfo File system information
hardlink Hardlink management
objectid Object ID management
quota Quota management
reparsepoint Reparse point management
sparse Sparse file control
usn USN management
volume Volume management

From here you can get more details about any of the above features by entering fsutil “Feature Name”. So to create the large file we want to see the file options but entering fsutil file. Typing this in the command window gives the following output:

—- FILE Commands Supported —-
findbysid Find a file by security identifier
queryallocranges Query the allocated ranges for a file
setshortname Set the short name for a file
setvaliddata Set the valid data length for a file
setzerodata Set the zero data for a file
createnew Creates a new file of a specified size

So to create the large file, you need to use the createnew. So you can type in fsutil file createnew to see the usage as well as an example!

Usage : fsutil file createnew <filename> <length>
Eg : fsutil file createnew C:\testfile.txt 1000

It is important to note that the length, actually is the length in bytes, so a value of 1000, will be 1KB. There we are, any file of any size can be created. I foresee using this many times in the future, I also see exploring the fsutil feature much more, as it seems like a useful tool.

–Steve

Was this post useful? Could I improve on the layout of how I present these quick little tutorials? If so leave me a line, and let me know, I would love some feedback!

Advertisements

Posted in Testing, Tools | Tagged: , , , , , , , , , | 4 Comments »