Filesystems

Physical Disks and Resources Terms

  • Disk : Device which stores persistent information
    • hard disk
    • solid-state
    • cd, dvd, etc...
  • Partition: Logical division of a disk
  • Filesystem: Organization on a partition used by OS to track directory and file location

Physical Disks and Resources Terms

  • Mount Point: Location in directory tree where filesystem is anchored
  • Root Filesystem: The first filesystem mounted at boot time
  • Roor or "/" : The mount point for the first filesystem

Filesystem Attributes

  • total space
  • space used
  • available space
  • reserved space
  • device name
  • mount point
  • block size

Block size example

If you set your block size to 4096, or 4K, and you create a file that is 256 bytes in size, it will still consume 4K of space on your harddrive. For one file that may seem trivial, but when your filesystem contains hundreds or thousands of files, this can add up.

Filesystem Commands and Files

  • df
  • du
  • /etc/fstab

Paths and Filenames

  • Every process has a current working directory
  • relative paths are relative to cwd
  • absolute paths are identified from the root "/"
  • Relative paths include "." and ".."
  • Filenames can include any character except "/"
    • Spaces in filenames will work, but can be a hassle

Mounting and unmounting

  • If you use a non-empty directory when mounting, the contents of that dir will be hidden.
  • You can mount:
    • Partitions
    • cdroms, dvds
    • disk drives
    • network shares
  • Busy filesystems cannot be unmounted
    • busy means a process is running or a file is open in the mounted fs.

File system types

We will look at:

  • vFat(Fat16, Fat32)
  • NTFS
  • ext4

Others:

  • NFS - network file system
  • old versions of ext
  • zfs, hpfs, many more

Random stuff

  • Symbolic links
  • Hard links

Checking file systems

  • fsck can be used to fix a filesystem when it has errors.
    • Necessary when not mounted cleanly
    • Or when journal is corrupted
    • sometimes automatically run at reboot