There is disclosed apparatus and a method of de-fragmenting file allocations
on a disk comprising: determining what pages should be swapped among the various
allocations made by the operating system (OS), the OS's file system mapping updated
to reflect the swapped pages and a history of the original state prior to any update
recorded by the engine, the swaps performed by manipulation of the engine's data
structures and/or actually exchanging data on disk where OS visible data is read
and written but the original state of each altered page is not directly recorded
in the historic log, but instead, a record is additionally logged of the locations
of the swapped data so that an image of the OS visible data can be reconstructed
prior to time of the de-fragmentation by knowing what data to effectively re-swap
and what OS mapping data to effectively restore. The apparatus and method may include
the step of incorporating desired close proximity information of various OS visible
pages into the algorithm executed by the engine that determines what is actually
swapped, in order to reasonable maintain physical close proximity of data allocated
by the OS but physically re-mapped by the engine.