Os - Unit 5
Os - Unit 5
Os - Unit 5
File Systems
[Chapter 4 from Tanenbaum 3rd edition]
Prachi Shah
IT Dept.
BVM
Contents
1. Files: Naming, Structure, Types, Access, Attributes, Operations
The part following the period is called the file extension and
usually indicates something about the file.
In UNIX, the size of the extension, if any, is up to the user, and a file
may even have two or more extensions, as in homepage.html.zip
Typical file extensions
File Structure
Byte sequences
Maximum flexibility-can put anything in
Unix and Windows use this approach
Fixed length records
Tree of records- uses key field to find records in the tree
File Structure
(b)An archive-library
procedures compiled but
not linked
File Access
3 Open after create, gets attributes and disk addresses into main memory
8 Seek puts file pointer at specific place in file. Read or write from that position on
e.g. make needs most recent modification times to arrange for group
9 Get Attributes
compilation
10 Set Attributes e.g. protection attributes
.
Single Level Directory Systems
A single-level directory system containing four files.
7 Link links file to another directory [Types: Hard link and Symbolic link]
• Four Methods:
1. Contiguous allocation
2. Linked list allocation
3. Linked list using table
4. I-nodes
1. Contiguous Allocation
Storing a file as a linked list of disk blocks Linked list allocation using a file
allocation table in main memory
4. I-nodes (Index-node)
• How big is N?
• Solution: Last entry in table points to disk block which
contains pointers to other disk blocks
4. I-nodes (Index-node)
(a) fixed-size entries with the disk addresses and attributes (DOS)
(b) each entry refers to an i-node. Directory entry contains attributes. (Unix)
Implementing Directories
(a) Situation prior to linking. (b) After the link is created. (c) After
the original owner removes the file.
Symbolic links
• Moral:
(1) don’t allow anybody near computers (2) back up your files
1. Physical dump
2. Logical dump
1. Physical dump
dump the whole thing
The good – it is simple to implement & has great speed
Don’t want to dump:
a) unused blocks – program needs access to the unused block list
and must write block number for used blocks on tape
b) bad blocks – Disk controller must detect and replace them or the
program must know where they are (they are kept in a bad block
area by the OS)
The bad –
o Can’t skip a particular directory
o Can’t make incremental dumps
o Can’t restore individual files
2. Logical Dumps
o Starts at directory and recursively dumps all files/directories below it
which have changed since a given time
Figure 4-27. File system states. (a) Consistent. (b) Missing block.
(c) Duplicate block in free list. (d) Duplicate data block.
File System Consistency – Example
o Missing block (b)-put on free list
o Block occurs twice on free list (c)-re-build free list
o Block occurs twice on blocks in use (d)- notify user. (If one
file is removed, then block appears on both lists)
o Solution to duplication:
Look at files instead of blocks
Use table of counters, one per file
The MS-DOS File System-directory entry
.
The MS-DOS File System –maximum partition size
Figure 4-32. Maximum partition size for different block sizes. The
empty boxes represent forbidden combinations.
The UNIX V7 File System (1)