This article will show you what disk fragmentation is and how to defrag hard drive.
In fact, disk fragmentation should be called file fragmentation, because files are separately saved to different locations throughout the disk rather than continuously saved in contiguous clusters of the disk.
When physical memory required by applications isn’t enough, generally the operating system will produce temporary swap file on hard disk. The disk space occupied by this temporary swap file is used to form virtual memory. The management program of virtual memory will frequently read and write on the hard drive and produce large amount of fragmentations. This is the main reason for hard disk fragmentation.
In addition to this, there will be a lot of fragmentations caused by temporary files in system. The temporary files generate when IE Explorer browses information or users directly set them. Frequent disk defragmentation can enhance the service efficiency of hard drive in computer.
1. Definition
Disk fragmentation refers to the discontinuous files produced during the process of reading and writing hard disk. The non-continuous files written on hard disk may produce fragmentation. Fragmentation will lengthen hard disk seek time and affect system performance. For example, if virtual memory occupies disk, there will be disk fragmentations on hard drive. Learn how to Defrag Hard Drive in Windows to Improve Computer Performance.
2. Generation
In the process of file operations, Windows system might call virtual memory to manage program synchronously. This will make many programs read and write frequently on hard disk.
Another case is that a smaller new file is written to disk after the content of a cluster (composed by sectors) in the middle was deleted. Some space will exist on both sides of these two files. At this time, another file is written in, but any part of the two pieces of space can’t hold this file. The file will be divided into two parts. And fragments produce again.
Downloading large files like movies is most common. During the download, people usually deal with other things. Downloaded movie files are forced to be divided into several fragments and be stored on hard disk. So, download is an important reason for fragmentation.
What’s more, frequently deleting and adding files are also reasons for fragmentation. If the space to hold these files is not large enough, lots of disk fragmentation will be generated. Along with frequent file deletion, this situation will become increasingly serious.
Although disk fragmentation doesn’t affect too much of the normal work, it will significantly reduce running speed of hard disk. This is mainly because hard disk needs to jump between multiple pieces when it reads files. Latency of waiting for disc to rotate to the designated sector and seek time of head switching track are increased.
After computer has been used for a long time, disk holds a lot of files. These files are not saved on contiguous disk space but separately saved in some place. These fragmented files are called “disk fragmentation”. These pieces will lower overall performance of Windows. Disk contact needs to move back and forth each time it reads and writes files. This is a waste of time. So, Windows offers a defragging program.
3. Operating Principle
Disk Read and Write Actions During Program Runtime
We also need to know disk read and write actions during program runtime after knowing the cause of disk fragmentation. Generally, when we run one program, the head of the disk driver will do the following work: searching the files required to run this program, reading data, doing the reading processing and transferring data to disk cache and memory. Search time is called average seek time on hard disk performance index. It is specified in milliseconds (ms). The average seek time of disk is less than 9.5 ms.
If the relevant documents of applications can be placed in continuous disk space, the search time of heads will be reduced a lot. It’s the same with reading. The time required for disk to read data in sector below the head is only 1/5 of the time required to move the head to another place and then read the same data.
When disk is read, system will check whether the data are in the cache. If they are, they will be directly read; if not, the disk will be accessed. This is called reading the disk. When the same data need to be read for multiple times, cache plays a great role. But if a file is read for the first time, cache can’t do any thing. Search time and read time largely affect efficiency of program execution.
Why Should We Defragment Disk
We carry out disk defragmentation, because Windows system can’t put every file in the appropriate location of disk according to the principle of reducing search time of head. So, Microsoft adds “Disk Defragment” to Windows and offers “Task Monitor” to track disk activity during program startup. Tracking disk activity makes “Disk Defragment” work efficiently. “Task Monitor” will automatically run along with the start of Windows (of course you need to tick “Task Monitor” in the “start”).
When an application is loaded, it knows searching and calling files during program start through monitoring disk access action. It locates the desired file and saves the monitoring result in hidden directory of drive C:\Windows\Applog. Most files in this directory use “.lgx” as extension. “lg” represents log file and “x” means drive letter.
For example, the program of drive D: uses “.lgd’ as extension. File name of the recorded file is file name of application monitored by “Task Monitor”; program WinZip on drive E: is recorded “Winzip32.lge”. When users perform disk defragmentation, the program will move related files of application into contiguous space on disk according to information in APP log.
Task Monitor only searches for file information during program loading process. It will adjust and optimize the order based on the loading frequency of the program. This means that the software used the most times will be optimized best. The APPLOG.ind file of APPLOG records running times of applications. Users need to repeatedly start common software, let Task Monitor track and record and then use Disk Defragment to sort.
This can truly realize improving speed of application startup. But, if users change commonly used software, such as changing WinZip to ZipMagic, then for a long time, Disk Defragment will still move the files related to WinZip rather than ZipMagic into continuous space. Unless the loading times of ZipMagic is more than that of WinZip.
To solve this problem, users can delete “Winzip32.lgx”. If the log file doesn’t exist, Disk defragmentation won’t optimize it.
4. External Fragments and Internal Fragments
Many people will be confused with the concepts of file fragmentation and cluster.
In fact, for Windows system, every partition on hard disk is composed of the minimum storage unit – cluster. It’s like that one wall is composed by turning around a block. The size of cluster can be defined by users when the partition is formatted. It is usually the size of several KB, such as 8 KB. For example, I have a file whose size is 800 MB point 1 KB (1 MB = 1000 KB). 800 MB is equal to 80,001 KB. 80,000 KB among it occupies 10,000 clusters. The rest 1 KB also has to occupy 1 cluster.
However, there is space of 7 KB not used. And other files can’t occupy this cluster which is not fully used. This causes a little bit of wasted space. Many people call the waste of 7 KB space as internal fragmentation on disk. However, users can change cluster size to make the best use of disk space.
The external fragmentation (usually called disk fragmentation. Disk defragmentation tools can only clean external fragmentation on hard disk. Unless you change the allocation unit, namely cluster size of the file system to make it an integer multiples of a file size) on hard disk actually means that the non-continuous clusters occupied by one file. This is equivalent to that the file is divided and saved separately on discontinuous paragraphs of clusters.
There will be several pieces in accordance with the number of parts that the file is divided into. So, fragmentation actually refers to file fragments. This can be understood as the file has been broken into pieces. Sometimes, sequence between file fragments is disorder. For example, sometimes cluster segment occupied by “rearward file fragments” on hard disk may be in the front row of “front file fragments” cluster segment. As a result, a file will be stored on hard disk in a chaotic sequence.
5. Defragment the Hard Disk
(1). Necessity
Actually, it should be no doubt that we need to regularly defragment the hard disk. If hard disk defragmentation really damages hard drive, it will damage it after many times of defragmentation. If a hard disk has been used for a long time, storage location of the files will become fragmented – file content will scattered in different locations on hard disk.
The existence of these fragmented files will reduce the work efficiency of disk and increase the possibility of data loss and data corruption. Defragmenter collects these fragments and save them on disk as a continuous whole. Windows comes with this program: Disk Defragmenter. But there are better such programs in Morton Utilities and Nuts & Bolts.
(2). Period
One time every three months for individual PC users
One time per month for business users, enterprise users and government users
When you perform disk defragmentation, you must turn off the screen saver and mustn’t perform other operations on computer, such as listening to music and playing games. You should let computer only run the Disk Defragmenter to prevent from losing data. At the same time, it’s not recommended to frequently defragment the hard disk, because in that case, hard disk will not stop reading and writing. This will affect the service life of hard disk.