| Automatically Defragmenting your Hard Drives |
| Written by Shadow1980 | |
| Sunday, 03 December 2006 | |
|
Operating System: WinXP Home, WinXP Pro What is Defragmenting When your operating system tries to save a file which already exists, (you are updating a program, saving a game, making modifications to a word document, etc) there often isn't enough space at the exact location where the file was originally saved on your drive. If you for example copy 10 files, they will be stored 'next' to eachother on your drive as this takes less time for the writing process. Your operating system does not anticipate that the file could become larger in the future. So, when it does need more space, an operating system breaks the file into 2 or more pieces and store them in different parts of the drive/partition. Defragmentation is the term used to describe the process of rebuilding the split files into one piece by scanning the file system for them and rejoining them into consecutive pieces. This can be quite a time consuming process, hence this guide on how to automate the process to do it at a time it is most convenient to you. Let's move on by explaining why you should degragment your drive(s) regularly.
Why should you defragment your hard drive(s)?Defragmenting your drive(s) is one of the easiest ways to increase the performance of your computer. After defragmenting, performance increases are most noticeable on very large databases that had been heavily fragmented. Nowadays, computers are much faster then they used to be - so some users may not notice any significant increase in speed with basic applications such as word and excel. It is however still good practice to defragment disks regularly as it reduces wear and tear on the drive mechanism. Data recovery experts will tell you that a defragmented disk is much easier to restore then a fragmented disk, should your hard disk ever crash and you did not back up important files. The frequency at which your drives should be degragmented directly depends on the amount of usage. If you make heavy use of databases or regularly (re)write thousends of files to a disk, you will benefit the most from a regular defrag.
So why do it automatically?As I mentioned earlier, defragmentation of your drives can take quite some time, especially if you have not done it for quite some time. And if you have multiple hard drives or partitions, like I do - you will notice it can be a huge pain in the backside. The standard WinXP defrag interface only allows you to do one drive at a time, and it requires manual intervention to start the degrag on the next drive - preventing you from starting it before you goto bed and having it done overnight. Imagine how much easier it would be if you could start it to defrag all your drives automatically in one go, before you go to bed - and wake up with it being done! Or, even better, have it schedule an automatic defragmentation of all your drives at a time and interval of your choice! Is this possible? Of course it is - otherwise I would not have started this article ;-).
Creating a batch file to defragment all your drivesBesides for the standard defrag interface, there is also a command line you can use to start a defrag. One of the parameters you can use is to force a degraf without confirmation, allowing us to create a process of defragmenting all drives in order without the need for you to click to proceed after each drive. First, load notepad. (Start -> All Programs -> Accessories -> Notepad) No in notepad, add one line for each of your drives, according to the following example based on a user with drives "C:", "D:", "E:" and "F:". Make sure you only add your hard drives / partitions and not your CD/DVD Drives! If you are not sure, open "My Computer" and check what designations your hard drives use. defrag c: -f
So, if you only have a drive c:, you would only need the first line.
Now save the file as "defrag-hd.bat" including the quotes. Save it anywhere you want, just remember where you saved it. Now find the file and double-click it if you would like to start defragmenting of all your drives!
Automatically DefragmentingTo schedule an automatic defragmentation of all your drives, you will need to use the 'scheduled tasks wizard'. Go to "Start -> All Programs -> Accessoiries -> System Tools -> Scheduled Tasks" In the 'scheduled tasks' window, choose 'Add Scheduled Task'. This will load the 'Scheduled Task Wizard'. When you start the wizard, you will get a list of programs which you can schedule to run automatically, but you will need to click the "browse" button and select the batch file we created previously manually. After this, follow the wizard by selecting all your preferences, this is extremely straight forward. (If you want it daily, choose daily etc.) Personally I would recommend doing it either weekly, or monthly at the very least. Choosing a time at which you are definitly in bed prevents disruption while using the computer. Remember though that your computer will need to be left on at the dates you have scheduled, or the event will not trigger. (It doesn't boot up the computer for you and turn it off afterwards, sorry ;-) )
I hope this guide was of use to you and you now have an easier time keeping your disks defragmented. Feel free to drop me your comments and good luck!
|
|
| Last Updated ( Friday, 08 December 2006 ) |
| < Prev |
|---|