Linux File System Flashcards
What’s the basic definition of a linux file
A sequence of 0 or more bytes, arbitrary information. No distinction is made between any kind of file.
How does linux handle race conditions in read / write operations to files?
Using locks. The locking algorithm requires the caller to specify the file to be locked, the starting byte and the number of bytes.
How can a file be created?
Through the creat
system call. The file is created and opened for writing.
What is returned by the creat system call?
A file descriptor, file is configured in open mode.
What are file descriptors 0, 1 and 2?
These are standard input, output and error. When used as part of pipes these are redirected to the corresponding pipes (buffers).
Explain what’s an i-node
Representation of a file (including directories and special files) under the linux virtual file system.
How are paths represented in the virtual file system?
As D-entries in the central dentry data structure.
What information is contained in the Superblock
Critical information about the layout of the file system; number of i-nodes, number of disk blocks and the start of the list of free disk blocks.
What are the components of an ext2 block group and their roles?
Superblock: a copy of the file system’s superblock. Group descriptor table: information about the group itself, such as location of bitmaps, number of free blocks and i-nodes in the group. Block bitmap: bitmap that tracks usage status of the blocks in the block group. I-node bitmap: tracks usage status of the nodes in the block group. I-node table: table containing i-nodes for files and directories stored in the block group. Data blocks: the actual blocks that contain data.
What is a block?
Fixed-size unit of data storage. Basic unit of data management in a file system.
Describe what a disk request looks like
First stage: software queue (device driver), second stage: hardware controller, third stage actual disk movement.
Name a few characteristics a FS must provide
Naming, organizing fine names with directories, organization (map files to blocks), protection (enforcing access restrictions) and reliability.
Where does protection for a certain file reside?
In the I-node itself. Not in the block.
What is a sector in a hard disk?
It’s a physical portion of the disk.
What algorithm does the disk use for scheduling?
Elevator algorithm: it chooses a direction for the disk head to move, as the disk moves, it services all the read and write requests that it encounters along the way. If the disk reaches end of disk or there are no more requests, it changes direction. This continues indefinitely.