image provider

MFT Tidier


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

Introduction

This is a project for with an interest in going deep under the hood. You will have to write this in C probably with some assembler. You will write a utility to tidy the Windows MFT (Master File Table) Basically, each MFT slot keeps track of where the various where the pieces (extents) for one file are. One of the advantages of defragging your files is the there is only one extent per file and easily fits into a single MFT slot. It does not contain any file names, directory names or attributes. That information in contained in the directory.

The Paragon people discontinued their MFT tidier. There is no other.

Why does the MFT need Tidying?

How Does It Work

Ideally it would boot, tidy the MFT by sorting the entries by last-access or last-update time putting the newest at the end, compacting out the deadwood pruning the MFT to just enough to contain current contents, then defrag. Normally windows does not maintain the last-access dates. You can persuade it to with:

rem turn on last-access maintenance
fsutil behavior set disablelastaccess 0

For safety, write a complete new MFT, then at the last second flip the pointer(s) over to the new one.

It would allow processing multiple partitions on one reboot (Paragon could not).

If you can get exclusive access to the partition, you don’t need the reboot, but that would mean writing a second version of the utility.

I am not that familiar with the NTFS (New Technology File System) internals. It seems probably you would also have to patch the directory to the new slot numbers.

The thing that makes this project tricky in you are not running under Windows. You running is some very stripped down environment available to boot-time code. You might first write a version that does not require rebooting (for data partitions without open files), then tackle that complication later.

Native Mode

Before windows has booted, the Windows API (Application Programming Interface) is not available. You must use the native core API. Windows itself uses this core API. Your code to run before Windows has booted must be written as a native program.

BootExecute register your program to run on the next boot
fsutil
Native API
Native API for File I/O
NTFS
NTFS file structure
NTFS formats
NTFS formats: with diagrams
NTFS overview
Overview of Native Mode

This page is posted
on the web at:

http://mindprod.com/project/mfttidier.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\mfttidier.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.15.31.27]
You are visitor number