- Links can be created in same directory or different directories - Conveniently access files - To most programs linking is invisible and they treat links the same as original files - Links take up only minimal disk space - Just enough to create a directory entry for the file - There are two types of links - Links (hard links) - Data associated with files persists until last linked file is deleted - Symbolic links (soft links or symlinks) - If source file is deleted the symlinks are orphaned - Links are created using the ln command - Ln original.txt link.txt - Ln -s makes a symbolic link - Windows can also support junction links - Specific for directories - Honors reparse points in Windows - Kernel modules - Essentially integrate into Linux when they are loaded - Pretty much become part of OS - Must rely on services provided by OS - Cannot use standard c/c++ API - Require a new set of APIs - Development and management is tedious - Require super user (su) privileges to manage - Module crashed are often fatal to the whole system - Kernel can recover from some issues - User-space drivers - Current linux trend is to migrate modules into user-space - Modules run as regular user programs rather than kernel - Use special system calls and support from kernel - Advantages - Run on a per user basis - Safer and more secure - Easier to develop using standard APIs and any available library - Disadvantage - Each user must run module to use device - Movement of large volumes of data may be slow - File System in User Space (FUSE) - Allows users to set up and use custom file systems - Uses a special kernel module to perform operations - What is a file system - A standard or convention used to store information on permanent storage - A “data structure” on disk - Includes organization of data - File system designs depend on number of factors - Size oof physical media - Application requirements - Number of reads, writes, deletes - Operating environment - How much safety and security is really needed - Examples: - FAT - NTFS - EXT - EXT3 - AFS - Goal of a file system - Physical storage - Read and write to them - The root directory is a fixed location on storage - Part of storage is dedicated to the root directory - Contains information about the top-level files on the storage - Contains attributes for each file - Block allocation entries (inodes) - File systems maintain allocation table - Block allocation tables are stored on disk - Track free space (with 0 entry) on storage - Track the next logical block of a file - This is essentially a linked list on disk - FAT: File Allocation table - Simple file system that organizes storage into the following distinct parts based on clusters - Boot sector (Sector 0) - Spinning storage - Hard disk drives have many platters or surfaces - Each surface has many concentric cylinders - Each surface has one or more read-write heads that move horizontally to read data off the cylinders - Initially disks have to be formatted to mark start and stop of sectors - Logical Sector Numbers - A physical sector is identified by 3 values - Head, cylinder, physical sector number - Referring to sectors with 3 values is cumbersome - Given track, head, and sector - lsn= ((track * #heads) + head) * #sectorsPerTrack + sector -1 - BPB is a critical data structure in FAT - Contains information about the file system , such as: - Sector size (in bytes) - Number of FAT copies on floppy - Number of root directory entires - BPB is stored in binary form starting at offset 0 in the Boot Sector(sector 0) - Binary formats make is easier to read and process - Uses little endian format that is fully compatible with x86 architecture -