Hardware and Software Disk Optimization

Before you start

Objectives: learn general disk optimization procedures which consider lack of free space, fragmentation and disk errors.

Prerequisites: you have to know what are Disk Quotas.

Key terms: drive, file, data, errors, interface, faster, checking, fragmentation, defragment, optimize, upgrade


Hardware Optimization

From a hardware perspective there are two things we can do to optimize the performance of our storage system. The first thing we can do is to upgrade to the fasted hard disk possible. Hard drives come in different rotational speeds. Currently the slowest drives run at about 5400 revolutions per minute (RPM). The rotation speed dictates how fast data can be written to, or read from the hard disk drive. The faster the drive spins, the faster it can read data and the faster it can store data. As a bare minimum we should get a 7200 RPM drive. More RPMs also mean more money for the drive.

The second thing we can do is to upgrade our disk interface. If we have to stick with IDE then we should ensure that our motherboard supports the ATA133 standard, which transfers data at roughly 133 megabits per second. Also, disks have to support ATA33 standard as well. Upgrading to a faster disk interface will dramatically improve the throughput of data to and from our hard disk drive. Because of that we should move away from the older ATA/IDE interface and upgrade to a serial ATA disk interface (SATA). By doing this we can upgrade speed to 150 megabytes for SATA 1, 300 MB for SATA 2, or 600 MB for SATA 3.

Software Optimization

Disk Cleanup

When talking about software optimization one of the key things that we can do is keep our disk clean. That means that we should get rid of the files that we don’t need. Mostly empty drive is faster than a full one. A drive that is mostly full is a bit slower because the hard disk interface has to go all over the hard drive to find pieces of a file or trying to find an empty space in which to save a file. To accomplish this, one thing we can do is to run Disk Cleanup utility. To run disk cleanup, go to the properties of the drive and in the General tab click on the Disk Cleanup button. Disk Cleanup helps us to dispose of files that can be safely removed from the disk. Those include emptying the Recycle Bin, deleting temporary files such as those used by Internet Explorer (temporary Internet files), application installation files, installation log files, offline web pages, hibernation files, Windows error reports, and also compressing old files. We can also run Dick Cleanup in CMD by typing cleanmgr. Regular users can also run Disk Cleanup wizard, but they will be only able to delete user specific files, and not system files.

Another thing we can do is to remove unused Windows components. When Windows is installed by default a certain set of Windows components are included in the installation. To do that we can go into Control Panel > Add/remove programs > Windows Components and deselect different components that we never use. Getting rid of stuff that we don’t use frees up space on the hard disk drive. When our hard disk drive has more free space the disk interface can read information faster and it can write information faster.

Fragmentation

Another thing we can do is to defragment our disk drive. To understand the need for defragmentation we have to understand what fragmentation itself is. When hard disk controller writes data to the disk it scatters parts of the same file over different areas of the disk. This is called fragmentation, and it gets worse as time goes along. After we first install an operating system and start installing applications, disk isn’t fragmented very badly, since new files and folders are created on available free space in contiguous blocks. This is the most optimized way to store files on our disk. The fragmentation occurs over time, as we delete and then add new files. That’s because as the free space reduces, the amount of contiguous block is also reduced. Pretty soon fragments are stored all over the hard disk drive. In other words, different parts of the same file are stored on different sectors of the hard drive, which leads to suboptimal performance. On the picture below we can see how files are scattered on the disk. In this example the disk should be defragmented. White area indicates free space, while other lines indicates data on the drive.

333.1 – Disk Fragmentation

When we try to open fragmented file, in order for system to display that file, the disk interface has to find all the chunks of the file on the disk, then reassemble them and load it into memory so that the application can use it. The more fragmented a file is, the longer it takes to read the information from the disk. The same thing is when we’re writing information. If we have empty chunks of hard disk space which are scattered all over the disk, and we’ve got a large file that needs to be written, that file will get fragmented as it is written to the disk, which will slow things down. In order to fix this we need to defragment the hard disk drive. When we defragment the drive, the system will take all the chunks of the same file and put them in contiguous blocks. They will still be separate chunks, but they’ll be next to each other. So, the defragmentation is the process of moving parts of a file to contiguous sectors on the hard disk drive, to increase the speed of access and retrieval. We can do this using the defragmentation utility that comes with Windows. To defragment disks in Windows, go to the properties of the drive, open the Tools tab and click on the Defragment Now button. Before the defragmentation we will have to analyze the disk first. The more information on the drive, the more time it will take to defragment the drive. To run Disk Defragmenter in CMD we can type in the Defrag command. We should configure our computer to run defragmentation on a schedule. We can use our computer during the defragmentation process, but it is recommended not to since we can actually create additional fragmentation as we work. Remember that we can’t defragment network drives, and that only one defragmentation process can run at the time. To determine if our disk needs defragmentation, we can use the Analyze Disk option. We have to have administrative rights to run defragmentation.

Scan For Errors

Another thing we can do to optimize storage devices is to scan disks for errors. We can use the error checking utility in Windows to check for file systems errors and bad sectors on our hard drive. We can choose to automatically try to fix errors. Error checking tool looks for and fixes two different things. First it looks for lost clusters. A lost cluster is a series of clusters on the hard disk drive that are not associated with a particular file. Data is there but it’s unknown as to what file that data belongs to. Error checking tool looks for those and tries to repair them. Usually it can repair them, but sometimes it can’t. If we’re in a situation where we can’t repair lost clusters that usually means we’ve got some serious disk errors and we’re going to be losing some data.

The second thing that errors checking utility checks for are cross linked files. A cross linked file occurs when two files try to claim the same cluster. Both of files claim that particular cluster is a part of itself. Error checking tool will look for cross linked filed and fix those. Orphaned files are files that exist on the hard drive but which are not associated with a directory in the index. Normally Check Disk can re-associate the file with the correct directory. Abad sector is a portion of the hard disk that cannot be used. Bad sectors are marked so that they are no longer used. Any used bad sectors are redirected to another sector. The NTFS file system automatically detects bad sectors as the system saves and reads files. We can run Check Disk by typingChkdsk command at a command prompt. We can also use Chkdsk command with the /f switch to automatically fix errors without scanning for bad sectors. Also, we can use the /r switch to scan and fix bad sectors and other errors. Check Disk replaces the ScanDisk utility that was available in Windows 9x/Me, so Check Disk is sometimes referred to as Scan Disk.

We should perform defragmentation and disk checking on regular basis and do them frequently. How frequently depends on how heavily the system is used. If we have a heavily used system we should run error checking scan, disk clean up and disk defragmentation about once a week, maybe even more frequently. If it’s a system that doesn’t get used much then we could probably get away with doing this once a month. To check for disk errors in Windows, go to the properties of the drive, open the Tools tab and click on the Check Now button.

Examples

Check out our articles in which we show how to defragment disks in Windows:

Remember

To optimize our storage devices we can upgrade our disk hardware and our disk interface to the fastest possible. We can also clean up our hard disk drive using the disk clean up tool. We should defragment our hard disk drive and check for disk errors often and on regular intervals.