How to Perfectly Defragment Your Hard Disks with MyDefrag

Mydefrag Your Way Featured

The primary parts in hard disk drives are their rotating platters and the heads that read and write data on them. The outer part of those disc-shaped platters, thanks to what Physics teaches us, have faster linear acceleration. Also, there’s a perceived performance cost when data is spread all over their surface.

MyDefrag might be semi-extinct, but it remains the only program of its kind that can optimize your hard disk precisely the way you want it. Like all defragmenters, it reorganizes all parts of your files, packing them together, fixing the low performance when spread all over the surface issue. It also allows you to set up zones, placing your most important files to the faster, outer region of the HDD’s surface. You just have to tell it what goes where through a simple script.

Locate, download and install MyDefrag

Unfortunately, MyDefrag is unsupported nowadays, and its official site is dead. You can still find it, though, at popular software hosting sites, like FileHippo and MajorGeeks.

Mydefrag Your Way Installation

Download and install the last ever version of the program, MyDefrag 4.3.1. Accept all defaults during the installation and make sure “Select and activate the MyDefrag ScreenSaver” is deselected.

Create a new script

You don’t control how MyDefrag operates through a graphical interface or command-line options – it’s done with simple scripts. Locate the sub-folder scripts, that exists for this purpose in its installation directory.

Mydefrag Your Way New Script

Right-click in this directory and create a new, blank TXT file. Give it any name you please, but change its extension to “MyD,” the default for MyDefrag scripts. Then, open it in your favorite text editor.

Script intro

We’ll use the existing ones as the base for a script that optimizes a hard disk filled with games, putting the files that affect their performance more than others at the quicker parts of the disk’s surface, moving the less essential and not-frequently-accessed data to the other end.

Mydefrag Your Way Script Intro

The first part of your script should set things up as follows. Note that you should place every parameter and command on a new, individual line. Also note that we will use comments in the code – they start with “//” – to explain the more cryptic bits of our script.

Set up your first zone

By splitting the HDD surface into zones, MyDefrag allows you to place specific files and folders on the parts of its surface that perform better or worse.

Mydefrag Your Way Zones

Set up zones by selecting what should go in them:

Setting up more zones

MyDefrag can only pack together your files, like other defragmenters, if you don’t set up any Zones, but you’ll be missing out on the whole point of its use.

Mydefrag Your Way More Zones

We set up more zones as follows:

Final script

What follows here is the whole final script. Feel free to copy and paste it into your own script, then tweak it as you wish.

Create a low-priority file list

Remember how we told our script to take into account a low priority files list, in TXT format, before organizing our files? Now’s the time to create that file.

Mydefrag Your Way Low Priority List

Right-click in the scripts folder and create a new, blank TXT file. Name it “file_list.txt” – the same filename we used in the script itself.

Here’s a sample list you can copy and use. Change the directories and files to ones you don’t care about.

Run your script

With the two files that define your defragmentation logic ready, it’s time to put them to the task! Run MyDefrag and, if there’s no typo anywhere, your script should show up among the default scripts in the program’s list.

Mydefrag Your Way Run Mydefrag

Select it from the “Select a script” list. Then, as MyDefrag states, “Select 1 or more disks” from the second list you’d like to defragment based on your script’s rules. Click “Run” and give it some hours (or days, for Terabyte-large HDDs) to work its magic.

That’s it. You have defragmented and optimized your hard disk the way you want it, and it should be working better and faster now.


Odysseas Kourafalos Odysseas Kourafalos

OK's real life started at around 10, when he got his first computer - a Commodore 128. Since then, he's been melting keycaps by typing 24/7, trying to spread The Word Of Tech to anyone interested enough to listen. Or, rather, read.


  1. There are a lot of good defragment programs.
    Why you recommend to use this pre-historic one?
    I suggest the free Smart Defrag

    1. Re-read the intro. “I’m recommending a pre-historic one” (in this particular case) because it was, is and, thanks to its “lost” source code,. will probably remain THE ONLY ONE that DOESN’T re-arrange the contents of your HDD “automatically” or “based on usage patterns” or any “optimization profile” made by its creators, but exactly the-way-YOU-want. That was the whole point of this article: not “use a defragmenter” but “re-arrange the files and folders of your HDD the way YOU want them, so as to have the ones you deem more important closer to the faster areas of the disk, moving the rest to the slower areas”.

      Note: caps for emphasis, not “shouting”.

  2. Not sure about this, but I thought I read that defragging an HDD for Win 10 was no longer necessary and in fact, the wear and tear on the HDD in moving the data was actually a detriment?

    1. Yes and no. The answer’s complicated. The simple and short version is “nope, Windows doesn’t do what we talk about here” – and that ISN’T “defragmenting your hard-drive” but more like “restructuring how the files are placed on its surface to get the most out of the HDD”. It IS “defragmenting”, but it doesn’t rely on automatic algorithms, or place the files on the HDD platters based on how many times you accessed them, their name or their size, but based on YOUR priorities.

      Here’s an even shorter example of why that’s useful: let’s say you have only a “mechanical” HDD in your PC, no SSD, and you want to play a demanding game with minimal loading (where its world “is streamed as you play”, like The Witcher 3, Grand Theft Auto V and so on). You can create a script in MyDefrag that tells it “to move all of this games’ files to the fastest zone on the HDD”, giving it the utmost priority over everything else, whereas Windows and any other defragmenter would just place it among the other games OR place its most recently accessed files… “somewhere”. This “somewhere” changes from defragmenter to defragmenter. Some place those files at the fastest parts of the disk, with the mindset “if the user’s accessing them, he needs them as quickly as possible”, others at a different part, since “they constantly change – and, inadvertedly, change spots on the surface of the HDD, so there’s no point in optimizing them only to have to do it again tomorrow”.

      Defragmentation is useless in the case of SSDs, since they don’t have slower and faster “zones”. Being the equivalent of long-storage RAM, all their contents are instantly accessible, at least as quickly as their controller and PC’s hardware can access them. And since many laptops today come with an SSD as their sole drive, there’s no point in defragmenting them. And yes, defragmentation in SSDs does lead to unnecessary wear and tear.

      Windows 10 *do* defrag “mechanical HDDs” though, “in the background”, when the user isn’t actively using the computer. But since our HDDs have grown enormous, they don’t try to defragment (as in “fully re-arrange all their contents”) anymore. Only to “consolidate the free space” (for quicker write access and less fragmentation of newly written files) and prioritize the most important of files (like, say, if you’re only using an HDD, files Windows uses while booting). Even if a defragmentation procedure starts running in the background, it probably won’t be able to fully defragment an over-1TB-drive in less than two or three days!

      That’s another way MyDefrag is useful: after a full defragmetation with it, the files and folders will mostly remain “as re-arranged by it” for a longer time, since Windows will try to minimize how much it uses the disk and only do minimal defraging.

      At least… as far as I know :-)

  3. Thanks for this, but there is another program that allows you to pick & choose files to be put into performance zones on your HDD. It is also more recent & user friendly.

    It’s called UltimateDefrag 6(current version), & while it does have a price tag, I find it more than worth it for the number of features it has & how simple it is to set up.

    Check it out!

  4. You mention placing files at the fastest part of the disk, but which part is that? I just finished work on a 19-zone MyDefrag script, with each game into its own zone, as well as a zone for the OS, one for my web-browser its appdata files, and others for user documents, downloads, etc. I put the OS and browser files at the start of the script, and programs with many small or medium-sized files int he middle, with programs at the very back of the script that use many very large files. How do I know if I am placing a particular set of files in the ideal place?

Comments are closed.