Skip to content

WA5. Hard Links, Symbolic Links, Inodes, and File Systems

Statement

  1. Describe Hard Links and Symbolic Links. Include the difference between the two types of links.
  2. Explain what an inode is and what it is used for in the Linux operating system.
  3. Explain the process by which the Linux operating system is able to read a file from disk.
  4. Describe the Fast File System and how it has improved upon the original UNIX file system.
  5. Describe the differences between the Windows and Linux file systems. Be sure to include advantages and disadvantages.

Answers

  • Simply put, a hard link is a pointer to a file, it holds the exact path (the exact physical location) to that file. When moving or deleting the original file, the hard link will still work.
  • A hard link can only reference a file, not a directory (to avoid circular references)
  • When the original file is removed. only its reference count is decremented, and the file is not deleted until the reference count reaches zero.
  • The hard link is contributing to the reference count of the original file.
  • Deleting the hard link will not delete the original file, but will decrement the reference count of the original file.
  • The command for creating a hard link: ln <original file> <hard link>
  • Soft links (symbolic links) are a pointer to a file; or a shortcut to a file.
  • Moving or removing the original file will break the symbolic link.
  • The symbolic link is not contributing to the reference count of the original file.
  • Deleting the symbolic link will not delete the original file or affect it.
  • The command for creating a symbolic link: ln -s <original file> <symbolic link>
  • Symbolic links can reference both files and directories.
  • All of the above according to (Rajput, 2022).

2. Explain what an inode is and what it is used for in the Linux operating system

  • “An inode is a data structure that keeps track of all the files and directories within a Linux or UNIX-based filesystem. So, every file and directory in a filesystem is allocated an inode, which is identified by an integer known as “inode number”. These unique identifiers store metadata about each file and directory” (StackScale, 2022).
  • The inode contains information about the file, such as the file’s size, the number of links to the file, the file’s permissions, the file’s owner, and the file’s type.
  • The inode is used by the file system to keep track of metadata about the file (StackScale, 2022).

3. Explain the process by which the Linux operating system can read a file from a disk

  • According to (Bovet & Cesati, n.d.):
    • The user would call the read() or write() functions of the file object.
    • The file object would invoke system calls (read() or write()).
    • The actual implementation of the read() and write() system calls depend on the file system.
    • The system calls would locate the physical disk block containing the data.
    • The system calls issue an I/O request to the disk driver to transfer the data located on those blocks.
    • The disk driver would transfer the data to the kernel.
    • The kernel would load those data into memory according to the caller needs.

4. Describe the Fast File System and how it has improved upon the original UNIX file system

  • The Fast File System (FFS) is a file system that was developed by Sun Microsystems in the 1980s.
  • The main features of FFS (UNSW, 2002):
    • Cylinder groups to improve locality.
    • Copy of superblock in each cylinder group (on different platters) to improve fault tolerance.
    • Free block bitmap per cylinder group,
    • supports allocation of consecutive blocks.
    • Larger blocks (multiple of 4kB) for improved throughput.
    • Clustering of I/O operations to further improve throughput[Pea88].
    • Fragments (½ - ⅛ blocks) to reduce fragmentation.
    • Pre-allocated inodes scattered throughout cylinder groups,
    • Bitmap free list for fast allocation.
    • Ability to rebuild free lists after crash (fsck).

5. Describe the differences between the Windows and Linux file systems. Be sure to include advantages and disadvantages

  • Windows mainly support FAT (File Allocation Table) and NTFS (New Technology File system) file systems.
  • Linux Commonly used file systems are ext* family (ext, ext2, ext3 and ext4) and XFS.
  • Differences (Indika, 2011):
    • Linux has Swap partition, which does not exist in Windows.
    • Linux file system has a lot of different tools to manage the file system, while Windows has only a few.
  • Linux has many advantages over windows in terms of the number of tools and the open-source nature of the OS, but Windows has a lot of advantages in terms of the user experience, hardware compatibility, and the number of applications available for it.

References