A while ago, I nearly filled my hard drive, much more than the recommended maximum of 85% of capacity. I believe that NTFS started storing files in the space reserved for the Master File Table (MFT) and the MFT had to fragment elsewhere as it grew.
I have cleared off space on the hard drive, but the MFT apparently remains fragmented, and there's a lot of slow disk access for even very simple operations like opening a folder or small file. This is killing performance. I remember that Windows standard disk defragmenter doesn't defragment the MFT because the MFT is in use when the operating system is running. I'm running Vista Ultimate and its defragment utility has very little in the way of reporting, less than older versions.

I suspect that a solution might involve booting up from an optical disc with a basic OS ("Live CD") and running a defragment utility from that. Can anybody tell me what program to use, or how to defragment my MFT?



6 Answers 6


You can use the Sysinternals tool Contig:

contig.exe c:\$mft
  • 3
    Didn't work for me. UltimateDefrag shows $MFT from a non-sytem partition is fragmented, but contig says "All files were either already defragmented or unable to be defragmented." Anyway I really don't know why theres is $MFT there. Jun 20, 2016 at 17:01
  • 4
    Note: I tried to do this in PowerShell on Windows 10 and all it kept doing was print the help. In the normal command shell it worked as expected. EDIT: I just found out why: The $ has special meaning in PS and needs escaping: contig.exe 'c:\$mft' works. Dec 15, 2019 at 17:25
  • 1
    Contig didn't work for me: Move cluster status: STATUS_INVALID_PARAMETER
    – rustyx
    Oct 5, 2021 at 12:39

Auslogics Disk Defrag Pro will accomplish this for you. Whilst not a free program, you can download a free trial, and if you do decide to purchase the license is available for use on up to three PCs.

Ultradefrag is a free and powerful FOSS defragmentation tool for the Windows Platform. It can defragment any system files including registry hives and paging file. It includes MFT optimization, which processes the MFT only.

  • 7
    +1 Ultradefrag did miracles to me with a stubborn $MFT that even Contig (that got so many upvotes here) couldn't defeat
    – BornToCode
    Apr 16, 2013 at 14:52
  • @BornToCode Any way to get Ultradefrag to not move files to the end of the partition when it optimizes the MFT? Jul 27, 2016 at 22:15
  • 1
    @RockPaperLizard - I don't know, but the alternative to not moving those few files to the end is to shift every other file on the disk. You might try running ordinary Windows Defrag or Diskeeper after Ultradefrag; bear in mind however, that ordering every file by how many times it's used will be a long-running operation that will fall apart the next time you launch a web browser.
    – KeithS
    Aug 24, 2016 at 16:23
  • Note that you'll now need to follow the download link to the "old versions," as the current version 8 is no longer FOSS.
    – trlkly
    Sep 1, 2019 at 20:16

Best tool by far was the old JKdefrag, now Mydefrag. Will defrag the MFT. Also, it's free.

The original site is down but one can source to get the latest version is here: https://www.techspot.com/downloads/3720-jkdefrag-mydefrag.html


Windows Defrag API, used by MyDefrag, supports defragging the MFT.

Following are the system file, stream, and stream types supported by FSCTL_MOVE_FILE in "filename:streamname:$typename" format.


And MyDefrag's script documentation:

Inode   Filename    Description
0   $MFT    Master File Table - An index of every file.
1   $MFTMirr    A backup copy of the first 4 records of the MFT.
2   $LogFile    Transactional logging file.
3   $Volume Serial number, creation time, dirty flag.
4   $AttrDef    Attribute definitions.
6   $Bitmap Contains volume's cluster map (in-use vs. free).
7   $Boot   Boot record of the volume.
8   $BadClus    Lists bad clusters on the volume.
9   $Quota  [Windows NT only] Quota information.
9   $Secure Security descriptors used by the volume.
10  $UpCase Table of uppercase characters used for collating.
11  $Extend A directory for: $ObjId, $Quota, $Reparse, $UsnJrnl.
$Extend\$ObjId  Unique Ids given to every file.
$Extend\$Quota  Quota information.
$Extend\$Reparse    Reparse point information.
$Extend\$UsnJrnl    USN Journal.
$Extend\$RmMetadata Transactional data.

While it won't run on a Live CD, it will run on Bart PE or the Ultimate Windows BootCD.

But neither is necessary to defrag the MFT.

  • Yep, this. I believe the defrag API was changed with Vista, so you don't even need to reboot.
    – Hydaral
    Jul 28, 2011 at 1:08
  • 1
    MyDefrag runs only on Windows; you can't run it from an open-source LiveCD. It claims to only remove files from the reserved MFT space, not to defragment the MFT if it's already fragmented. Is there another program [to be posted as a different answer] that can defragment the MFT?
    – WBT
    Aug 27, 2011 at 0:07
  • You are wrong. It's not explicit because the Defrag API supports defraging the MFT. Plus, you can check the MyDrag scripts.
    – surfasb
    Aug 28, 2011 at 15:23
  • the site is now: mydefrag.net Jul 25, 2016 at 9:03
  • jkdefrag and mydefrag are now dead - mydefragGUI can still be downloaded at mydefrag.net as the above comment shows but there has been no update since 2009 Nov 16, 2017 at 3:47

These steps worked for me:

  1. Run the MiniXP in Hiren's BootCD.
  2. Disable Hibernation, Virtual Memory and Kernel Memory Dump.
  3. Follow the instructions described in this link (use the fsutil).
  4. Run MyDefrag at MiniXP with the option "Consolidate free space".
  5. Start Windows again and now you can shrink you partition.

I know this is an old thread but old systems is what I do. I am releasing an open source project at https://github.com/DHorse2/TaylorDo and all are welcome to use this MyDefrag library or contribute to it.

The MFT movement and defragging are done on the system running normally. They are however a few $xxx and system files that if you move them the feature will fail. Restore points being the best example.

The point of the TaylorDo product is that it provides peak performance AFTER the system boot whereas other product tends to only optimize the boot.

Regards Dave H.


there is an option on ultimatedefrag that provides a boot time defrag , however it didn't work for me but i hope it works for you

ultimatedefrag > tools >settings... > boot time

select the drive that you want , it takes a while analyze the drive . when its done analyzing you can adjust the mft file location but i recommend to leave it how it is (if you changed it there is a button to rest it to default) . then toggle the Run during next boot option and just restart the pc

for me it stack at 24% every time and then boots up the windows without defraging the file but hope it works for you . share your expertise too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.