The_Absolute said:
How do I defrag my hard drive? How long does that take? What does defragging do?
The built in defragger moves files around by making a copy of the file's data, then optionally verifying that data, then changing the file pointers to point to the new data (the file pointer update is the one risky step). The algorithms look for gaps to fill or files to move out of the way to increase gap size in order to move an entire file into the gap.
To speed up start up time, a more sophisicated algorithm will monitor the order files are read for start up, and attempt to put these files into sequential order.
Defragmenting on a single hard drive is very time consuming because of the large amount of random access involved. The streaming rate of a hard drive is much faster than the random access rate. Streaming rates of new hard drives range from 50MBPS to 100MBPS, while random access and head movment times results in a random access rate of 200PS or less.
Using a second drive makes defragmenting a lot easier and a bit safer. The source partition on one hard drive is copied to a destination folder or partition on the second hard drive on a file by file basis. The ordering of files and any fragmentation causes random accessing of the source drive, but the destination drive is mostly sequential writes, except for the file pointer updates (FAT or NTFS cluster updates). After the partition is copied, then the partitions are compared to verify they are the same. These two steps are part of a normal partition backup. To continue with defragment operation, the original partition is quick formatted, and the files copied from the backup partition to the original partition. This time the operations are almost completely sequential. Afterwards the data is compared again to verify the operation.
I'm not sure which PC based commercial packages support this type of backup and defrag. In my case I use a program I wrote to do the file copy. It retains the dates and time stamp info as well as the short name info, of each file or directory copied. It also copies all files in the current working directory before dealing with any sub-directories, so all files for a directory are located adjacently on a hard drive (this is how most backup applications work). I use windiff to verify copy operations. Since my program doesn't handle the boot partition well, I use multiple partitions, with virtually nothing in the boot partition which I can't restore easily. I keep the OS, applications (mostly games space wise), and data in separate partitions. With this setup, if I got a virus, or I installed an update like Intenet Explorer 8 that I didn't like, I can just restore the OS partition and leave the application and data partitions alone, which speeds up the restore time.
With my setup, I need a second instance of an OS installed on another partition. In my case I use Windows XP X64 to backup the Windows XP SP3 partition and vice versa.