CN1211798C - Method and system for calculating disk fragmentation rate - Google Patents
Method and system for calculating disk fragmentation rate Download PDFInfo
- Publication number
- CN1211798C CN1211798C CN 01139859 CN01139859A CN1211798C CN 1211798 C CN1211798 C CN 1211798C CN 01139859 CN01139859 CN 01139859 CN 01139859 A CN01139859 A CN 01139859A CN 1211798 C CN1211798 C CN 1211798C
- Authority
- CN
- China
- Prior art keywords
- bunch
- file
- length
- discontinuous
- magnetic disc
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 16
- 238000013467 fragmentation Methods 0.000 title description 28
- 238000006062 fragmentation reaction Methods 0.000 title description 28
- 239000012634 fragment Substances 0.000 claims abstract description 22
- 238000011156 evaluation Methods 0.000 claims 1
- 238000004364 calculation method Methods 0.000 description 7
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 239000012467 final product Substances 0.000 description 1
Images
Landscapes
- Signal Processing For Digital Recording And Reproducing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Indexing, Searching, Synchronizing, And The Amount Of Synchronization Travel Of Record Carriers (AREA)
Abstract
Description
技术领域technical field
本发明涉及一种计算磁盘碎片率的方法及系统,特别是涉及一种利用文件配置表来快速计算出磁盘碎片率的方法与系统。The invention relates to a method and system for calculating disk fragmentation rate, in particular to a method and system for rapidly calculating disk fragmentation rate by using a file configuration table.
背景技术Background technique
磁盘上的数据储存空间会被分为多个各自相连的单元,称之为配置单元或是簇。而将文件写入磁盘时,文件会被分段成簇大小的不连续区块,当文件的所有区块都位于相邻近或连续的簇时,可以快速地被存取,因为所有的信息都在同一个地方。Data storage space on a disk is divided into a number of connected units called configuration units or clusters. When writing a file to disk, the file will be segmented into discontinuous blocks of cluster size. When all blocks of the file are located in adjacent or continuous clusters, they can be accessed quickly because all information all in the same place.
但是,一旦磁盘使用久了,可使用的连续区段空间会变的越来越少,因为文件在存取时,都会尽量在磁盘中找寻连续区段的空间来存放,数据的修改、复制、删除以及移动等等,都会造成连续区段空间越来越少。因此,将新文件写入具有不连续区块的可用空间的磁盘时,如果没有足以容纳该文件的数据的连续可用空间区域,就会将该文件分段写入,也就是不连续地存放。However, once the disk is used for a long time, the usable continuous segment space will become less and less, because when the file is accessed, it will try to find the space of the continuous segment in the disk to store, data modification, copy, Deleting and moving, etc., will result in less and less continuous segment space. Therefore, when a new file is written into a disk with free space of discontinuous blocks, if there is no continuous free space area enough to accommodate the data of the file, the file will be written in segments, that is, it will be stored discontinuously.
当组成某个文件的数据在磁盘上的存放位置不连续时,该文件便是一个分散的文件,分散成数个文件片段,每个文件片段则是指含有该文件部分数据的一段连续的区段。磁盘上的数据若是被拆散成一个个片段,读取这些数据所花的时间比读取连续数据所花的时间要多,因为它需要磁盘驱动器的读取/写入磁头移动更多次,不连续也会阻碍已删除文件的复原。When the storage locations of the data that make up a certain file are not continuous on the disk, the file is a scattered file, which is divided into several file fragments, and each file fragment refers to a continuous area containing part of the data of the file. part. If the data on the disk is broken into pieces, it takes more time to read the data than to read the continuous data because it requires the disk drive's read/write head to move more times. Continuous also prevents the restoration of deleted files.
但是,目前只有少数软件提供磁盘碎片的相关信息,而且大部分计算磁盘碎片率都需要花费相当长的时间,不方便使用者了解,甚至因为太花费时间,而使得多数使用者不愿意去执行,使得磁盘内的文件处理及存取效率相当低。However, currently only a few software provide information about disk fragmentation, and most of the calculations of disk fragmentation rate take a long time, which is inconvenient for users to understand, and even most users are unwilling to execute it because it takes too much time. The file processing and access efficiency in the disk is quite low.
发明内容Contents of the invention
本发明乃为解决上述问题而提供一种计算磁盘碎片率的方法及系统,可快速计算出磁盘碎片率,随时提供使用者磁盘碎片的信息。The present invention provides a method and system for calculating the disk fragmentation rate to solve the above problems, which can quickly calculate the disk fragmentation rate and provide users with disk fragmentation information at any time.
本发明的计算磁盘碎片率的系统,包含有一定位模块、一横贯模块以及一计算模块,由定位模块取得文件配置表的起始位置以及长度,并由连接于该定位模块的横贯模块按顺序对每一簇进行判断,判断其是否具有文件结束标志;判断该簇的接续片段指向非相邻之簇;确认该簇为不连续的簇,由此来判断簇的连续性,而累加出不连续簇的总数,再利用计算模块根据该数值加以计算,即可得到磁盘碎片率,其中所述磁盘的碎片率由将该不连续簇的总数除以簇总数而得到,而所述簇总数由该文件配置表的长度除以每一簇的长度而得到。The system for calculating the disk fragmentation rate of the present invention includes a positioning module, a traversing module and a calculation module, the initial position and length of the file configuration table are obtained by the positioning module, and the traversing module connected to the positioning module sequentially Each cluster is judged to determine whether it has an end-of-file flag; it is judged that the continuation segment of the cluster points to a non-adjacent cluster; it is confirmed that the cluster is a discontinuous cluster, and thus the continuity of the cluster is judged, and the discontinuity is accumulated The total number of clusters can be calculated according to the value by the calculation module to obtain the fragmentation rate of the disk, wherein the fragmentation rate of the disk is obtained by dividing the total number of discontinuous clusters by the total number of clusters, and the total number of clusters is obtained by dividing the total number of clusters by the total number of clusters. It is obtained by dividing the length of the file configuration table by the length of each cluster.
另一方面,按照本发明的计算磁盘碎片率的方法,首先取得文件配置表之起始位置以及长度,接着按顺序判断文件配置表中每一簇的连续性,判断其是否具有文件结束标志;判断该簇的接续片段指向非相邻之簇;以及确认该簇为不连续的簇,并累加出不连续簇的总数,最后将不连续簇的总数除以簇总数,即可得到磁盘碎片率,其中所述簇总数由该文件配置表的长度除以所述每一簇之长度而得到。On the other hand, according to the method for calculating the disk fragmentation rate of the present invention, at first obtain the starting position and the length of the file configuration table, then judge the continuity of each cluster in the file configuration table in order, and judge whether it has a file end mark; Judging that the continuous segment of the cluster points to a non-adjacent cluster; and confirming that the cluster is a discontinuous cluster, and adding up the total number of discontinuous clusters, and finally dividing the total number of discontinuous clusters by the total number of clusters to obtain the disk fragmentation rate , wherein the total number of clusters is obtained by dividing the length of the file configuration table by the length of each cluster.
按照本发明的计算磁盘碎片率的方法及系统,可快速得到磁盘的碎片率,随时对使用者提供磁盘碎片的信息,在磁盘碎片率过高时,对磁盘进行重整,而提高磁盘读取速度,进而增进程序的执行速度。According to the method and system for calculating the disk fragmentation rate of the present invention, the disk fragmentation rate can be quickly obtained, and the information of the disk fragmentation can be provided to the user at any time. speed, thereby increasing the execution speed of the program.
附图说明Description of drawings
图1为本发明的计算磁盘碎片率的方法的步骤流程示意图;Fig. 1 is a schematic flow chart of the steps of the method for calculating the disk fragmentation rate of the present invention;
图2为本发明的计算磁盘碎片率的系统构成示意图;Fig. 2 is a schematic diagram of the system composition of the calculation disk fragmentation rate of the present invention;
图3为本发明的计算磁盘碎片率的系统的定位模块运作步骤流程示意图;3 is a schematic flow chart of the operating steps of the location module of the system for calculating the disk fragmentation rate of the present invention;
图4为本发明的计算磁盘碎片率的系统的横贯模块运作步骤流程示意图;以及4 is a schematic flow chart of the operating steps across modules of the system for calculating the disk fragmentation rate of the present invention; and
图5为本发明的计算磁盘碎片率的系统的计算模块运作步骤流程示意图。FIG. 5 is a schematic flowchart of the operation steps of the calculation module of the system for calculating the disk fragmentation rate of the present invention.
为对本发明的目的、构造特征及其功能有进一步的了解,以下结合附图详细说明本发明的具体实施方式。In order to have a further understanding of the purpose, structural features and functions of the present invention, the specific embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.
具体实施方式Detailed ways
参照图1,按照本发明的计算磁盘碎片率的方法,首先取得文件配置表的起始位置以及长度(步骤101),而可取得每一个簇的地址,接着按顺序判断每一个簇的连续性(步骤102),并累加不连续簇数(步骤103),而可计算出磁盘碎片率(步骤104)。With reference to Fig. 1, according to the method for calculating the disk fragmentation rate of the present invention, at first obtain the starting position and the length (step 101) of the file configuration table, and can obtain the address of each cluster, then judge the continuity of each cluster in order (step 102), and accumulate the number of discontinuous clusters (step 103), and the disk fragmentation rate can be calculated (step 104).
如图2所示,按照本发明的计算磁盘碎片率的系统包含有一定位模块22、一横贯模块24以及一计算模块26。定位模块22用来定位文件配置表起始位置;横贯模块24连接于该定位模块22,用以判断该文件配置表之簇的连续性,并加以累加得到不连续簇的总数;计算模块26连接该横贯模块24,可取得该不连续簇的总数,并由该数值计算出该磁盘的碎片率。详细运作流程描述如下。As shown in FIG. 2 , the system for calculating disk fragmentation rate according to the present invention includes a
首先,如图3所示,利用定位模块22取得磁盘的基本输入输出单元参数区块(步骤301),接着分析基本输入输出单元参数区块之数据(步骤302),而得到文件配置表的起始位置以及长度(步骤303)。At first, as shown in Figure 3, utilize
接着,如图4所示,利用横贯模块24依据所得到的文件配置表的起始位置以及长度,对文件配置表进行横贯。首先,将不连续的簇数设为零(步骤401),取得文件配置表的第一个簇(步骤402),判断是否具有文件的结束标志(步骤403),如果是,则直接跳到步骤406,表示该簇的数据为连续。否则,判断文件接续片段是否指向相邻的簇(步骤404),如果是,则直接跳到步骤406,表示该簇的数据为连续。如否,表示该簇的数据为不连续,则不连续簇数加一(步骤405),接着判断是否为最后一个簇(步骤406),如果不是,则取出下一个簇(步骤407),继续判断,一直到所有簇判断完为止,而得到不连续簇的总数(步骤408)。如此,横贯一次文件配置表即可巧妙地得到不连续簇的总数,因而可相当快速计算出磁盘的碎片率。Next, as shown in FIG. 4 , the
最后,利用计算模块26计算出磁盘的碎片率,如图5所示,首先计算出簇总数(步骤501),藉由将文件配置表的总长度除以一个簇的长度即可得到(两个数据皆在前述定位模块22定位时可得到),接着将不连续簇的总数除以簇总数,即可得到磁盘碎片率(步骤502)。Finally, utilize
以上详细描述了本发明的具体实施方式,并非用来限定本发明的实施范围;即凡依本发明权利要求范围所作的等同变化与修改,皆为本发明权利要求范围所涵盖。The specific implementation of the present invention has been described in detail above, which is not intended to limit the implementation scope of the present invention; that is, all equivalent changes and modifications made according to the scope of the claims of the present invention are covered by the scope of the claims of the present invention.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 01139859 CN1211798C (en) | 2001-12-03 | 2001-12-03 | Method and system for calculating disk fragmentation rate |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN 01139859 CN1211798C (en) | 2001-12-03 | 2001-12-03 | Method and system for calculating disk fragmentation rate |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1423271A CN1423271A (en) | 2003-06-11 |
| CN1211798C true CN1211798C (en) | 2005-07-20 |
Family
ID=4675471
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN 01139859 Expired - Fee Related CN1211798C (en) | 2001-12-03 | 2001-12-03 | Method and system for calculating disk fragmentation rate |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1211798C (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070226445A1 (en) * | 2006-03-22 | 2007-09-27 | Tony Nichols | Method and system for rapid data-fragmentation analysis of a file-allocation-table (FAT) file system |
| US8190868B2 (en) | 2006-08-07 | 2012-05-29 | Webroot Inc. | Malware management through kernel detection |
| CN107766370A (en) * | 2016-08-19 | 2018-03-06 | 华为技术有限公司 | A kind of file fragmentation appraisal procedure and terminal |
| CN114327296A (en) * | 2021-12-31 | 2022-04-12 | 珠海豹好玩科技有限公司 | Intelligent disk fragment analysis method and device and electronic equipment |
-
2001
- 2001-12-03 CN CN 01139859 patent/CN1211798C/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| CN1423271A (en) | 2003-06-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5734861A (en) | Log-structured disk array with garbage collection regrouping of tracks to preserve seek affinity | |
| US5802344A (en) | Method and apparatus for dynamic segment allocation in log structured arrays | |
| US5808821A (en) | Method for eliminating file fragmentation and reducing average seek times in a magnetic disk media environment | |
| US7409522B1 (en) | Method and system for reallocating data in a file system | |
| US7610434B2 (en) | File recording apparatus | |
| US5890205A (en) | Optimized application installation using disk block relocation | |
| JP4749255B2 (en) | Storage system control device having multiple types of storage devices | |
| US5933840A (en) | Garbage collection in log-structured information storage systems using age threshold selection of segments | |
| KR100324867B1 (en) | Method and apparatus for allocation of disk memory space for compressed data records | |
| WO2007109706A2 (en) | Method and system for rapid data-fragmentation analysis of a new technology file system (ntfs) | |
| US7325112B2 (en) | High-speed snapshot method | |
| US7822931B2 (en) | File storage device, host apparatus, method for formatting nonvolatile semiconductor memory, and method of writing data in nonvolatile semiconductor memory | |
| WO2007109705A2 (en) | Method and system for rapid data-fragmentation analysis of a file-allocation-table (fat) file system | |
| CN101331463A (en) | Optimizing write and wear performance of memory | |
| WO2006027771A2 (en) | Measuring fragmentation on direct access storage devices and defragmentation thereof | |
| CN1684049A (en) | Information storage device, information storage method, and information storage processing program product | |
| CN1211798C (en) | Method and system for calculating disk fragmentation rate | |
| US7350049B1 (en) | Method and apparatus for managing access to a file allocation table | |
| CN116795799A (en) | Automatic defragmentation method for hard disk files, computer equipment and storage medium | |
| CN1271522C (en) | A linear file accessing method | |
| TW517208B (en) | Method and system for calculating fragment rate of disk | |
| US20050027934A1 (en) | Disk fragmentation test system | |
| JPH08314639A (en) | Information recording / reproducing device | |
| CN111324584A (en) | Management method of computer file system | |
| CN116225339B (en) | Computer information storage analysis system and method based on Internet of things |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| C17 | Cessation of patent right | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20050720 Termination date: 20101203 |