Graduate Institute of Electronics Engineering, NTU Microsoft File System Microsoft File System Instructor: Chia-Tsun Wu. 11/25/2004 ACCESS IC LAB
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Outline Outline Types of File System Principles of File System Microsoft File System General Comments Boot Sector and BPB Boot Sector and BPB Structure FAT Data Structure LAB P2
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Types of FileSystem FileSystem Types of DOS FAT 12/16/32, VFAT High Performance FileSystem (HPFS) New Technology FileSystem (NTFS) Extended filesystems (Ext, Ext2, Ext3) Macintosh Hierarchical Filesystem - HFS ISO 9660 - CD-ROM filesystem P3
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Other filesystems filesystems Other ADFS - Acorn Disc File System NSS - Novell Storage Services AFFS - Amiga fast filesystem ODS - On Disk Structure filesystem BeFS - BeOS filesystem QNX filesystem BFS - UnixWare Boot Filesystem Reiser filesystem CrosStor filesystem RFS (CD - ROM Filesystem ) DTFS - Desktop filesystem RomFS - Rom filesystem EFS - Enhanced filesystem (Linux) SFS - Secure filesystem EFS - Extent filesystem (IRIX) Spiralog filesystem (OpenVMS) FFS - BSD Fast filesystem System V and derived filesystems GPFS - General Parallel Filesystem Text - (Philips' CD - ROM Filesystem ) HFS - HP - UX Hi performance filesystem UDF - Universal Disk Format (DVD - ROM filesystem ) HTFS - High throughput filesystem UFS LFS - Linux log structured filesystem V7 Filesystem JFS - Journaled filesystem (HP - UX, AIX, OS/2 5, Linux) VxFS - Veritas filesystem (HP - UX, SCO UnixWare, Solaris) MFS - Macintosh filesystem XFS - Extended filesystem (IRIX) Minix filesystem Xia FS NWFS - Novell NetWare filesystem P4
Graduate Institute of Electronics Engineering, NTU File- -System Structure System Structure File ACCESS IC LAB
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Introduction Introduction File structure Logical storage unit Collection of related information File system resides on secondary storage (disks) File system organized into layers File control block storage structure consisting of information about a file Ownership, permissions, and location of the file content I/O transfers between memory and disk are performed in units of blocks (one more more sectors) P6
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Layered File System Layered File System P7
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Layered File System (Cont.) Layered File System (Cont.) I/O control device drivers and interrupt handlers Transfer information between main memory and disk system Retrieve block 123 HW-specific instructions Basic file system Issue generic commands to device driver to read and write physical blocks on the disk Physical block: drive 1, cylinder 73, track 2, sector 10 P8
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Layered File System (Cont.) Layered File System (Cont.) File-organization module Know about files, their logical blocks, and physical blocks Translate logical blocks to physical blocks (similar to VM) Logical blocks: 0 N Free-space manager Blocks allocation Logical file system manage metadata information Metadata: file-system structure, excluding the actual file contents Manage the directory structure via file control blocks (FCB) P9
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Layered File System (Cont.) Layered File System (Cont.) Why Layered file system? All the advantages of the layered approach File system standard: UFS, FAT FAT32, NTFS Duplication of code is minimized for different file system standard Usually I/O control and the basic file system code can be used by multiple file system formats. P10
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU A Typical FCB A Typical FCB P11
Graduate Institute of Electronics Engineering, NTU File System Implementation File System Implementation ACCESS IC LAB
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU On- -Disk Structures Disk Structures On Boot control block: information needed by the system to boot an OS from that partition UFS: boot block; NTFS: partition boot sector Partition control block: partition details No. of blocks, size of the blocks, free-block count and free- block pointers, free FCB count and FCB pointers UFS: superblock; NTFS: Master File Table A directory structure is used to organize the files File control block: many of the file s details File permissions, ownership, size, location of the data blocks UFS: inode; NTFS: within the Master File Table P13
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU In- -Memory Structures Memory Structures In An in-memory partition table containing information about each mounted partition An in-memory directory structure that holds the directory information of recently accessed directories The system-wide open-file table (Chapter 11) The per-process open-file table (Chapter 11) Caching information so that no need to retrieve the information every time from the disk P14
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU In- -Memory File Memory File- -System Structures System Structures In File Open File Read P15
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Virtual File Systems Virtual File Systems Virtual File Systems (VFS) provide an object-oriented way of implementing file systems VFS separates file-system-generic operations from their implementation by defining a clean VFS interface VFS allows the same system call interface (the API) to be used for different types of file systems VFS is based on a file-representation structure, called a vnode , that contains a numerical designator for a network-wide unique file The API is to the VFS interface, rather than any specific type of file system P16
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Schematic View of Virtual File System Schematic View of Virtual File System Open, read, write P17
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Directory Implementation Directory Implementation Linear list of file names with pointer to the data blocks Simple to program Time-consuming to execute linear search to find a particular entry Cache and sorted list may help Hash Table linear list with hash data structure Decreases directory search time Collisions situations where two file names hash to the same location Fixed size and the dependence of the hash function on that size P18
Graduate Institute of Electronics Engineering, NTU Allocation Methods Allocation Methods How to allocate space to files so that disk space is utilized effectively and files can be accessed quickly ACCESS IC LAB
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Contiguous Allocation Contiguous Allocation A file occupies a set of contiguous blocks on disk Only starting block (block #) and length (number of blocks) are required in the directory entry (FCB) Fast -- Minimal seek time and head movement Random access any block within the file Similar to dynamic storage-allocation problem External fragmentation may need compaction Files are difficult to grow Find a larger hole and copy the file to the new space P20
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Contiguous Allocation (Cont.) Contiguous Allocation (Cont.) P21
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Extent- -Based Systems Based Systems Extent Many newer file systems (I.e. Veritas File System) use a modified contiguous allocation scheme Extent-based file systems allocate disk blocks in extents An extent is a contiguous block of disks. Extents are allocated for file allocation. A file consists of one or more extents. Integrate contiguous allocation and linked allocation (see later) P22
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Linked Allocation Linked Allocation Each file is a linked list of disk blocks Blocks may be scattered anywhere on the disk Directory contains a pointer to the first and last blocks Each block contains a pointer to the next block Advantages No external fragmentation Easy to grow Any free block is OK Disadvantages Effectively for only sequential-access file Space required for the pointers Reliability What if the pointers are lost P23
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Linked Allocation (Cont.) Linked Allocation (Cont.) block = pointer data P24
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Linked Allocation (Cont.) Linked Allocation (Cont.) Solution for spaces for pointers Collect blocks into clusters, and allocate the clusters than blocks ( Allocate Cluster, Block) Fewer disk head seeks and decreases the space needed for block allocation and free-list management Internal fragmentation Solution for reliability Double linked list or store the filename and relative block number in each block More overhead for each file P25
Recommend
More recommend