CSE 411 Filesystems

File Types and Permissions

  1. File Types: Regular files, directories, symbolic links, FIFOs, sockets, and device files (character/block special).

  2. Permissions: rwx (read, write, execute) permissions for owner, group, and others.

    • Example: -rw-r--r-- shows a regular file with permissions.


Links

  • Hard Links: Cannot span filesystems; share the same inode.

  • Symbolic Links: Can link across filesystems; created with ln -s.


Filesystem Structure

  1. Directories: Common directories like /etc, /home, /var, /usr, and /tmp serve specific purposes.

  2. Device Files:

    • Character Special: Raw device access (no buffering).

    • Block Special: Buffered access.

  3. Fake Filesystems: Created at boot time, e.g., /proc.


Disks and Partitions

  • Disk Components: Platters, cylinders, tracks, sectors.

  • Partitions: Divided into cylinders, managed via tools like fdisk or gdisk.

  • Labels: GPT (modern, flexible) vs. MBR (legacy).


Filesystem Components

  1. Superblock: Contains filesystem metadata (e.g., block size, free blocks, cylinder groups).

  2. Inodes: Core of UNIX filesystems, tracking file attributes, locations, and permissions.

  3. Cylinder Groups: Optimize file storage and include data blocks, inode blocks, and metadata.


Mounting and Filesystem Management

  1. Mounting: Attach filesystems to directories; tracked in /etc/fstab.

  2. Unmounting: Requires no active file use; done with umount.

  3. Tools:

    • fsck: Check filesystem integrity.

    • mkfs/newfs: Create new filesystems.

    • df: Display disk usage.

  4. Backups: Managed using dump.


File Operations

  • Sparse Files: Allocate blocks only when data is written, saving space.

  • Directories: Special files storing file names and inode numbers.


Device Numbers

  • Major/Minor Device Numbers: Identify device drivers and modify behavior.