Linux administration

Filesystem Concepts

Nguyen Hai Chau
Vietnam National University

Filesystems

  • Some confusion surrounds the use of the term 'filesystem'
  • Commonly used to refer to two distinct concepts
  • The hierarchy of directories and files which humans use to organise data on a system ('unified filesystem')
  • The formatting system which the kernel uses to store blocks of data on physical media such as disks ('filesystem types')

The Unified Filesystem

  • Unix and Linux systems have a unified filesystem
    • Any file, on any disk drive or network share, can be accessed through a name beginning with /
  • The unified filesystem is made up of one or more individual filesystems ('branches' of the unified hierarchy)
    • Each individual filesystem has its own root
    • That root can be grafted onto any directory in the unified filesystem
    • The directory where an individual filesystem is grafted into the unified filesystem is the individual filesystem's mount point
  • An individual filesystem lives on a physical device (such as a disk drive), though not necessarily on the same computer

File Types

  • Files directly contain data
  • Directories provide a hierarchy of files: they can contain both files and other directories
  • Files and directories are both file types
  • Other file types exist, including device special files:
    • Device files provide a way of asking the kernel for access to a given physical device
    • The data that the device file seems to contain is actually the raw sequence of bytes or sectors on the device itself
    • Device files are by convention stored under the /dev directory

Inodes and Directories

  • An inode is the data structure that describes a file on an individual filesystem
  • It contains information about the file, including its type (file/directory/device), size, modification time, permissions, etc.
  • You can regard an inode as being the file itself
  • The inodes within an individual filesystem are numbered
    • An inode number is sometimes called an 'inum'
  • Note that a file's name is stored not in its inode, but in a directory
    • A directory is stored on disk as a list of file and directory names
    • Each name has an inode number associated with it
    • Separating names from inodes means that you can have multiple directory entries referring to the same file