Ex 2 File Systems A file is a logical collection of information and a file system is a collection of files, where the latter may also include a variety of other objects that share many of the properties of files such as I/O devices. 1. What are the main purposes of file management? 2. What does the term mass storage refers to? List its essential requirements. 3. List some common types of mass storage media and its properties. Storage capacity (BV) of a mass storage media can be computed by considering the number of heads to read/write (NoH), the tracks (NoT), the sectors per track (NoS) and the bytes per sector (NBS) as: BV = NoH * NoT * NoS * NBS NOTE: NBS is by default 512 bytes/sector. 4. Given a standard format 8-inch floppy disk of 2 heads, 80 tracks, 18 sectors per tracks, four 128-byte units per sector, what is its storage capacity in kilobytes [KB]? The physical concept of a magnetic storage media is illustrated as follows: Heads 0 1 NoH-2 NoH-1 Sectors 0 NoS 1 Tracks 0 N T 1 Figure 2.1 Physical Concept of a Magnetic Storage Media
File Allocation Table (FAT) is a table that the operating system uses to locate files on the disk. FAT12 is the oldest type of FAT, which uses a 12-bit binary number to hold the cluster number, for Windows 95 is FAT16 and for Windows 95 and beyond is FAT32. Note that the cluster number is not the same as the sector number i.e. the system designer can define the number of physical sectors in a logical cluster on a disk. A cluster is a group of sectors on the disk that have information in them. A 4K cluster has 8 physical sectors (NBS) in it (512*8=4096). Each Cluster has an entry in the FAT table. Operating System Supports Supports Supports NTFS FAT32 FAT16 Window Server 2003 Yes Yes Yes Windows XP Professional Yes Yes Yes Windows XP Home Yes Yes Yes Windows 2000 Pro and Server Yes Yes Yes Windows Millennium Edition No Yes Yes Windows 98 and Second Edition No Yes Yes Windows 95 OSR2 and OSR2.5 No Yes Yes Windows NT4 Workstation Yes No Yes Windows 95 Gold (Original Release) No No Yes Windows NT3.5x Workstation Yes No Yes MS-DOS (versions 3.3 and higher) No No Yes Figure 2.3 Operating Systems and File Systems The FAT file system comes in three versions for MS-DOS: FAT12, FAT16 and FAT32. Calculate the Size of maximum disk partition for each of the FAT version in Table 1 5. Size of FAT12 6. Size of FAT16 7. Size of FAT32 The shaded boxes represent forbidden combinations. Note that for FAT32, only the low-order 28 bits are used for disk addressing. The maximum disk partition for FAT32 is limited to 2TB because internally the system keeps track of partition size in 512 Bytes sectors using a 32-bit number, i.e. 2 9 x2 32 =2TB
Cluster Size [KB] FAT12 FAT16 FAT32 0.5 1 2 4 8 16 32 Table 1: Size of maximum disk partition for FAT12/FAT16/FAT32 Unix File System: Consider a typical Unix Partition: The Unix directory entry looks like this: The other information is kept in the i-node
8. Assume disc blocks are 8K bytes and that disc addresses are 32 bits: a. What size can be directly addressed from the information in the i-node? b. What size of file requires a double indirect block? c. What is the largest possible file? Keeping Track of free blocks Once a block size has been chosen, next issue is how to keep track of free blocks. Two methods are widely used First one: Linked List consists of disk blocks, with each block holding as many free disk block numbers as will fit. With a 1-KB and a 32 bit disk block number, each block on the free list holds the numbers of 255 free blocks. However, one slot needed for the pointer to the next block. A 16- GB disk needs a free list of 16,794 blocks to hold all 2 24 disk block numbers. Second method is Bitmap. A disk with n blocks requires a bitmap with n bits. Free blocks are represented by 1s, used blocks by 0s (or vice versa).
A 16-GB disk has 2 24 1-KB blocks and thus requires 2 24 bits for the map, which requires 2048 blocks. 9. The beginning of a free space bitmap looks like this after the disk partition is first formatted: 1000 0000 0000 0000 (the first block is used by the root directory). The system always searches for free blocks starting at the lowest numbered block, so after writing file A, which uses 6 blocks the bitmap looks like this: 1111 1110 0000 0000. Show the bitmap after each of the following additional actions: a) File B is written using 5 blocks b) File A is deleted c) File C is written, using 8 blocks d) File B is deleted