Addendum to Subject 10 ---------------------- 'Unix' file 'system' ---------------------- The 'original' Unix file system was written by Ken Thompson, the designer and implementor of Unix at Bell Labs in 1969. The ideas established in that 'root' filesystem prevailed in all other variations of a Unix/Linux filesystem: a rooted tree of directories/files main view with additional elements (other drives/partitions, removable media) mounted i.e. attached to nodes of that 'main tree'. No drive letter appear to indicate those additional elements as they are required in other OSes eg Microsoft's use of C:, D:, letters to denote the roots of trees of additional elements. The 'original' file system supported only files of type regular (file), directories, and the special device files (characted and block). Later on the Berkeley Software Distribution (BSD) added a socket type, and later named pipes were added. The BSD file system was designed by M.K. McKusick [1]. In [1] it is mentioned that the original block size of 512B was quickly abandoned as too slow and a large 1KiB was used as early as in the mid 70s. By the time of BSD Unix, block size was at a minimum 4KiB. Note that studies at that time showed that with 512B block size user filesystem utilization exhibited waste space of about 5% of the total (usually internal fragmentation in the last block). With block size of 1KiB this jumped to 10%, and with 4KiB to a 40% indicating that most users were utilizing small files (small programs?). 'Linux' file 'system' ------------------------ Preceding Linux, A. Tanenbaum had a book on Operating Systems. In that context he designed and implemented a course-oriented OS known as MINIX with a simple file system. The Linux operating system was inspired and based on ideas of MINIX and the perusal of the MINIX source code. Eventually, a filesystem known as ext was used, inspired from the MINIX file system but being able to handle 2GiB partitions and long file names (255 chars). The first 'commercial grade' file system was ext2 that allowed drives up to TiB in size. Because of corruption related issues in ext2 a journaling file system was developed that led to ext3 and right now ext4 is available that supports files upt to 16TiB in size and drive as large as 1EiB. Different flavors of Linux support those file systems or offer default installations with alternative ones. For example Red Hat Enterprise Linux might be (is) using xfs, Sun Microsystems used to use zfs, and SUSE is using btfs (B-tree file system). Of course one can mount on Linux fat, fat32, vfat filesystem used in external devices. Other 'file systems' are virtual file systems: these include kerfs (Linux kernel file system) and sysfs, INODE entry : Number of direct data block pointers -------------------------------------------------- In a inode entry we mentioned that there are 12 direct pointers to data blocks. There are also a single indirect (level-1) pointer, a double indirect (level-2) pointer and a triple indirect (level-3) pointer. The structures are reminiscent of corresponding page table structures. A single indirect (level-1) pointer points to a level-1 pointer block that is not a data block. That level-1 pointer block is the one that contains, say P pointers, to P data blocks. A double indirect (level-2) pointer points to a level-2 pointer block that is not a data block. That level-2 pointer block contains P pointers to level-1 pointer blocks. Those latter level-1 pointer blocks contain P pointers each to data blocks for a total of 1 x P x P = P**2 data blocks. A triple indirect (level-3) pointer point to a level-3 pointer block that points to P level-2 pointer blocks with each one of the latter pointing to P level-1 pointer blocks. Each level-1 pointer block points to P data blocks. The number of data blocks addressed is thus P**3. The total number of data blocks is 12 plus P plus P**2 plus P**3. In early versions of a Unix or Linux file system 12 was either a 10 or 8. In early version of a Unix or Linux file system block size was 512B (around 1969), then it was increased to 1024B (around 1978) then to 4KiB (early 1980s). In modern file system implementations the minimum is 4KiB the typical can be 8KiB or more. This is decided at file system creation and it is not adjustable. NOTE for TEXTBOOK: The textbook in Figure 12.15 indicates direct pointer to data blocks and calls them Direct(0)... Direct(12). If you count starting from 0 it is not 12 but 13 total. To correct the typo, the last Direct(12) entry should become Direct(11). Note that INODE size and attributes might vary for different (Linux or Unix) file systems. If access control lists are supported, we get additional permissions that require more space and attributes. Journaling file systems (ext3 and higher might need more). References ----------- [1] https://docs.freebsd.org/44doc/smm/05.fastfs/paper.pdf