Point of Today Lecture: Disk Layout concern of Reliabilities and Performance · Final Exam: Tuesday 8:30 Same Room As Lecture (Double check the exam week schedule) · Continue Disk Layout So far in this lecture we have learned three different kinds of Disk Layout + Contiguous Allocation + Linked Structure + Indexed Structure I/ Contiguous Allocation -- + Advantage: like memory, fast--not indirection and simplifies directory access + Disadvantage: inflexible, causes fragmentation over time--needs compaction Example: could be CD-w, write one time II/ Linked Structure + Properties: insert easy--just like link list structure, can't read ahead + Advantage: good for sequential access, insert easy + Disadvantage: can't read ahead, random access Very simple but poor performance-- file system consistency check III/ Indexed Structure + Properties: like indexed array, store pointers in array An "index block" contains pointers to many other blocks + Advantage: better for random access + Disadvantage: may need multiple index block (link together) Example: Floppy disk, the Unix Inode, DOS FAT DOS FAT + One file allocation table describes the layout of the entire disk + Each entry in the table refers to a specific cluster within a file. -- Zero says cluster not used -- Not zero says where the next FAT entry for the file is. + A file's directory entry points to the first FAT entry for the files. However DOS FAT has limitation: Let's say FAT index is 16 bit -- the disk can have up to 64K clusters In order to have a disk larger than 32 MB you must use clusters that are larger than a single sector –- leads to fragmentation. UNIX INODE + Designed to give fast access to small files, and eventual access to large files. + Every file and directory has an Inode. + An Inode has 15 entries. -- The first 12 entries point directly to the first 12 blocks of a file -- The 13th entry points to an array of 1024 pointers, each points to a block -- The 14th entry uses double indirection, an array of 1024 pointers, each pointing to an array of 1024 pointers, which then each point to a block. -- The 15th entry uses triple indirection... + As UNIX evolved, they went from UFS -> FFS(Fast File System) -- Puts the inodes and data physically near each other. -- Keep space near the inode when initialized in anticipation of data coming in. -- This will keep it fast but the disk will be underutilized. + Directories are blocks of data that contain a name and an inode. -- Directory != Inode, a directory structure contains an inode. + The only difference between a directory and a file is interpretation of data.