This may have been asked but...

I'm trying to profile the impact of file fragmentation on one of our business applications. What's the easiest and cleanest way to cause a 20GB file to fragment into roughly (say) 35,000 pieces?

Ideally the distribution would be random throughout the disk and/or be directly reproducible as much as possible but those are secondary concerns. It wouldn't have to be the exact number of fragments either, but within a range of 2-3k fragments.

Naturally I wouldn't be working with live data, but I'd like to avoid anything which could cause wider file system problems (this would be on a production server during off-hours).

If there's no elegant way of doing this, I'm happy to explore the alternatives - e.g. creating thousands of files in multiple simultaneous processes, using perl or a c# console program.

Platform is Windows Server 2003. Not sure of the configuration of the physical disks but the disk space is split between
- 12GB OS partition
- 35GB page file partition
- 500GB "data" partition. (this has the file[s] I'm interested in)

  • 2
    You'll definitely want to image that partition once you have that thing fragmented if you want to consistently test it later... Sep 16, 2009 at 16:53
  • Bart - Many imaging programs will place all data contiguously at the beginning of the drive. Ghost and Acronis do this for example. I'm not sure if there are options to preserve the location of files relative to their position on the platters but i doubt it as these utilities are designed to be able to restore to drives in different configurations than the original.
    – MDMarra
    Sep 16, 2009 at 17:09
  • 3
    @Mark, Just use unix dd, block level Sep 16, 2009 at 17:15
  • @MarkM-yes, many do rearrange for you but DD (as prestomation said) and I believe partimage won't. Use something like Rescue Is Possible to boot up and image the drive and it should be fine. Gzipping the DD'd image will help cut down on size of the imaged partition. Sep 16, 2009 at 17:38

2 Answers 2


You can download Defraggler to selectively Defragment the files and you can use MyFragmenter as described here to create new fragmented files.

As for fragmenting existing files, my best suggestion is to move the file off, generate tons of fragmented files with MyFragmenter and then copy the file back onto the drive. Due to the empty space being all fragmented, you'll get a fragmented copy.

  • MyFragmenter can fragment existing files. Sep 16, 2009 at 18:03
  • 1
    I was going to suggest the following, but MyFragmenter may be better. Write a program that opens two files for writing. The first file is the fragmented file you want to keep. The second file contains the space between the fragments. Interleave writes to the files such that you acheive the segment size you desire. Delete the 2nd file. The total size of the two files should be no more than available disk space, yet should nearly fill the disk.
    – Les
    Sep 16, 2009 at 18:05

i suggest to look at Mark Russinovsich's Tool at http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx This will show the fragments of your file with the option -a.

Love and Peace Ice

You must log in to answer this question.

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