Folie a: Name & Data Processing 2 2: File Systems Dipl.-Ing. Bogdan Marin Fakultät für Ingenieurwissenschaften Abteilung Elektro-und Informationstechnik -Technische Informatik-
Objectives File System Concept File Management Mass Storage Physical Concept File Allocation Table & Unix File System Management of Free Blocks
File System Concepts What are Files Named collection of information stored on mass storage media Logical storage units Two aspects: User s view User Interface System Designer s view Implementation User Interface results in two distinct notions: Files: storing a collection of data Directory Structure: organising & providing info abt files in system
File Management Administration of mass storage media and the devices which control them Creation and deletion of files To map and find files onto the physical media File Access: WHO can and HOW to
Mass Storage Refers to various techniques and devices for storing large amounts of data Three essential requirements are: Able to store large amount of information Storage must be non-volatile or persistent Stored information can be accessed concurrently Mass Storage vs. Memory Memory is volatile
Mass Storage Media Magnetic tapes: tape streamer + : cheap, large storage capacity, backup purposes - : Disadv: slow, sequential access Magnetic disks type 1: harddisk + : fast, higher storage capacity - : more expensive, not necessay portable, bulky Magnetic disks type 2: floppy disks, zip + : portable disk, universal, cheap, direct access - : slow, small storage capacity Optical disks: CD, DVD + : very large storage capacity, portable disk, read-only disk/drives cheap - : slower than harddisk, write disk drives expensive
Physical Concept (1/3) Example : Inside the Hard Disk Hard-disk drive Controller electronic Connection & Vent hole Platters, Arms & Heads Multiple platters Multiple arms & heads High-speed linear motor
Physical Concept (2/3) One or more metal platters rotate at 5400, 7200 or 10 800 rpm A mechanical arm pivots over the platters from the corner At any given arm position, each of the heads can read/write a circular region called a track All the tracks for a given arm position form a cylinder Each track is divided into sectors (typically 512 bytes per sector)
Physical Concept (3/3) Storing the Data 0 Heads 0..NoH-1 1 NoH-2 NoH-1 Sectors 0... NoS-1 NoH : Number of heads to read/write NoT : Number of tracks NoS : Number of sectors per track NBS : Number of bytes per sector Tracks 0... NoT-1
Storage Capacity The storage capacity of a mass storage media (BV) BV = NoH * NoT * NoS * NBS NOTE : NBS is by default 512 bytes!
Storage Capacity Given a standard format 8-inch floppy disk with 2 heads, 80 tracks, 18 sectors per track, four 128- byte units per sector (512 B), what is ist storage capacity in kilobytes [KB] BV = 2 * 80 * 18 * (4*128) [B] BV = 2 * 80 * 18 * 512 [B] BV = 1474560 [B] BV = 1440 [KB]
File Allocation Table (FAT) FAT = a table that OS 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. cluster number is not the same as the sector number (the system designer can define the number of physical sectors in a logical cluster on a disk). A cluster = 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.
File Allocation Table 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 Size of FAT12 Size of FAT16 Size of FAT32
File Allocation Table Cluster Size [KB] FAT12 FAT16 FAT32 0.5 1 2 4 8 16 32
Max Disk Partition (1) Given Cluster Size = 0.5 [KB] with FAT12 Max disk partition = 2 12 * 512 [B] = 2 [MB] Given Cluster Size = 2 [KB] with FAT16 Max disk partition = 2 16 * 2 [KB] = 128 [MB] Given Cluster Size = 4 [KB] with FAT32 Max disk partition = 2 28 * 4 [KB] = 2 10 * 2 10 * 2 8 * 2 2 [KB] = 1 [TB]
Max Disk Partition (2) Cluster FAT12 Size [KB] [MB] 0.5 0.5*2 12 =2 1 1* 2 12 =4 FAT16 [MB] FAT32 [TB] 2 2* 2 12 =8 128 4 2 2 *2 12 =16 2 2 *2 16 =256 1 8 2 3 *2 16 =512 2 16 2 4 *2 16 =1024 2 32 2 5 *2 16 =2048 2 Partitions are limited to 2 TB because internally, the system keeps track of the partition size in 512 Byte sectors using a 32 bit number: 512 Bytes * 2 32 = 2 TB
Unix File System A Typical Unix partition Directory entry i-node
Unix File System Assume disc blocks are 8K bytes and that disc addresses are 32 bits: What size can be directly addressed from the information in the i-node What size of file requires a double indirect block What is the largest possible file Answer: a) Disk blocks= 8K bytes i-node => 10 disk block adress 8K*10= 80K can be accessed directly
Unix File System b) Single indirect: (address of disk block which itself contains the disk block addresses) One 8K block can address : 2 3 *2 8 =2 11 = 2048 addresses of 8K blocks Can access file size: 2048*8k=16M Double indirect: (address of disk block with the addresses of single indirect blocks) 2048*2048= 4 194 304 (2 22 ) addresses of 8K blocks Can access file size: 4194304 *8k=32G c) Triple indirect: (address of disk block with the addresses of double indirect blocks) 2048*2 22 =2 33 addresses of 8K blocks Can access file size: 2 33 *8k=64TB Largest file: 64TB + 32G + 16M + 80K
Free Space Management How to keep track of free blocks Method 1: Linked List Linked lists of disk blocks, each block has as many free disk block no. as will fit in One slot needed for the pointer to the next block Method 2: Bitmap A disk with n blocks requires a bitmap with n bits Free blocks 1, used blocks 0 (or viceversa) Bitmap vs. Linked List 1 bit/block vs. 32bits/block
Free Space Management 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: File B is written using 5 blocks File A is deleted File C is written, using 8 blocks File B is deleted
Free Space Management 1000 0000 0000 0000 (begining) 1111 1110 0000 0000 (file A is written ) 1111 1111 1111 0000 (file B is written ) 1000 0001 1111 0000 (file A is deleted ) 1111 1111 1111 1100 (file C is written ) 1111 1110 0000 1100 (file B is deleted )
Next Week: Memory Management.. Check the webpage for exercises! http://www.fb9dv.uni-duisburg.de/ti/en/education/ss06/dv2/main.html