Algorithms

iDefrag supports a number of different defragmentation algorithms, some of which are special purpose. This section describes the effects each algorithm will have on your disk.

Tip

If you want to completely defragment and optimize your disk, we recommend that you use Full Defrag. If you just want to defragment the fragmented files and don’t care too much if some are missed, Quick (on-line) is probably the algorithm to use.

Algorithms marked “on-line” can be used with the disk still mounted (i.e. in use); if you want to use an off-line algorithm on your start-up disk, iDefrag will offer to reboot your computer.

Full Defrag

Full defrag is usually the right choice. It performs the following optimizations:

  • Filesystem metadata is moved to the Hot Zone, where it belongs (or, for disks with no Hot Zone, to the start of the disk), and defragmented.
  • Hot zone policies are enforced; hot files are moved into the zone, while other files are evicted. Files that are no longer on the disk are removed from the hot file metadata.
  • Files are rearranged under the control of the selected class set and in the process defragmented. The “Default” class set aims to achieve better overall system performance for your startup disk and applications.

Full defrag responds to the options for Optimize and Metadata, which are documented in their sections below.

Optimize

This is basically just the non-metadata part of Full Defrag.

  • Files are rearranged under the control of the selected class set and in the process defragmented. The “Default” class set aims to achieve better overall system performance for your startup disk.

The Optimize algorithm has the following settings:

Enable per-class sorting
If enabled, iDefrag will sort the files within their respective classes using the sort on specifications in the selected class set file.

Metadata

Like the metadata portion of Full Defrag. This algorithm is useful if the disk has been used by an older machine, or by a piece of utility software that doesn’t support the Hot Zone.

  • Filesystem metadata is moved to the Hot Zone, where it belongs (or, for disks with no Hot Zone, to the start of the disk), and defragmented.
  • Hot Zone policies are enforced; hot files are moved into the zone, while other files are evicted. Files that are no longer on the disk are removed from the hot file metadata.

The Metadata algorithm supports the following settings:

Treat reserved metadata sizes as hard limits

The Hot Zone contains a certain amount of space for the filesystem metadata; ordinarily, the metadata is allowed to expand beyond this size, taking up additional space within the Hot Zone, but if this option is enabled, it restricts the filesystem metadata within the Hot Zone to its reserved size.

The upshot is that on a disk where the filesystem metadata is too big to fit in its allotted area, you will be able to hold more hot files in the Hot Zone than you would with this option deselected.

Compact B-Tree files
Causes iDefrag to compact the filesystem metadata, which should free up disk space and may improve performance.
Rebuild rather than just compacting
If selected, iDefrag will construct new copies of the filesystem metadata, then replace the originals with the copies.

Compact

This special-purpose algorithm is intended to compact data without defragmenting, in order to maximise the amount of contiguous free space on the disk.

The Compact algorithm supports the following settings:

Compact as much as possible
If this option is disabled and iDefrag finds that it would need to move an extent to an overlapping location, it will instead skip to the end of that extent and continue working.
Allow overlapping file moves (unsafe)

Controls the behaviour of iDefrag when it finds that it would need to move an extent to an overlapping location and Compact as much as possible is enabled.

If this option is enabled, iDefrag will move the extent directly to its target location. This is typically faster (though not always), but means that iDefrag will have to hold some of the file’s data in memory during the operation, which increases the risk of data loss — if the power failed or the system crashed during this move, the file in question will be damaged.

With this option disabled, iDefrag will instead move the extent to another location on the disk, and then move it from that new location to the target area. The extent’s data will always be present, in full, on the disk.

Respect file system metadata area policy

If enabled, the Compact algorithm will not move data that does not belong in the Hot Zone into that area.

Disabling this option will result in greater compaction, as it is unusual for a disk to be using the entire Hot Zone.

Compact B-Tree files
Causes iDefrag to compact the filesystem metadata, which should free up disk space and may improve performance.
Rebuild rather than just compacting
If selected, iDefrag will construct new copies of the filesystem metadata, then replace the originals with the copies.
Maintain existing ordering of files and fragments
If enabled, forces iDefrag to keep the files and fragments in the same order on the disk as they are now. This may significantly increase the time taken to compact the disk.

Quick (on-line)

Makes iDefrag function as a basic defragmenter. This is very similar to what you would achieve by defragmenting a disk on Microsoft Windows or with many of our competitors’ products.

When in on-line mode, some files cannot be defragmented; there are two main categories of files that are affected:

  • Any file to which a hard link has ever been made, even if all but one link has subsequently been deleted. The reason for this is complicated and has to do with the way hard links are implemented under HFS+.
  • Files that are currently in use. Technically speaking we could defragment these, but the risk is that you would then lose any updates that were subsequently made to them by the program that has them open.

Selected Files (on-line)

This is like Quick (on-line), but rather than defragmenting any fragmented file it can see, it will only defragment those that are currently selected in iDefrag’s user interface.

If you just want to defragment a handful of files (even just one), this is the algorithm to pick.