Principle of FAT file system 3

4.3 FAT tables and data storage principles.

       Table FAT (File Allocation Table file allocation table), is a chain structure for Microsoft Disk data (files) indexing and positioning the introduction of the FAT file system. If the disk compared to a book, FAT table book can be considered equivalent to a directory, and the file is the content of each chapter. But representation FAT tables and directories, but are very different. 
      In the FAT file system, the file is stored in accordance with the cluster chain data structure developed for the FAT table. Meanwhile, FAT file system directory will also be used to organize data abstraction as a file, to simplify data management.

 ★ stored procedure hypothetical: 
      we simulated data is stored on a partition process to illustrate the principles of the FAT file system to store data. 
      Suppose now that there is a completely empty disk to store data, the size of 100KB, we think of it as a linear address space. In order to facilitate storage management, we artificially 100KB of space these are divided into 100 parts, each 1KB. Let's turn this store several files: A.TXT (size 10KB), B.TXT (size 53.6KB), C.TXT (size 20.5KB). 
      At least be able to think that we can store the order in which these three files 100KB space. And do not forget, we have to note the beginning of their size and location, so the next time you want to use in order to find, it's like directories. To facilitate the search, we assume that with the first 1K of space to store their characteristics (attributes). Also, we design the storage unit is 1KB, therefore, A.TXT we need 10 storage units (for convenience of explanation, we put storage units called "clusters" it. RBI also little word, huh.), B.TXT need 54 clusters, C.TXT need 21 clusters. Some may say B.TXT and C.TXT not less than one cluster each wasted space? Why not let them next, not provincial place? My answer is, if stored in such a way, the original directory need only note the cluster number, and now need to remember offsets within a cluster, this will increase the amount of storage directory, and no access rules, read is not very convenient, is not worth the candle. 
    According to the above-mentioned ideas, we have designed such a storage shown in Fig 4.3.1.

      We then consider how to write these three files directory. For each document, must be recorded are: file name, starting cluster, size, creation date, time, modification date, time, file read and write attributes. Here ends the cluster size can not be used to calculate it? Must not, because the file size is not necessarily an integer number of cluster size, then is the content as the content of 54KB B.TXT Otherwise, the less of course not, may be more is not enough. So how do we record it? Imagine. In order to facilitate the management, we use a database management to manage our directory. So I 1KB further divided into 10 parts, assuming starting cluster number is 0, define the meaning of each representative of each location is shown in Figure 4.3.2 100B

      Such a structure can definitely designed for reading and writing files correctly. Then let us design a file system to work. First alter files, such as A.TXT, increase the point content! Huh? Where to put the increase in the country, although the back of the memory block has a lot of space, but followed B.TXT data also wore it? If the A.TXT moved behind a waste processing resources, and does not necessarily solve the problem. It seems to temporarily solve the problem. 
    Then we change operation, the B.txt deleted, b.txt space freed. This time the space shown in Figure 4.3.3, Figure 4.3.4 directory

      This operation also appears to be, then we do, in a file stored in D.txt (size 60.3KB), a total of 100 clusters in space only 31 clusters, as well as the remaining 68 clusters, supposedly able to put down. But? Where to put it? No 61 contiguous space, catalog no way to write a line, it seems that non-contiguous blocks stored temporarily not OK. 
    You must be able to think we can move in a continuous increase in the length of documents is not enough space or when our actions affect other files, thus freeing up space, but I want to ask you, that's not what it should not dry all day, that is something you shift ?

    It seems that we designed file system has a fatal flaw, how to solve it? . . . . 
. . . . . .

    In fact, it can be solved: 
    Firs

 
Domain name: www.mrtlab.com | | Telephone: +86-27-82621261
MRT data recovery website,provides professional HDD firmware repair and data recovery technical resources!
Copyright 2003-2014 Powered By MrtLab