【正文】
1 2022/8/18 操作系統(tǒng) 第四章 文件系統(tǒng) ?FAT文件系統(tǒng) ?NTFS文件系統(tǒng) ?Windows文件系統(tǒng)驅(qū)動程序( FSD) 知識是需要沉淀的;思想也是在不斷的學(xué)習(xí)、磨練中走向成熟的;而技術(shù)也是在不斷的創(chuàng)造中開拓的 2 2022/8/18 操作系統(tǒng) ?FAT( File Allocation Table,文件分配表)文件系統(tǒng)是為 DOS設(shè)計的文件系統(tǒng)。為了向后兼容,也為了方便用戶升級, Windows 仍然提供對 FAT的支持 ?每一種 FAT文件系統(tǒng)都用一個數(shù)字來標識磁盤上簇號的位數(shù)。 例如, FAT12的簇標識為 12位(二進制數(shù)),這限制了它的單個分區(qū)最多只能存儲 2 12( =4096)個簇,而 FAT 12在 Windows 2022/XP中的簇大小在 512B與 8KB之間,這意味著 FAT12卷的大小至多只有 32M。 ?FSD: \Winnt\System32\Drivers\ FAT文件系統(tǒng) 3 2022/8/18 操作系統(tǒng) 多級目錄,無用戶訪問權(quán)限控制 磁盤文件卷結(jié)構(gòu) FAT12與 FAT16 文件分配表1引導(dǎo)區(qū) 文件分配表2 根目錄 其 他 目 錄 和 文 件4 2022/8/18 操作系統(tǒng) ?文件卷 (volume)信息 :記錄在引導(dǎo)記錄的扇區(qū)中。包括:簇大小,根目錄項數(shù)目, FAT表大小,磁盤參數(shù)(每道扇區(qū)數(shù),磁頭數(shù)),文件卷中的扇區(qū)總數(shù),簇編號長度等 ?邏輯扇區(qū)號:三元組(柱面號,磁頭號,扇區(qū)號)- 一個文件卷中從 0開始對每個扇區(qū)編號,優(yōu)點:屏蔽了物理磁盤參數(shù)的不同 ?允許同時訪問的文件卷數(shù)目上限可以由 LASTDRIVE= 語句指定 ?簇 (cluster):由若干個扇區(qū)組成。在一個文件卷中從 0開始對每個簇編號。 FAT12與 FAT16 5 2022/8/18 操作系統(tǒng) FAT12/FAT16 Boot Sector/Boot Record Layout. Offset Length Field 00h 3 Machine code for jump over the data. 03h 8 OEM name string (of OS which formatted the disk). 0Bh 2 Bytes per sector, nearly always 512 but can be 1024,2048 or 4096. 0Dh 1 Sectors per cluster, valid number are: 1,2,4,8,16,32,64 and 128, but a cluster size larger than 32K should not occur. 0Eh 2 Reserved sectors (number of sectors before the first FAT including the boot sector), usually 1. 10h 1 Number of FAT39。s (nearly always 2). 11h 2 Maximum number of root directory entries. 13h 2 Total number of sectors (for small disks only, if the disk is too big this is set to 0 and offset 20h is used instead). 15h 1 Media descriptor byte, pretty meaningless now. 16h 2 Sectors per FAT. 18h 2 Sectors per track. 1Ah 2 Total number of heads/sides. 1Ch 4 Number of hidden sectors (those preceding the boot sector). 20h 4 Total number of sectors for large disks. 24h 26 Either extended BPB or machine code. 3Eh 448 Machine code. 1FEh 2 Boot Signature AA55h. FAT12與 FAT16 6 2022/8/18 操作系統(tǒng) ? 每個 FAT表項所占位數(shù)是 簇編號 的位數(shù),其值是(以 FAT12為例): ? 0:表示該簇空閑 ? FF7h:物理壞扇區(qū) ? FF8h~FFFh:表示該簇是文件的最后一個簇 ? 其他值:表示該簇被文件占用,而且表項中的值是文件下一個簇的編號。 FAT表 :兩個鏡像,互為備份。文件卷中的每個簇均對應(yīng)一個 FAT表項,文件分配采用鏈式分配方法。 文件A起始地址0000記錄0