Guide to Operating Systems 4th edition Chapter 4 File Systems At a Glance Instructor’s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms 4-1 Guide to Operating Systems 4th edition 4-2 Lecture Notes Overview Chapter 4 explores file systems across the Windows, UNIX / Linux, and Mac OS X operating systems in order to give students a more in depth understanding of how files are stored. Several legacy file systems are detailed, as well as the current generation of file systems available on each platform. Objectives List the basic functions common to all file systems Explain the file systems used by Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, and Windows 7 (FAT16, FAT32, FAT64, and NTFS) Discuss the file systems used by UNIX and Linux systems, including ufs and ext Explain the Mac OS X Extended (HFS+) file system including new features added in Mac OS X version 10.6 Snow Leopard Teaching Tips Understanding File System Functions 1. Explain to students the concept of a file system and discuss how file systems keep and store data. 2. Summarize the process by which data is stored, describing the hierarchy file systems typically use; directories, subdirectories, files. 3. Give details on what kind of information is stored along with the files, such as creation date, modification date, or file attributes. 4. Show how the file system is navigated visually, using Explorer on Windows, Nautilus on Linux with GNOME, or Finder on OS X. Designing a Directory Structure 1. Discuss with students how file system paths are displayed or referenced in various operating systems, such as C:\ for the root on Windows, or / for the root on Linux. 2. Describe how students should set up and organize a file system. 3. Detail some of the default folders present on each operating system designed to organize files either belonging to the user or the operating system. Examples: a. /bin (Linux) b. C:\Users (Windows Vista / 7) c. C:\Documents and Settings (Windows XP) d. Users (Mac OS X) Guide to Operating Systems 4th edition 4-3 Disk Storage Basics 1. Show students how a hard disk stores information on tracks, and how each track is divided into sections by sectors. Students should understand about low-level formatting (which is usually only performed at a factory). Block Allocation 1. 2. 3. 4. Explain the use of block allocation to keep track of the location of files. Students should understand the logical separation of the disk into clusters. Describe how tracks that line up on each platter are called cylinders. Detail the two different techniques for storing block allocation data. Use FAT32 and NTFS as examples of the two different techniques, and then describe these two file systems. 5. Discuss what file metadata is, give examples of what metadata might include. In the case of images, you could say that some images store geo-location information as metadata. Partitions 1. Lay out the steps for partitioning a drive in preparation for creating a file system. Define what a high-level format is, and explain how it differs from a low-level format performed by a factory. 2. Discuss what a physical drive is and what a logical drive is, and how they compare. 3. Note the limitation on the number of partitions for a drive. 4. Describe the partition table / disk label, and how it keeps track of partitions on the disk. 5. Define Master Boot Record (MBR) and describe its contents (Using Windows as an example): a. Boot program b. Disk signature c. Partition table d. End of MBR marker 6. List some of the tools typically used to partition hard disks on all operating systems. a. fdisk (old Windows; Linux; Unix) b. Disk Management (Windows XP – 7) Formatting 1. Describe the formatting process, and list utilities used to format: a. Format b. Disk Management 2. Show where the boot block is placed (first sector of the disk). 3. Define what a bad cluster is, and discuss how it is marked off (in FAT). 4. Explain to students how the FAT file system stores and organizes data. Discuss the status bits and what each indicates: a. Volume b. Directory c. System Guide to Operating Systems 4th edition 4-4 d. Hidden e. Read-only f. Archive Windows File Systems FAT16 and Extended FAT16 1. Discuss the FAT16 file system. Students should know what the limitations of FAT16 are, and how filenames are displayed / used. They should be aware of the 8.3 filename limitation, and the long filename solution. Size limitations of partitions using FAT16 should also be mentioned. FAT32 1. Discuss the improvements made with FAT32, and compare limitations to FAT16. 2. Give options for converting to/from FAT32 on Windows operating systems, using the convert utility. FAT64 1. Briefly describe what FAT64 is, and where it is used. NTFS 1. Introduce the NTFS file system and describe some of its defining features, such as the use of a Master File Table (MFT). 2. Describe how file creation works on the NTFS file system, and how hard linking behaves. 3. The security and auditing features of the NTFS file system should be discussed, since security and auditing was un-available with FAT. NTFS’s built-in file compression should also be mentioned. 4. Detail how NTFS uses journaling to keep a log of file system activity to aid in data recovery should a vital data transaction be interrupted by power failure. 5. Students should be aware of what the Portable Operating System Interface for Unix (POSIX) is, and why NTFS supported it. Basic and Dynamic Disks 1. Explain the difference between basic and dynamic disks, and the advantages of using one over the other. NTFS File System and Disk Utilities 1. View the chkdsk.exe utility and explain its purpose to students. Describe how its role changes with the addition of self-healing NTFS. 2. Detail some common options to be used with chkdsk.exe, and teach students how to read the output from the program. Guide to Operating Systems 4th edition 4-5 3. Show how a defragmenter can be used to re-organize and optimize the data on a hard drive so that it is in a continuous fashion. CDFS and UDF 1. Briefly explain the CD-ROM file system and the Universal Disk Format file system. Quick Quiz 1 1. This kind of format normally occurs at the factory, and marks the location of disk tracks and sectors: a. Top-level format b. High-level format c. Bottom-level format d. Low-level format Answer: D 2. A file is a set of data that is grouped in some logical manner, assigned a name, and stored on the disk. a. True b. False Answer: A 3. How many active FAT16 logical drives can exist? a. 20 b. 22 c. 24 d. 26 Answer: D 4. The ability to keep a log file of file system activity is called ______ Answer: journaling 5. FAT32 has a maximum volume size of 2 terabytes. a. True b. False Answer: B The UNIX File System 1. Discuss how the UNIX file system (UFS) works, and list its main features, such as journaling and security. UFS is used primarily on UNIX operating systems, but is usable on Linux. 2. Introduce the extended file system (EXT), which most Linux distributions use by default. Students should know that the EXT file system is modeled after UFS, and shares many of the same features. EXT2 lacks journaling, while EXT3 and later use journaling by default. All EXT versions are backwards compatible with each other. 3. Describe inodes, and note that each file must have an inode that is identified with an inode number. Make students aware of the permissions that are carried along with the inode. Guide to Operating Systems 4th edition 4-6 4. Explain how the superblock keeps layout information on the organization of blocks, sectors, and cylinders on the file system. 5. Demonstrate the use of the mount utility in making file systems available for access. 6. Explain what device files are and how they are used inside of UNIX / Linux. There are two types of device file: a. Block device b. Raw device 7. Show students what a symbolic link is, and how it accomplishes the link using the inode of the target file. 8. Discuss what utilities are available for partitioning and formatting drives under UNIX / Linux: a. Fdisk b. Format 9. Once a partition is created, instruct students in the use of the newfs command for creating a file system on the partitioned device. 10. Demonstrate the use of the fsck command to check file systems, and communicate the risks of running it on an online file system. Teaching Tip Many UNIX / Linux systems are capable of reading Windows and Mac partitions, though sometimes extra software is needed. For FAT, support is usually already built in. NTFS now has widespread read/write support under Linux using the NTFS-3G system. Teaching Tip Figuring out which device file applies to which drive on UNIX / Linux can be complicated—especially when different flavors of UNIX (and sometimes even Linux) name devices differently. The best course of action is to issue the dmesg command and search for drive information, followed by issuing fdisk –l to list drives / partitions. This too, however, will depend on your UNIX / Linux flavor / distribution. Always consult a manual for the operating system involved if you don’t see familiar devices in /dev. The Macintosh File System 1. Describe the original Macintosh Filing System (MFS), a file system limited to keeping track of 128 documents, applications, or folders. Then, describe its successor, the Hierarchical Filing System (HFS). 2. Discuss the details of the Mac OS Extended (HFS+) file system, which is presently used for Mac OS X, and describe the more useful features, such as: a. Journaling (by default) b. Up to 16 TB of storage 3. Explain to students that, unlike some other early file systems, HFS has always had “medium filenames” of up to 31 characters in length. 4. Give examples of how Mac paths are separated, such as Hard Drive:System Folder: Preferences. Guide to Operating Systems 4th edition 4-7 5. Students should be shown how type codes and creator codes identify files, rather than using extensions (Files can still use extensions, though). 6. Demonstrate the use of aliases as the Mac OS X version of the symbolic link / shortcut. 7. Briefly discuss the Sherlock software, Mac OS X’s search program (prior to OS X 10.5). Then, demonstrate the usage of Spotlight, which makes use of indexing to find files faster. 8. Make students aware of the key sequences to force Mac OS X to boot to other devices: a. C during boot up forces a boot from DVD/CD-ROM drive b. Shift-Option-Delete-Apple (SODA) forces a boot to the next drive in a SCSI chain Teaching Tip HFS+ formatted drives with journaling are read-only on Linux via the HFS+ kernel driver. Windows has read-only drivers as well, but additional commercial products exist to provide read/write support. Quick Quiz 2 1. The superblock contains information about the layout of blocks, sectors, and cylinder groups. a. True b. False Answer: A 2. Similar to a shortcut, a ________ has a flag set in its inode that causes a file to link with another target file. a. Redirected link b. Hard link c. Symbolic link d. Alias Answer: C 3. What is Mac OS X’s present day file system? a. Macintosh Filing System (MFS) b. Hierarchical Filing System (HFS) c. Hierarchical Filing System Extended (HFS+) d. Extended File System (EXT) Answer: C 4. HFS+ has the ability to store up to _____ of data. a. 16 PB b. 16 TB c. 16 ZB d. 16 GB Answer: B 5. _______ indexes files using metadata, and even data within a file to improve search ability on Mac OS X 10.5 and later. Answer: Spotlight Guide to Operating Systems 4th edition 4-8 Class Discussion Topics 1. Students should discuss issues that might occur due to missing information in the partition table, or the Master Boot Record. Have students research this information, discuss symptoms, and suggest fixes. 2. Using the most up to date file system is not always the ideal choice. Get students to discuss why devices (mobile or otherwise) might not want to use full featured file systems like NTFS. Additional Projects 1. Have students research some additional file systems available on Linux, such as the experimental file system ButterFS (btrfs). 2. Suggest students research file recovery utilities for the various file systems available. Some will be open source, some will be proprietary. One of the better utilities available on multiple platforms is Testdisk. Additional Resources 1. http://www.cgsecurity.org/wiki/TestDisk 2. http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-steps.html -Provides great material for performing installs on UNIX, and gives some general knowledge about partitioning with fdisk on UNIX using drive slices. Key Terms 8.3 filenames Older-style file name format in which the name of the file can be up to eight characters long, followed by a period and an extension of three characters. See also extension. active partition The logical portion of a hard disk drive that is currently being used to store data. In a PC system, the partition that contains the bootable operating system. alias In the Macintosh file system, a feature that presents an icon that represents an executable file. Equivalent to the UNIX/Linux link and the Windows shortcut. allocation block In the Macintosh file system, a division of hard disk data. Equivalent to the Windows disk cluster. Each Macintosh volume is divided into 216 (65,535) individual units. bad clusters On a hard disk drive, areas of the surface that cannot be used to safely store data. Bad clusters are usually identified by the format command or one of the hard drive utilities, such as chkdsk or e2fsck. BinHex In the Macintosh file system, a seven-bit file format used to transmit data across network links that do not support native Macintosh file formats. block allocation A hard disk configuration scheme in which the disk is divided into logical blocks, which in turn are mapped to sectors, heads, and tracks. Whenever the operating system needs to allocate some disk space, it allocates it based on a block address. block device In the UNIX/Linux file system, a device that is divided or configured into logical blocks. See also raw device. boot block The UNIX/Linux and Mac OS X equivalent of the Windows Master Boot Record (MBR), the area of the hard disk that stores partition information for the disk. For example, on a Mac-formatted disk, Guide to Operating Systems 4th edition 4-9 the first two sectors are boot blocks that identify the filing system, the names of important system files, and other important information. See also volume information block. catalog b-tree In the Macintosh file system, a list of all files on a given volume. Similar to a directory in the Windows file system. CD-ROM File System (CDFS) A 32-bit file system used on CD-ROMs and DVDs. cluster In Windows-based file systems, a logical block of information on a disk containing one or more sectors. Also called an allocation unit. creator codes Hidden file characteristics in the Macintosh file system that indicate the program (software application) that created the file. See type code. cylinder Tracks that line up from top to bottom on the platters in a hard disk drive (like a stack of disk tracks). data fork That portion of a file in the Macintosh file system that stores the variable data associated with the file. Data fork information might include word-processing data, spreadsheet information, and so on. defragmenter A tool that rearranges data on a disk in a continuous fashion, ridding the disk of scattered open clusters. directory Also called a folder in many file systems, an organizational structure that contains files and may additionally contain subdirectories (or folders) under it. In UNIX/Linux, a directory is simply a special file on a disk drive that is used to house information about other data stored on the disk. In other systems, a directory or folder is a “container object” that houses files and subdirectories or subfolders. A directory or folder contains information about files, such as filenames, file sizes, date of creation, and file type. disk label The UNIX/Linux equivalent of a partition table in MS-DOS or Windows systems. The disk label is a table containing information about each partition on a disk, such as the type of partition, size, and location. Also, the disk label provides information to the computer about how to access the disk. disk quota Allocating a specific amount of disk space to a user or application with the ability to ensure that the user or application cannot use more disk space than is specified in the allocation. Distributed Link Tracking A technique new to NTFS 5 so that shortcuts, such as those on the desktop, are not lost when files are moved to another volume. extended file system (ext or ext fs) The file system designed for Linux that is installed, by default, in Linux operating systems. Extended (HFS+) A file system released in 1998 with Mac OS 8.1 and the file system used in Mac OS X. extension In MS-DOS and Windows-based systems, that part of a filename that typically identifies the type of file associated with the name. File extensions are typically three characters long and include standard notations such as .sys, .exe, .bat, and so on. extents b-tree Keeps track of the location of the file fragments or extents in the Mac OS HFS file system. file allocation table (FAT) A file management system that defines the way data is stored on a disk drive. The FAT stores information about file size and physical location on the disk. file attributes File characteristics stored with the filename in the disk directory, which specify certain storage and operational parameters associated with the file. Attributes are noted by the value of specific data bits associated with the filename. File attributes include Hidden, Read-only, Archive, and so on. Guide to Operating Systems 4th edition 4-10 file system A design for storing and managing files on a disk drive. File systems are associated with operating systems such as UNIX/Linux, Mac OS X, and Windows. folder See directory. hard link In Windows versions starting with Windows 2000 and UNIX/Linux, a file management technique that permits multiple directory entries to point to the same physical file. Hierarchical Filing System (HFS) An early Apple Macintosh file system storage method that uses a hierarchical directory structure. high-level formatting A process that prepares a disk partition (or removable media) for a specific file system. hot fix A procedure used by a file system that can detect a damaged disk area and then automatically copy information from that area to another disk area that is not damaged. inode Short for “information node.” In UNIX/Linux, a system for storing key information about files. journaling The ability of a file system or software (such as database software) to track file changes so that if a system crashes unexpectedly, it is possible to reconstruct files or to roll back changes with minimal or no damage. linked list Used in FAT file systems so that when a file is written to disk, each cluster containing that file’s data has a pointer to the location of the next cluster of data. logical drive A software definition that divides a physical hard drive into multiple drives for file storage. long filename (LFN) A name for a file, folder, or directory in a file system in which the name can be up to 255 characters in length. Long filenames in Windows, UNIX/Linux, and Mac OS systems are also POSIX compliant in that they honor uppercase and lowercase characters. low-level format A software process that marks tracks and sectors on a disk. A lowlevel format is necessary before a disk can be partitioned and formatted. MacBinary A format for Mac OS files that joins data and resource forks and preserves type and creator codes so that Mac files can be transferred over the Internet, or used via online services. Macintosh Filing System (MFS) The original Macintosh filing system, introduced in 1984. MFS was limited to keeping track of 128 documents, applications, or folders. Master Boot Record (MBR) An area of a hard disk in MS-DOS and Windows that stores partition information about that disk. MBRs are not found on disks that do not support multiple partitions. Master File Table (MFT) In Windows versions starting with Windows XP, a file management system similar to the FAT and directories used in MS-DOS and earlier versions of Windows. This table is located at the beginning of the partition. The boot sector is located ahead of the MFT, just as it is in the FAT system. medium filenames In the Macintosh file system, the 31-character filename length that Macintosh OS has supported from the beginning. metadata Files that contain information about the actual data. New Technology File System (NTFS) The file storage system that is the native system in Windows versions starting with Windows NT. partitioning Blocking a group of tracks and sectors to be used by a particular file system, such as FAT or NTFS. Partitioning is a hard disk management technique that permits the installation of multiple file systems on a single disk or the configuration of multiple logical hard drives that use the same file system on a single physical hard drive. Guide to Operating Systems 4th edition 4-11 partition table Table containing information about each partition on a disk, such as the type of partition, size, and location. Also, the partition table provides information to the computer about how to access the disk. physical drive Hard drive in a computer that you can physically touch and that can be divided into one or more logical drives. Portable Operating System Interface (POSIX) A UNIX standard designed to ensure portability of applications among various versions of UNIX. raw device In the UNIX/Linux file system, a device that has not been divided into logical blocks. See also block device. resource fork In the Macintosh file system, that portion of a file that contains fixed information, such as a program’s icons, menu resources, and splash screens. root directory The highest-level directory (or folder), with no directories above it in the structure of files and directories in a file system. sector A portion of a disk track. Disk tracks are divided into equal segments or sectors. Sherlock In the Macintosh file system, a file search utility that can find filenames or text within files. Spotlight The new way to search in Mac OS X starting with version 10.4 Tiger. It stores a virtual index of everything on the system. status bits Bits used as part of a directory entry to identify the type of file contained in each entry. The status bits in use are Volume, Directory, System, Hidden, Read-only, and Archive. superblock In the UNIX/Linux file system, a special data block that contains information about the layout of blocks, sectors, and cylinder groups on the file system. This information is the key to finding anything on the file system, and it should never change. switch An operating system command option that changes the way certain commands function. Command options, or switches, are usually entered as one or more letters, separated from the main command by a forward slash (/) in Windows and by a dash (-) in UNIX/Linux. symbolic link A special file in the UNIX/Linux file system that permits a directory link to a file that is on a different partition. This is a special file, which has a flag set in the inode to identify it as a symbolic link. The content of the file is a path that, when followed, leads to another file. track Concentric rings that cover an entire disk like grooves on a phonograph record. Each ring is divided into sectors in which to store data. type code In the Macintosh file system, embedded file information that denotes what applications were used to create the files. Mac OS type codes are used in much the same way as Windows file extensions that identify file types with .txt, .doc and other extensions. See creator code. Unicode A 16-bit character code that allows for the definition of up to 65,536 characters. Universal Disk Format (UDF) A removable disk formatting standard used for largecapacity CD-ROMs and DVD-ROMs. UNIX file system (ufs) A file system supported in most versions of UNIX/Linux that is a hierarchical (tree structure) file system which is expandable, supports large storage, provides excellent security, and is reliable. ufs employs information nodes (inodes). Guide to Operating Systems 4th edition 4-12 volume information block On a Mac-formatted disk, the sector after the boot blocks. See also boot block. The volume information block points to other important areas of information, such as the location of the system files and the catalog and extents trees. volume label A series of characters that identify a disk drive or the file system it is using.