Real-time apparatus and method for minimizing disk fragmentation in a computer system
First Claim
1. In a computer system comprising a processor, an address/data bus coupled to said processor;
- a computer readable memory coupled to communicate with said processor, a method performed by said processor for defragmenting a random access storage device where information is stored in files, and where information regarding the location of the files is contained in a master file table stored in a master file zone, the method comprising the steps of;
invoking a first process flow to select a fragmented file having a plurality of non-contiguous extents and moving each extent toward the front of the disk thereby tending to pack files near the beginning of the disk and creating free space toward the end of the disk, said first process flow further comprises the steps of;
identifying a fragmented file having a plurality of non-contiguous extents;
moving the file extents to a contiguous free space on the storage device that is closer to the beginning of the disk than the current file location of the first extent of the fragmented file;
moving the file extents toward the end of the disk if contiguous free space is unavailable closer the beginning of the disk than the current file location of the first extent of the fragmented file so as to at least partially defragment the fragmented file, said step of moving the file extents toward the end of the disk occurring when the contiguous free space is no smaller than the square root of the total number of clusters in the fragmented file so as to at least partially defragment the fragmented file;
invoking a second process flow to select fragmented and contiguous files and moving the files toward the beginning of the disk;
repeating the first and second process flow so as to further minimize file fragmentation and pack contiguous files toward the beginning of the storage device;
invoking a third process flow to move fragmented files and contiguous files from the master file table zone to free space; and
invoking the second process flow to move files toward the beginning of the storage device.
4 Assignments
0 Petitions
Accused Products
Abstract
The present invention relates to an apparatus and method for defragmenting a disk drive in a computer system. The defragmentation process, in accordance with the present invention, determines which files have a high degree of fragmentation, where such file extents are to be physically moved on the disk and further determines which portions of such files are to be moved to the selected physical location. More particularly, the defragmentation process selects each file on the disk, checks to see if the file is excluded from processing and, if not, recovers the extent list for the file. If the file is fragmented, the process determines if there is sufficient free space in which to move the file extents to contiguous location on the disk. If such as space exists, the file extents are moved. If the free space is sufficiently fragmented or the disk is substantially full, contiguous files are moved to contiguous locations so as to partially defragment the file. If the file is already contiguous or if there is insufficient free space available to partially defragment the fragmented files, the process of the present invention moves the files or the file extents so as to maximize contiguous free space on the disk. The process then repeats so as to further defragment files that were previously left fragmented. In this manner fragmented files and fragmented free space on the disk are made contiguous. Files are then moved toward the front of the disk where possible. When the fragmentation process is complete, contiguous files tend to be packed toward the front of the disk with defragmented free space tending to be located toward the end of the disk.
-
Citations
15 Claims
-
1. In a computer system comprising a processor, an address/data bus coupled to said processor;
- a computer readable memory coupled to communicate with said processor, a method performed by said processor for defragmenting a random access storage device where information is stored in files, and where information regarding the location of the files is contained in a master file table stored in a master file zone, the method comprising the steps of;
invoking a first process flow to select a fragmented file having a plurality of non-contiguous extents and moving each extent toward the front of the disk thereby tending to pack files near the beginning of the disk and creating free space toward the end of the disk, said first process flow further comprises the steps of; identifying a fragmented file having a plurality of non-contiguous extents; moving the file extents to a contiguous free space on the storage device that is closer to the beginning of the disk than the current file location of the first extent of the fragmented file; moving the file extents toward the end of the disk if contiguous free space is unavailable closer the beginning of the disk than the current file location of the first extent of the fragmented file so as to at least partially defragment the fragmented file, said step of moving the file extents toward the end of the disk occurring when the contiguous free space is no smaller than the square root of the total number of clusters in the fragmented file so as to at least partially defragment the fragmented file; invoking a second process flow to select fragmented and contiguous files and moving the files toward the beginning of the disk; repeating the first and second process flow so as to further minimize file fragmentation and pack contiguous files toward the beginning of the storage device; invoking a third process flow to move fragmented files and contiguous files from the master file table zone to free space; and invoking the second process flow to move files toward the beginning of the storage device. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
- a computer readable memory coupled to communicate with said processor, a method performed by said processor for defragmenting a random access storage device where information is stored in files, and where information regarding the location of the files is contained in a master file table stored in a master file zone, the method comprising the steps of;
-
11. A computer-usable medium having computer readable program code embodied therein for causing a computer to perform the steps of:
-
invoking a first process flow where contiguous and non-contiguous files are moved toward the beginning of the storage device so as to pack the files and file extents toward the beginning of the storage device and creating contiguous free space toward the end of the storage device; invoking a second process flow to move files from the end of the storage device toward the beginning of the storage device, said second process flow tending to defragment file extents, said second process flow further comprising the steps of; selecting each of the files stored on the storage device beginning with files located near the end of the storage device and proceeding toward files located toward the beginning of the storage device; searching the storage device for free space of sufficient size between the file'"'"'s current location and the beginning of the disk; moving the selected file to the free space if the free space is sufficient to locate the entire file in a contiguous locations; and repeating the selecting, searching and moving steps until the front of the disk is reached; repeating the first and second process flow so as to further minimize file fragmentation and pack contiguous files toward the beginning of the storage device; invoking a third process flow to select fragmented files and move each fragment of said files toward the front of the storage device to create free space toward the end of the disk if no space is available toward the front of the storage device to at least partially defragment the file; and invoking the second process flow to move files toward the beginning of the storage device. - View Dependent Claims (12, 13)
-
-
14. In a computer system, a method for defragmenting a disk drive having a plurality of clusters of storage locations arranged in a sequential manner, said drive capable of storing a plurality of files where each of said plurality of files are stored in at least one cluster of the plurality of clusters of storage locations, said method comprising the steps of:
-
beginning at a first end of said disk drive and proceeding to about the middle of said disk drive, identifying files stored on said disk drive in either one or at least two contiguous clusters, said identifying step further comprising the steps of; identifying files stored on said disk drive in at least two non-contiguous clusters; and moving said files stored in said at least two non-contiguous clusters to at least two contiguous clusters proximate to said second end of said disk drive; determining whether each of said identified file abuts at least one cluster of free space; moving said identified file to free space proximate to a second end of said disk drive if said the beginning storage location of the identified file abuts at least one cluster of free space; repeating said identifying, determining and moving steps; and moving files proximate said second end of said disk toward the beginning of disk drive so as to eliminate clusters of free space between adjacent files stored on said disk drive. - View Dependent Claims (15)
-
Specification