Speed up your PC – Defragment your hard drive on a schedule

Posted on by Robert Collar

This article explains the process behind data storage and retrieval on a magnetic hard drive; How files become fragmented and why defragmenting your hard drive as a regular scheduled task will speed up your PC.

Files and programs are stored on spinning discs called platters, in the sealed environment of the hard drive casing. The Windows File System keeps track of the physical location of these files and programs by updating a pointer in the Master File Table which records the sectors on the platters on which the files are stored.

In an ideal world, a saved file would be stored in consecutive sectors on the platters, or to give it the correct term – stored “contiguously”, but over time the contiguous storing of files becomes less and less likely, as programs are uninstalled, old files deleted and hard drive sectors freed up and marked as available. Before too long the available sectors on a hard drive start to appear randomly all over the platter, rather than in neat orderly contiguous blocks.

A mechanical arm controlled by a device called an actuator moves backwards and forwards across the surface of the drive, both reading data to the Operating System and writing data back from the Operating System to the hard drive. The speed of writing and retrieval is therefore governed by the speed of the hard drive (which you cannot control) and where on the drive the data is located, i.e the sectors in which the file is stored across the hard drive (which you can control).

If a file is located in random sectors all over the drive rather than contiguously, the mechanical arm has to travel to many different locations across the drive in order to read data back to the Operating System which of course increases the time taken for Windows to load the file into memory.

The process of defragmentation takes all the individual fragments of files and relocates them to a contiguous area of the hard drive so that the read/write head only has to move to one contiguous location in order to read data to or write data back to the drive.

Windows 7 does a good job of addressing the issue and has a built in continuous monitor which defragments the drive on a regular basis by default, but Windows XP does not have this scheduled task set. Therefore “defragging” the drive should be part any regular routine maintenance carried out on your PCs.

The process is very simple but during defragmentation, ironically the PC will probably slow down to the point of being unusable, so is best left til a time when it’s not being used, such as overnight or during a dinner hour. The process can also be paused or cancelled at any time if started at an inconvenient time.

To check on the fragmentation of your drive and start the defragmentation process:

Click the Start button and open My Computer (In Windows 7 this is simply called Computer)

Right click on the drive you wish to defragment and select Properties

Go to Tools then Defragment Now

to bring up the option to Analyze or Defragment the drive.

The colour coded legend in Windows XP is Blue for contiguous files and Red for fragmented files. Red is bad and would indicate a drive running at less than optimal performance

The built in free Windows XP defragmentation tool has limitations and does not always have the armoury necessary to defragment a drive effectively. If this is the case then a more powerful third party tool such as Diskeeper may be required to defragment files that are constantly in use such as the paging file or Outlook email files. A 30 day free trial is available at the time of writing and is well worth a look to keep your drive running at optimal performance – https://www.diskeeper.com/

As previously mentioned, Windows 7 does a much better job of keeping the Master File Tables’ house in order and therefore the drive defragmented and running smoothly. It does this in real time and on a schedule set by the user. In this example you can see that the drive has a scheduled defrag set for each Wednesday at 1am as part of the built in process

A schedule can be set in Windows XP in much the same way as Windows 7, by using the Windows Task Scheduler as follows:

Click on the Start button

Go to Control Panel / Scheduled Tasks

Select Add a scheduled task then Next when the scheduled task wizard starts

Browse to C:\Windows\System32 and select defrag.exe and Open

Give the task a name, set the time and frequency you want it to run.

and finally the computer account name under which the task should run. This must be a user with administrative rights on the PC is typically in the format computername\username and password

Finally check the box to open the advanced properties and Finish

For hard drives with more than 1 partition, for example where the data is saved to the D: drive and the Operating System is on the C: drive, select which drive you wish to defragment by appending the drive letter to the end of the RUN line.

By default this should be C:\Windows\System32\defrag.exe

By changing this to C:\Windows\System32\defrag.exe D: this would defragment the D: drive rather than the C: drive. Renter the username and password in the Run as dialogue box and finish

We hope you found this explanation of fragmentation and task scheduling useful. For further details or to find out how the support staff at TAB Computers can help keep your IT running smoothly, please call us on the numbers listed, or click the contact form and a member of the TAB Computers support team would be delighted to call you back.

Be Sociable, Share!

This entry was posted in General, Latest news. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current month ye@r day *