TW517208B - Method and system for calculating fragment rate of disk - Google Patents
Method and system for calculating fragment rate of disk Download PDFInfo
- Publication number
- TW517208B TW517208B TW90117985A TW90117985A TW517208B TW 517208 B TW517208 B TW 517208B TW 90117985 A TW90117985 A TW 90117985A TW 90117985 A TW90117985 A TW 90117985A TW 517208 B TW517208 B TW 517208B
- Authority
- TW
- Taiwan
- Prior art keywords
- disk
- cluster
- clusters
- calculating
- file
- Prior art date
Links
Abstract
Description
517208 五、發明說明α) 【發明領域】 本發明係有關於一種計算磁碟碎裂率的方法及系統, 特別是一種利用檔案配置表來快速計算出磁碟碎裂率的方 法與系統。 【發明背景】 磁碟上的資料儲存空間會被分為複數個相連且個別的 單位,稱之為為配置單位 (allocation unit)或是叢集 (cluster)。而將檔案寫入磁碟時,它們會碎裂成叢集大 小的不連續區塊,當檔案的所有區塊都位在相鄰近或連續 的叢集時,就可以快速地存取該檔案,因為所有的資訊都 在同一個地方。 但是一個磁碟使用久了,可使用的連續區段空間會變 的越來越少,因為檔案於存取時,都會儘量在磁碟中找尋 連續區段的空間來存放,但是時間久了 ,資料的修改、複 製、刪除以及移動等等,都會造成連續區段空間越來越 小。因此,將新檔案寫入具有不連續區塊之可用空間的磁 碟時,如果沒有足以容納該檔案之資料的單一可用空間區 域,就會立刻將該檔案碎裂(F ragment),也就是不連續 的存放。 當組成某個檔案的資料在磁碟上的存放位置不連續 時:該檔案便是一個分散的檔案,分散成數個檔案片段, 每個檔案片段則是指含有該檔案部份資料的一些位置連續 的。磁碟上的資料若是被拆散成一個片段一個片段,讀取 這些資料所花的時間比讀取連續資料所花的時間要來的517208 V. Description of the invention α) [Field of the invention] The present invention relates to a method and a system for calculating the fragmentation rate of a magnetic disk, particularly a method and a system for quickly calculating the fragmentation rate of a magnetic disk by using a file configuration table. [Background of the Invention] The data storage space on the magnetic disk is divided into a plurality of connected and individual units, which is called an allocation unit or a cluster. When files are written to disk, they will break into cluster-sized discontinuous blocks. When all blocks of a file are located in adjacent or continuous clusters, the file can be quickly accessed because all Information is all in the same place. However, if a disk has been used for a long time, the available continuous sector space will become less and less, because when the file is accessed, it will try to find the continuous sector space on the disk to store it, but it ’s been a long time. Modification, copying, deletion, and movement of data will cause the continuous section space to become smaller and smaller. Therefore, when a new file is written to a disk with free space of discontinuous blocks, if there is not a single free space area sufficient to hold the data of the file, the file will be fragmented immediately, that is, Continuous storage. When the storage positions of the data that make up a file are discontinuous on the disk: the file is a scattered file, dispersed into several file fragments, and each file fragment refers to some locations that contain part of the data of the file are continuous of. If the data on the disk is fragmented into fragments, it takes longer to read the data than to read the continuous data.
!!
IIII
fB 1fB 1
517208 五、發明說明(2) 多,因為它需要在磁碟機的讀取/寫入磁頭移動更多次, 不連續也會阻礙已刪除檔案的復原。 但是,目前只有少數軟體提供磁碟碎裂的相關資訊, 而且大部分計算磁碟碎裂率都需要花費相當長的時間,不 方便使用者暸解,甚至因為太花費時間,而使得多數使用 者不願意去執行,使得磁碟内的檔案處理及存取相當沒有 效率。 【發明之目的及概述】 本發明乃為解決上述問題而提供一種計算磁碟碎裂率 的方法及系統,係可快速計算出磁碟碎裂率,隨時提供使 用者磁碟碎裂的資訊。 根據本發明所揭露的計算磁碟碎裂率的系統,係包含 有一定位模組、一橫貫(t r a v e r s e)模組以及一計算模 組,藉由定位模組取得檔案配置表(FAT)的起始位址以 及長度,並由連接於定位模組的橫貫模組依序對每一叢集 進行判斷,藉由判斷其是否具有檔案結束標示以及接續片 段指向相鄰區域,來判斷叢集的連續性,而累加出不連續 的叢集總數,再利用計算模組根據該數值加以計算,即可 得到磁碟碎裂率。 另一方面,本發明之計算磁碟碎裂率的方法,首先取 得檔案配置表之起始位址以及長度,接著依序判斷檔案配 置表中每一叢集之連續性,利用判斷其是否具有檔案結束 標示以及接續片段指向相鄰區域,並累加不連續之叢集總 數,最後將不連續的叢集總數除以叢集總數,即可得到磁517208 V. Description of the invention (2) is more, because it needs to move the read / write head of the disk drive more times. Discontinuities will also hinder the recovery of deleted files. However, at present, only a few softwares provide information about disk fragmentation, and most of them take a long time to calculate the disk fragmentation rate, which is inconvenient for users to understand, and even because it takes too much time, most users are not The willingness to execute it makes file processing and access on the disk quite inefficient. [Objective and Summary of the Invention] The present invention is to provide a method and system for calculating the disk fragmentation rate in order to solve the above problems. The method can quickly calculate the disk fragmentation rate and provide users with information on the disk fragmentation at any time. The system for calculating the disk fragmentation rate disclosed in the present invention includes a positioning module, a traverse module, and a computing module. The positioning module obtains the start of the file allocation table (FAT). Address and length, and each cluster is judged sequentially by the traverse module connected to the positioning module, and the continuity of the cluster is judged by judging whether it has the end-of-file mark and the consecutive segments pointing to adjacent areas, and The total number of discontinuous clusters is accumulated and calculated by the calculation module according to the value, and the disk fragmentation rate can be obtained. On the other hand, the method for calculating the disk fragmentation rate of the present invention first obtains the start address and length of the file allocation table, and then sequentially judges the continuity of each cluster in the file allocation table, and determines whether it has a file by using The end labeling and subsequent segments point to adjacent areas, and accumulate the total number of discontinuous clusters. Finally, divide the total number of discontinuous clusters by the total number of clusters to obtain the magnetic field.
517208 五、發明說明(3) 碟碎裂率。 為使對本發明的目的、構造特徵及其功能有進一步的 了解,茲配合圖示詳細說明如下: 【實施例詳細說明】 根據本發明所揭露的計算磁碟碎裂率的方法及系統, 請參閱「第1圖」,首先取得檔案配置表(F i 1 e Allocation Table; FAT)的起始位址以及長度(步驟101 ),而可取得每一個叢集的位址,接著依序判斷每一個叢 集的連續性(步驟1 0 2),並累加不連續的叢集數(步驟 1 0 3),而可計算出磁碟碎裂率(步驟1 0 4)。 本發明之系統包含有一定位模組2 2、一橫貫 (traverse)模組2 4以及一計算模組2 6,如「第2圖」所 示,定位模組2 2負責一檔案配置表起迄位置的定位工作; 橫貫模組2 4連接於該定位模組2 2,用以判斷該檔案配置表 之叢集的連續性,並加以累加得到不連續之叢集總數;計 算模組2 6連接該橫貫模組2 4,可取得該不連續之叢集總 數,並藉由該數值計算出該磁碟的破碎率。詳細之執行流 程如下所述。 首先,如「第3圖」所示,利用定位模組2 2取得磁碟 的基本輸入輸出單元參數區塊(BISO Parameter Block; BPB)(步驟301),接著分析基本輸入輸出單元參數區塊 之資料(步驟3 0 2),而得到檔案配置表的起始位址以及 長度(步驟3ϋ3)。 接著,如「第4圖」所示,利用橫貫模組2 4依據所得517208 V. Description of the invention (3) Fracture rate of the disc. In order to further understand the purpose, structural features, and functions of the present invention, the following detailed description is given with reference to the drawings: [Detailed description of the embodiment] The method and system for calculating the disk fragmentation rate disclosed in the present invention, please refer to "Figure 1", first obtain the starting address and length of the file allocation table (F i 1 e Allocation Table; FAT) (step 101), and obtain the address of each cluster, and then determine each cluster in order (Step 10 2), and accumulate the number of discontinuous clusters (step 103), and the disk fragmentation rate can be calculated (step 104). The system of the present invention includes a positioning module 2 2, a traverse module 24, and a computing module 26. As shown in "Figure 2", the positioning module 22 is responsible for a file configuration table. Position positioning work; Transverse module 2 4 is connected to the positioning module 22 to determine the continuity of the clusters of the file configuration table and add up to obtain the total number of discontinuous clusters; the calculation module 2 6 is connected to the transverse Module 24 can obtain the total number of discontinuous clusters, and calculate the fragmentation rate of the disk based on the value. The detailed execution process is as follows. First, as shown in "Figure 3", the positioning module 22 is used to obtain the basic input and output unit parameter block (BPB) of the disk (step 301), and then the basic input and output unit parameter block is analyzed. Data (step 3 2), and get the start address and length of the file configuration table (step 3ϋ3). Next, as shown in "Figure 4", use the trans module 2 4
517208 五、發明說明(4) 到的檔案配置表的起始位址以及長度,對檔案配置表進行 橫貫。首先,將不連續的叢集數設為零(步驟4 0 1),取 得檔案配置表的第一個叢集(步驟4 0 2),判斷是否具有 檔案的結束標示(步驟4 0 3),如是,則直接跳到步驟 4 0 6,表示該叢集所存的資料為連續。如否,則判斷檔案 接續片段是否指向相鄰的叢集(步驟4 0 4),如是,貝1直 接跳到步驟4 0 6,表示該叢集所存的資料為連續。如否, 表示該叢集所存的資料為不連續,則不連續的叢集數加一 (步驟4 0 5),接著判斷是否為最後一個叢集(步驟4 0 6 ),如果不是,則取出下一個叢集(步驟4 0 7),繼續判 斷,一直到所有叢集判斷完,而得到不連續的叢集總數 (步驟4 0 8)。如此,利用橫貫一次檔案配置表,即可巧 妙的得到不連續的叢集總數,因而可相當快速計算出磁碟 的碎裂率。 最後,利用計算模組2 6計算出磁碟的碎裂率,如「第 5圖」所示,首先計算出叢集總數(步驟5 0 1 ),藉由將檔 案配置表的總長度除以一個叢集的長度即可得到(兩個數 據皆在前述定位模組2 2時可得到),接著將不連續的叢集 總數除以叢集總數,即可得到磁碟碎裂率(步驟5 0 2)。 【達成之功效】 本發明為一種計算磁碟碎裂率的方法及系統,利用取 得檔案配置表之起始位址以及長度,接著依序判斷檔案配 置表中每一叢集之連續性,利用判斷其是否具有檔案結束 標示以及接續片段指向相鄰區域,並累加不連續之叢集總517208 V. Description of the invention (4) Traversing the file configuration table to the start address and length of the file configuration table. First, set the number of discontinuous clusters to zero (step 401), obtain the first cluster of the file allocation table (step 402), and determine whether there is an end mark of the file (step 403). If so, Then skip directly to step 406, indicating that the data stored in the cluster is continuous. If not, determine whether the file's subsequent segments point to adjacent clusters (step 404). If so, Bay 1 skips directly to step 406, indicating that the data stored in the cluster is continuous. If not, it indicates that the data stored in the cluster is discontinuous, then the number of discontinuous clusters is increased by one (step 405), and then it is determined whether it is the last cluster (step 406). If not, the next cluster is taken out. (Step 4 0 7), continue to judge until all clusters are judged, and get the total number of discontinuous clusters (Step 4 8). In this way, by traversing the file allocation table once, the total number of discontinuous clusters can be cleverly obtained, so the disk fragmentation rate can be calculated fairly quickly. Finally, use the calculation module 26 to calculate the fragmentation rate of the disk. As shown in "Figure 5", first calculate the total number of clusters (step 501). Divide the total length of the file allocation table by one The cluster length can be obtained (both data can be obtained in the aforementioned positioning module 22), and then the total number of discontinuous clusters can be divided by the total number of clusters to obtain the disk fragmentation rate (step 5 0 2). [Achieved effect] The present invention is a method and a system for calculating the fragmentation rate of a magnetic disk. The starting address and length of the file allocation table are obtained, and then the continuity of each cluster in the file allocation table is sequentially judged. Does it have an end-of-file flag and the consecutive segments point to adjacent areas and accumulate discontinuous clusters
517208 五、發明說明(5) 數,最後將不連續的叢集總數除以叢集總數,即可得到磁 碟碎裂率。如此,可快速得到磁碟的碎裂率,隨時提供使 用者磁碟碎裂的資訊,可於磁碟碎裂率過高時,對磁碟進 行重整,而提供磁碟讀取速度,進而增進程式的執行速 度。 以上所述者,僅為本發明其中的較佳實施例而已,並 非用來限定本發明的實施範圍;即凡依本發明申請專利範 圍所作的均等變化與修飾,皆為本發明專利範圍所涵蓋。 ( (517208 V. Description of the invention (5). Finally, divide the total number of discontinuous clusters by the total number of clusters to get the disk fragmentation rate. In this way, the fragmentation rate of the disk can be quickly obtained, and the user's disk fragmentation information can be provided at any time. When the fragmentation rate of the disk is too high, the disk can be reformed to provide the disk read speed, and Improve program execution speed. The above are only the preferred embodiments of the present invention, and are not intended to limit the scope of the present invention; that is, all equivalent changes and modifications made in accordance with the scope of the patent application for the present invention are covered by the scope of the patent for the present invention. . ((
第8頁 圖; 流程示意圖; 流程示意圖;以及 流程示意圖。 2 4 2 6 517208 圖式簡單說明 第1圖為本發明步驟流程之示意 第2圖為本發明功能模組示意圖 第3圖為本發明定位模組之步驟 第4圖為本發明橫貫模組之步驟 第5圖為本發明計算模組之步驟 【圖式符號說明】 定位模組 橫貫模組 計算模組Figure 8; process flow diagram; process flow diagram; and process flow diagram. 2 4 2 6 517208 Brief description of the drawings. Figure 1 is a schematic diagram of the steps and procedures of the present invention. Figure 2 is a schematic diagram of the functional modules of the present invention. Figure 3 is a step of the positioning module of the present invention. Figure 4 is a transverse module of the present invention. Step 5: This is the step of the calculation module of the present invention. [Illustration of symbolic symbols] Positioning module Transverse module calculation module
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW90117985A TW517208B (en) | 2001-07-24 | 2001-07-24 | Method and system for calculating fragment rate of disk |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW90117985A TW517208B (en) | 2001-07-24 | 2001-07-24 | Method and system for calculating fragment rate of disk |
Publications (1)
Publication Number | Publication Date |
---|---|
TW517208B true TW517208B (en) | 2003-01-11 |
Family
ID=27801476
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW90117985A TW517208B (en) | 2001-07-24 | 2001-07-24 | Method and system for calculating fragment rate of disk |
Country Status (1)
Country | Link |
---|---|
TW (1) | TW517208B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2007109705A3 (en) * | 2006-03-22 | 2008-01-17 | Webroot Software Inc | Method and system for rapid data-fragmentation analysis of a file-allocation-table (fat) file system |
-
2001
- 2001-07-24 TW TW90117985A patent/TW517208B/en not_active IP Right Cessation
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2007109705A3 (en) * | 2006-03-22 | 2008-01-17 | Webroot Software Inc | Method and system for rapid data-fragmentation analysis of a file-allocation-table (fat) file system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100378686C (en) | Disk device and control method for cache | |
US9753659B2 (en) | Generating enumerated information in which a plurality of files are enumerated in a sequential medium | |
US8051115B2 (en) | Measuring fragmentation on direct access storage devices and defragmentation thereof | |
CN102171649B (en) | Method and system for queuing transfers of multiple non-contiguous address ranges with a single command | |
US20130290601A1 (en) | Linux i/o scheduler for solid-state drives | |
US20050033930A1 (en) | High-speed snapshot method | |
JP3250861B2 (en) | Disk device system | |
US20040148476A1 (en) | Performance-predicated automatic defragmentation of hard disks, particularly for non-pc mobile digital devices including music recorder/players | |
US6931501B1 (en) | Method and apparatus for merging contiguous like commands | |
JP3113353B2 (en) | Rotating memory system | |
TW517208B (en) | Method and system for calculating fragment rate of disk | |
JP2006313531A (en) | File management system | |
JPWO2013046342A1 (en) | Virtual tape device and control method of virtual tape device | |
WO2016029481A1 (en) | Method and device for isolating disk regions | |
JP3093657B2 (en) | FBA-CKD conversion method | |
JPH1011337A (en) | Method for controlling data in storage device | |
CN111324584A (en) | Management method of computer file system | |
US7552299B2 (en) | Data-processing apparatus, data-processing method and program | |
JPH09223049A (en) | Disk array system | |
KR20030061948A (en) | : Apparatus storing information and method for controlling the File using its | |
WO2000048068A1 (en) | Magnetic disk device and disk access method therefor | |
JPH0566975A (en) | File rearrangement control system | |
JP2008009688A (en) | Data access system, data access program, and data access method | |
JP2002230940A (en) | Dvd-ram backup server, system, and program | |
JPH09293007A (en) | Program install device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
GD4A | Issue of patent certificate for granted invention patent | ||
MM4A | Annulment or lapse of patent due to non-payment of fees |