Monday, 5 December 2011

How disk defragmentation improves performance

The computer hard disks store data (files) in the form of groups of bits(0,1) on the magnetic surface of the disks. Mechanical heads move on the surface of the disks to read and write data. Large files are stored as multiple blocks on the disk. If theses blocks are stored close to each other then it takes less time for the read/write head to move to the position where the data is stored.

Initially when files are written on to the disk they are written close to each other. You can verify this by checking fragmentation details of a drive in Windows XP. The diagram made of blue,green and red lines show the relative positions of files on disk. In Windows 7 fragmentation is reported in percentage.

Disk fragmentation should be carried out at regular intervals as this increases the chances of finding files (or blocks of same file) nearer to each other. The mechanical heads of disk drives need considerable time (2-10 milliseconds) to move to a sector on a disk. This is a very large amount of time which would be wasted if processor is waiting for data stored in a file for execution in some application.

Some commercial defragmentation softwares are -
  • Disk defragmenter (included in most versions of Windows)
  • Norton SpeedDisk by Symantec
  • PerfectDisk  by Raxco Software
Some freeware defragmentation softwares are -
  • Defraggler, by Piriform (makers of CCleaner)
  • DiskTune, by DIY DataRecovery
  • MyDefrag, by Jeroen Kessels
Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together , even if they can't be stored in consecutive sectors. So ext3 filesystem defragmentation tools are not found on internet.

No comments: