Defrag technology

By maxmadx
Mar 18, 2005
Topic Status:
Not open for further replies.
  1. Hi all. I am writing an academic paper on IT architecture from an 'outsider’s perspective' (centred on the topic of innovation - "can’t see the wood for the trees"). Can I ask for some help on the process of defragmentation. With the varying file systems (NTFS, Fat, FAT32) it is difficult to understand how a Defrag program can successfully negotiate disks. I understand the concept of fragmented data, how it becomes fragmented, and know how, in general, a defrag is supposed to help. However, can someone explain to me in detail, or give me any advise/help/URL's as to how a defrag program really works:: from the pushing of the defrag button (so to speak)
    How does it identify fragmented files?
    How does it locate fragmented files?
    How does it store this information?
    What is the defragmentation process? eg. Scan, document, relocate?
    Is there any information already stored about fragmented files on a day to day basis, or is it one clean scan when defrag is run?
    Are there separate processes depending on the Filing system/OS system?
    Where are indexes and lookup tables located, and how are these referenced?


    This paper is referenced on the basis of helpfulness of response and this site will be properly referenced. - Maxmadx@hotmail.com for E-mails to be included in its general release.

    Thanks.
  2. RealBlackStuff

    RealBlackStuff Newcomer, in training Posts: 8,165

    Try www.execsoft.co.uk for Diskeeper.
    They have a lot of info on their website.
    The standard W2K and XP defragmenters are limited versions of Diskeeper.
  3. Nodsu

    Nodsu Newcomer, in training Posts: 9,431

    As you know, the basic allocation unit of a hard disk is a cluster (block). The main purpose of a filesystem is to keep track of what files occupy what blocks. All the defrag program has to do is to look through the filesystem metadata (a simple table in FAT systems, complicated trees and chains of blocks in other systems) and check if the blocks that a file resides in are contiguous (the block numbers run in sequence). It does this for all files on the disk.
    As was said before - you just have to look at the filesystem metadata and it will tell you what blocks a file lives in.
    This is just a matter of programming. I suppose the most trivial way would be a list. One entry in the list is made up of a file name and a list of all the blocks the file is contained in.
    Yes, this is pretty much it.
    All the needed info is contained in the filesystem itself and it is updated constantly since otherwise you would end up with a broken filesystem. Every time you run the defrag, the filesystem metadata is scanned and all the info is stored in some internal structures of the defrag program.
    Things are file system dependent since filesystems keep their metadata differently. And it is most certainly OS specific since working with disk blocks is a very intimate activity that is not allowed for user level programs. Windows XP supplies defragmentation routines that any programmer can use. Other versions of Windows required you to write special drivers.
    They are stored in the RAM. The exact implementation is really up to the skill and preference of the programmer(s).

    All I just said is As I Know It. If your paper is something serious then you might want to double-check things and I hope other people correct me if I got it very wrong :p
  4. maxmadx

    maxmadx Newcomer, in training Topic Starter

    Thanks very much Nodsu
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.