File Systems: They store and retrieve files What do we want out of a filesystem? - Fast at finding and reading and writing and creating and deleting - Doesn't waste space - Maintenence not required or easy to do - Doesn't lose files even if power is lost - Files can be recovered from bad disk - Doesn't hurt your hard drive - Supports metadata like ACL, last modified, etc. - Low CPU overhead (but not at the expense of speed usually) - Resizing! Demo What features do filesystems (sometimes) have? - Journaling - B-trees (kinda did that) - Parallel support (XFS, etc) - Expansion - Aging - Max file sizes, volume size, number of files, etc Brief summary of some common filesystems: - FAT - ext2/3/4 - reiserFS / reiser4 --> btrfs - jfs (IBM) - xfs (SGI) - ntfs (Microsoft) - hfs (Apple) ZFS: More than just a filesystem Pools and filesystems zpool status and zfs list encrypted filesystem != encrypted pool File Allocation Table: Originally designed for floppies Simple, little CPU overhead Dominates memory card filesystems. Why? - Could be handled by camera processors 10 years ago - Low CPU overhead means long battery life (MP3, etc) - Finding is slower than other systems, but transfer rate is ok - Simple to program compared to alternatives FAT Implementation: If you look this up on Google Images, use "File Allocation Table" not "FAT" Table Entries: - File Identifier - Directory Name - Location on disk - More (picture online) Limits: 4gb on fat32, etc. - These are implementation-dependent. - Clusters and small files Split Files: Cluster chains First and last are recorded - what if you want the middle? Fragmentation and defrag OS Support: All major operating systems support FAT Generally speaking, Windows is the only major OS that will run on FAT - There is always a way... - DOS ran on it No file permissions ReiserFS: The B-tree revolution - Everything goes in the tree! - Journaling - Online resizing - Tail packing (can hurt performance) - Big kernel lock Practicality time: Which one should you use? - phoronix benchmarks on 4.14 + sync less often - have some guts and win the race - So which one to use? + XFS is intended for large filesystems and is solid + Nobody ever got fired for using EXT4 + Be a filesystem nerd and have one of each The nature of data: Structures, strings, and arrays Can we make ourselves a linked data structure with just offsets? Yes, might take longer than we want to devote to the purpose. Keep free spaces in a heap or something Space and speed are often at odds with each other