Lecture 7: filesystems ---------------------- What is a file? key->value pair key: hierarchical filename (pathname) value: arbitrary number of bytes In principle, you can use files to store very small values - most filesystems have a minimum file size of at least 1K, often 4K or more. - one byte of data wastes a lot of space A set of files "stored" together, sharing a common hierarchical root, is a filesystem - no storage for virtual filesystems such as /proc and /sys When you first start a UNIX system, you start with the "root" filesystem - but other filesystems can be put on top by "mount"-ing them. traditional filesystems are stored in block devices - but a filesystem can be anything that provides a filesystem interface block size issues - larger blocks, less overhead (fixed overhead for each block access) - smaller blocks, more efficient space usage (fewer files smaller than one block) file interface basics: - open, read, write, seek, close - open directory, read/write directory, close directory filesystem interface basics: - mount, unmount filesystem blocksize is a multiple of disk blocksize How do you structure a filesystem? First, you have to understand inodes One other file API: mmap