File System Flashcards
Data is stored on
Physical devices, eg disks
A file is a
Logical view of the data , perceived by the programmer
A file system creates
An interface between users and files
A file allocation method
Refers to how disk blocks are allocated & organized for files on the disk
Contiguous allocation
Each file occupies set of contiguous blocks
Pros of contiguous allocation
Best performance in most cases
Simple- only starting location (block #) and length (number of blocks) are required
Cons of contiguous allocation
Finding space for file
estimating a file size at creation, or growing it
External fragmentation
Compaction
Linked Allocation
Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk
Pros of linked allocation
Simple, only need starting address
Free-space management system- no waste of space
Defragmentation not necessary for file allocation
Cons of linked allocations
No random access, locating a block can take many disk seek & I/O
Extra space required for pointers
Clusters
Reliability: What if a pointers gets corrupted
File Allocation Table
Beginning of volume has table indexed by block number
Indexed Allocation
Brings all pointers together into the index block, to allow random access to file blocks
Pros of indexed allocation
Supports direct access
Prevents external fragmentation
Cons of indexed allocation
High pointer overhead -> wasted space
What is wrong with too big of index block
Waste of space for small files
What is wrong with too small of index block
Size of file will be limited
What type of file access type to use contiguous?
Great for sequential and random
What type of file access type to use Linked?
Good for sequential, not random
What type of file access type to use Indexed
More complex
Free-Space list
The system maintains it to record all free disk blocks
Free-Space list implemented using
Linked List
Bit Vectors
Grouping
Counting
What does a file system provide
Organized and efficient access to data on secondary storage
File control block
metainformation about files
Directories provide
A way for user to organize their files
A convenient file name space for both users and file systems
A directory is typically
just a file that happens to contain special metadata
Directory =
list of (name of file, file attributes)
Directory attributes include
Size, protection, location on disk, creation time, access time
The directory list is usually
unordered (effectively random)
Navigation through trees relies on
pathnames
absolute pathname start from
the root
relative pathnames start from
current working directory
.
current directory
..
parent directories
Pathname translation, how does it open directory?
Opens directory searches for next word and gets location of that
In opening directories, what is checked at each step
Permissions
Directory is a special file that containes
list of names of files and their inode numbers
“A file is in a directory”
Directory has a link to the inode of the file
“A directory contains a subdirectory”
Directory has a link to the inode of the subdirectory
“A directory has a parent directory”
Entry of the directory has a link to the inode of the parent directory
Inode
Structure maintaining all metadata about a file (or directory), except for name
Inode number
unique ID of inode
Hard Links
Creates another file with a link to the same underlying inode; an entry inside a directory with an inode
Soft link (symbolic link)
A link to another name in the file system