《操作系统20140424lecture17fsinstances》由会员分享,可在线阅读,更多相关《操作系统20140424lecture17fsinstances(88页珍藏版)》请在金锄头文库上搜索。
1、Operating Systems,Department of Computer Science & Technology Tsinghua University,Lecture 17: File System Instances,Outline,FAT FAT Volume File Allocation System Filenames on FAT Volumes Linux ext2/ext3 NTFS ZFS,File Allocation Table (FAT),The File Allocation Table (FAT) file system is a simple file
2、 system originally designed for small disks and simple folder structures. The FAT file system is named for its method of organization, the file allocation table, which resides at the beginning of the volume. To protect the volume, two copies of the table are kept, in case one becomes damaged. In add
3、ition, the file allocation tables and the root folder must be stored in a fixed location so that the files needed to start the system can be correctly located.,Structure of a FAT Volume,Boot sector FAT1 FAT2 Root directory Other directories and all files,Differences Between FAT Systems,FAT32 Feature
4、s,FAT32 is a derivative of the File Allocation Table (FAT) file system that supports drives with over 2GB of storage. Because FAT32 drives can contain more than 65,526 clusters, smaller clusters are used than on large FAT16 drives. This method results in more efficient space allocation on the FAT32
5、drive.,File Allocation System,The file allocation table contains the following types of information about each cluster on the volume (see example below for FAT16): Unused (0x0000) Cluster in use by a file Bad cluster (0xFFF7) Last cluster in a file (0xFFF8-0xFFFF),Example of File Allocation Table,FA
6、T Root Folder,The root folder contains an entry for each file and folder on the root. The only difference between the root folder and other folders is that the root folder is on a specified location on the disk and has a fixed size (512 entries for a hard disk, number of entries on a floppy disk dep
7、ends on the size of the disk).,Folder Entry,The Folder Entry includes the following information: Name (eight-plus-three characters) Attribute byte (8 bits worth of information, described later in this section) Create time (24 bits) Create date (16 bits) Last access date (16 bits) Last modified time
8、(16 bits) Last modified date (16 bits.) Starting cluster number in the file allocation table (16 bits) File size (32 bits),Outline,FAT FAT Volume File Allocation System Filenames on FAT Volumes Linux ext2/ext3 NTFS ZFS,Filenames on FAT Volumes,FAT creates an eight-plus-three name for the file. In ad
9、dition to this conventional entry. FAT creates one or more secondary folder entries for the file, one for each 13 characters in the long filename. Each of these secondary folder entries stores a corresponding part of the long filename in Unicode. FAT sets the volume, read-only, system, and hidden fi
10、le attribute bits of the secondary folder entry to mark it as part of a long filename.,Folder Entries for the long filename,Below shows all of the folder entries for the file Thequi1.fox, which has a long name of The quick brown.fox. The long name is in Unicode, so each character in the name uses tw
11、o bytes in the folder entry. The attribute field for the long name entries has the value 0x0F. The attribute field for the short name is 0x20,Filenames on FAT Volumes,Outline,FAT Linux ext2/ext3 Ext2 Features Ext2 Disk Data Structures Ext2 Memory Data Structures Journaling in Ext3 NTFS ZFS,Ext2 fs,T
12、he Second Extended Filesystem (Ext2) was introduced in 1994; besides including several new features , it is quite efficient and robust and is, together with its offspring Ext3, the most widely used Linux filesystem. The first versions of Linux were based on the MINIX filesystem. As Linux matured, th
13、e Extended Filesystem (Ext FS) was introduced; it included several significant extensions, but offered unsatisfactory performance.,Ext2 Features,When creating an Ext2 filesystem, the system administrator may choose the optimal block size (from 1,024 to 4,096 bytes), depending on the expected average
14、 file length. When creating an Ext2 filesystem, the system administrator may choose how many inodes to allow for a partition of a given size, depending on the expected number of files to be stored on it. This maximizes the effectively usable disk space.,Ext2 Features (cont.),The filesystem partition
15、s disk blocks into groups. Each group includes data blocks and inodes stored in adjacent tracks. Thanks to this structure, files stored in a single block group can be accessed with a lower average disk seek time. The filesystem preallocates disk data blocks to regular files before they are actually
16、used. Thus, when the file increases in size, several blocks are already reserved at physically adjacent positions, reducing file fragmentation.,Ext2 Features (cont.),Fast symbolic links are supported. If the symbolic link represents a short pathname (at most 60 characters), it can be stored in the inode and can thus be translated without reading a data block.,Outline,FAT Linux ext2/ext3 Ext2 Features Ext2 Disk Data Structures Ext2 Memory Data Structures Journaling in Ext3 NTFS ZFS,E