Mac hints and tips
Defragment the hard disk part 1 (10.4/5)
Defragmentation is a process that affects the performance of the computer by slowing down access to files on the hard disk drive. Here's the theory: Suppose you save three files called File1, File2 and File3. They are stored one after the other on the hard disk drive starting with the first available free space. Now if you delete File2 you'll then have File1, an empty space, then File2 on the disk drive. If you save another file, File4 then the operating system will store it in the first free space, which is the space between File1 and File2. But what if it's too big to fit in the space? Well, part of the file is stored in the free space and the rest is stored elsewhere. You then have a file that is fragmented - literally in two or more fragments.
This is a simple case and it's possible for files to become split into many fragments as the operating system fills in the gaps left by deleted files. When you want to access a file the operating system will search the disk for the various fragments and this takes time. Accessing fragmented files is therefore slower than accessing ones that are stored in one complete block on the disk.
Over time many files become fragmented and the computer gradually slows down because it spends a lot of time hunting for the various parts of files that are scattered all over the disk drive. The solution is to defragment the disk - a process that collects the parts of fragmented files and moves them to a new place on the hard disk drive where there is planty of free space and they can be stored as a single object.
One way to do this is to backup the hard disk drive and then to restore the backup. Here's how it works: If you have an external hard disk drive plugged into the USB or FireWire port you can use a utility like Carbon Copy Cloner or SuperDuper to create an exact copy of the Mac's internal disk drive on the external one. You then restart the Mac and hold down the Option key as it starts. You'll be prompted to select the disk to boot from and you can choose the external disk drive.
The Mac will boot up as normal, but from your cloned disk. You can then use Carbon Copy Cloner or SuperDuper to copy the external disk - the cloned one - back to the the Mac's internal disk drive. There's an option to wipe the hard disk before the process starts. When you do this, all the files are written one after the other in the free space and the result is a defragmented hard disk drive.
This is a very slow process and it's not one you would want to do very often. However, you need to make backups anyway, so half the work is done and it's only one more step to defragment the hard disk drive by restoring the backup.
Defragment the hard disk part 2 (10.4/5)
Modern hard disk drives are much faster than they used to be and there's isn't as much loss of performance with fragmented hard disk drives as you might expect. It's therefore not as important to defragment disks as it used to be. Apple says that the operating system tries to avoid fragmenting files by using the large amount of free space on modern hard disk drives more intelligently. It won't try and squeeze a big file into lots of small spaces if it can avoid it. However, if there's not much space left on the disk drive surely it's unavoidable, so defragmentation is sometimes necessary.
OS X does perform some disk optimisation to rearrange files and reduce fragmentation, but it's not perfect. There aren't many third party defragmentation utilities available for the Mac, but if you want to try one and see if it can speed up your Mac, take a look at iDefrag.