------------------------------------------------------------------------------
MC logo
File System Management and Optimization
[^] CSc 422
------------------------------------------------------------------------------
[Chapter 1][Chapter 2][Chapter 3][Chapter 4]
[File System Abstraction] [File System Structure] [File System Consistency] [File System Management and Optimization] [Flash Storage] [Examples] [Windows NTFS]
  1. Block size.
    1. The fs allocates storage in units called blocks.
    2. A block cannot be less than a sector, but it is often several.
    3. Typical sector, 512 bytes; block 4K.
    4. Larger block sizes can waste file space, but reduce time spent on I/O.
    5. Author's file size study.
    6. Trade-off of space and time efficiency: no good compromise.
  2. Recording free space.
    1. Just create a special file made up of the free space.
      1. Organized however files are organized.
      2. Windows NT does this.
    2. Linked list.
      1. Only takes space when there's plenty available.
      2. LIFO access. Keep the head in memory.
    3. Bit map
      1. Naturally sorted so free blocks can be allocated together.
      2. Uses space even when the file system is full.
    4. Keeping Free
  3. Quotas. Described in the text.
    1. Per-user space limits.
    2. Now days not used much, or sometimes enforced at application layer.
  4. Backups.
    1. The data is generally much more valuable than the machine that holds it.
    2. Purposes of a backup.
      1. Recover from disaster.
      2. Recover from stupidity. (Like you can do that.)
    3. Media.
      1. Tape is still important here, believe it or not. Removable, high-density media.
      2. Optical media. Need a fancy jukebox, or cheap help that likes to stay up all night.
      3. Remote server/Cloud.
        1. After a thorough disaster, you won't have an Internet connection.
        2. Security issues.
    4. Full v. incremental.
      1. Full: backup everything.
      2. Incremental: backup what's changed.
    5. Physical or logical.
      1. Physical: make copies of all the disk blocks.
        1. Works well with any file system.
        2. Carefully backs up all the empty space.
      2. Logical: make copies of all the files.
  5. Caching
    1. Area of OS contains in-memory copies of disk blocks called a buffer cache.
    2. Cache is managed by a modified LRU policy.
      1. Blocks heuristically unlikely to be used again go to the front of the queue.
      2. Parts of the file system structure are given priority.
    3. When a disk block is needed, check the cache first.
      1. If it's there, avoids a disk I/O.
      2. If not, bring it in, replacing the least-recently-used one.
    4. Writes modify blocks in the cache.
      1. Changes made in memory must be written to disk.
      2. Write-back cache: the changes periodically written to disk.
      3. Write-through cache: all changes are committed to disk immediately.
      4. Write-back produces more disk traffic, but better survives crashes.
    5. Readahead. Tries to read blocks before they are needed.
      1. When several blocks have been read sequentially, mark the file as sequential.
      2. When an out-of-order read occurs, clear the sequential mark.
      3. When an application reads a block from a sequential file (hopefully already in the cache), issue a read for the next one and add it there.
      4. If reading pattern changes, there is some waste, but not an error.
    6. Sometimes the page cache (in-memory pages) and buffer cache are unified.
  6. Reducing seek time
    1. Try to keep parts of file near each other on disk.
    2. Can allocate free space in units larger than the block size.
      1. Other operations are based on the block size, as usual.
      2. Each allocation of new space to a file is several adjacent blocks.
    3. Cylinder groups.
      1. Divide disk into sections.
      2. Each has its own free list.
      3. Allocate space new file space from the same CG until it becomes fuller than some parameter. Then pick a relatively empty one.
    4. Doesn't matter with a flash drive.