Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UNIX File Architecture

UNIX File Architecture

One of the first talks I ever made. It was held in front of a committee as a final task of a course for becoming a technical trainer. This one sealed the deal.

Preslav Mihaylov

April 11, 2015
Tweet

More Decks by Preslav Mihaylov

Other Decks in Programming

Transcript

  1. Agenda 1. Difference between an inode, file and file data

    2. Filesystem redundancy – Superblocks, Datablocks 3. Directory entries in UNIX 4. File contents 5. File redundancy – Symlinks, Hardlinks 6. Deleting files in UNIX
  2. Inodes, files and file data 1. Inode • An element,

    that keeps a reference to a given file/inode as well as metadata about it • Similar to pointers in programming languages 2. File data • The physical content of a given file on the PC storage (HDD/SSD) 3. File • An abstract element • The logical representation of the file data, as well as the inode pointing to it. • Contains information about its inodes, data, file type, etc
  3. File System Redundancy Two types of Inodes in UNIX –

    Superblocks, Datablocks 1. Superblock – Inode, containing File system metadata 2. Datablock – Regular Inode, containing file metadata as well as a pointer to the file data location.
  4. Directory entries in UNIX • In UNIX, there are no

    directories • There are inodes, that point to other inodes. These are called directory entries (Dentry)
  5. File contents • Every inode contains file metadata • File

    type – designates how the file system should treat the file • Link count – shows how many inodes point to this file • Owner/Group ID – shows who does this file belong to • LAT/LMT/LIAT – Timestamps (Not trustworthy) • Pointers – keep reference of the data location
  6. File Redundancy • In UNIX, there are two types of

    links – symlinks, hardlinks • Symlink – A regular file, that keeps the file location of another one (Similar to shortcuts in Windows) • Hardlink – An inode, that points to a file data location of another inode(s)
  7. Deleting files in UNIX • In UNIX, files do not

    get deleted, they get overwritten • When a file is “deleted” from the file system, you delete the inode pointing to the file data, not the actual file data. • A file is considered “deleted”, when the last inode pointing to it is removed. (Despite that, they can still be restored) • Similar to deleting reference objects in programming languages. (In UNIX, there is no garbage collector )
  8. Summary • Difference between a file, inode and file data

    • Superblocks/Datablocks in UNIX. File system redundancy • “Directories”/Directory entries in UNIX • File contents/metadata • Redundancy of files – Symlinks, Hardlinks • “Deleting”/Overwriting files in UNIX