940 likes | 967 Views
Learn the fundamentals of file systems: how information is stored on a computer's hard disk, the tasks performed by file systems in operating systems, and the importance of organizing files hierarchically. Discover the role of folders in managing data and the significance of converting data into digital format for computer processing.
E N D
Guide to Operating Systems, 5th Edition Chapter 4 File Systems
Objectives After completing this chapter, you will be able to: • List the basic functions common to all file systems • Use and describe the file systems used by Windows OSs • Use and describe the file systems used by UNIX and Linux systems, including ufs and ext • Use and describe the Mac OS X Extended (HFS+) file system Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • All information stored on a computer’s hard disk is managed, stored, and retrieved through a file system • The file system allocates locations on a disk for storage and it keeps a record of where specific information is kept • When you need the information, the file system consults its records to determine the location and then retrieves the information. • Some file systems also implement recovery procedures when a disk area is damaged or when the OS goes down, such as during a power failure. Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • File systems used by operating systems perform the following general tasks: • Provide a convenient interface for users and applications to open and save files • When a user double-clicks a file to open it, the user interface calls the file system with a request to open the file. • The file type determines exactly how the file is opened. • If the file is an application, the application is loaded into memory and run by the CPU. • If the file is a document, the application associated with the document type is loaded into memory and opens the file. Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • File systems used by operating systems perform the following general tasks: • Provide a convenient interface for users and applications to open and save files • If a user creates a file or changes an existing file and wants to save it, the application calls the system file to store the new or changed document on the disk. • Provide a hierarchical structure to organize files • The overall purpose of a file system is to create a structure for filing data. • The analogy that is used is a file cabinet, file drawers, and file folders. Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • Provide a hierarchical structure to organize files • The computer could be considered the file cabinet, and the disk drives the drawers. • Within each drawer, information is organized into hanging folders, manila folders and individual documents. • A file is a set of data that is grouped in some logical manner, assigned a name, and stored on the disk. • As the file is stored, the file system records where the file is located on the disk so that it has a way to later retrieve that file. • The data contained in files can be text, images, music and sounds, video, or Web pages. Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • Provide a hierarchical structure to organize files • But no matter what kind of data is stored in the file system, it must be converted into digital format – a series of 1s and 0s – that the computer understands. • There must be a way to write digital information to disk, track it, update it when necessary, and call it back when the user or a user-controlled program wants it. • To achieve all this, the OS typically groups the file data in some logical way, creates a record of this structure, and builds a folder or directory to track the type of data stored in each file. Guide to Operating Systems, 5th Edition
Understanding File Systems Functions • Provide a hierarchical structure to organize files • A folder (directory) is an organizational structure that contains files and may additionally contain subfolders (subdirectories) under it. • The folder connects names to the files that are stored on the disk, which makes it easy for users and programs to obtain the right data at the right time. • One of the most important features of a file system is the ability to store information according to a pattern of organization that is enabled by the use of folders. • Without a well-designed folder structure, it is common for a hard disk to become cluttered and disorganized with a plethora of files and application software. • Store file metadata to provide detailed information about files • Organize space on a storage device Guide to Operating Systems, 5th Edition
Hierarchical Structure • A chaotic file structure: • Makes it difficult to run or remove programs • Makes it difficult to determine the most current versions • Makes users spend unproductive time looking for specific files • To avoid chaos, design the file and folder structure from the start (especially on servers) Guide to Operating Systems, 5th Edition
Hierarchical Structure • Default structure might consist of folders for the following: • OS files • Typically set up by the OS. • Software applications • Often set up both by the OS, the software applications that you install, and decisions you make about how to install those applications. • Work files, such as word-processing, graphics, spreadsheets, and database files • Set up by you and by applications. Guide to Operating Systems, 5th Edition
Hierarchical Structure • Default structure might consist of folders for the following: • Public files that you share over the network • Set up by you. • Utilities files • Set up by the OS, the utilities applications, and your decisions about how to install specific utilities. • Temporary files • Set up by the OS, applications that use temporary files, and your decisions about where to store temporary files. Guide to Operating Systems, 5th Edition
Hierarchical Structure The root folder should not be cluttered with files or too many directories or folders. Each software application should have its own folder or subfolder so updates and software removal are easy to administer OS files should be kept separate and protected so important files are not accidentally deleted by a user. Guide to Operating Systems, 5th Edition
Hierarchical Structure • The folder structure from the root might be as follows: • Windows • For the system files • Program Files • For general software and utilities • Documents and Settings • For work files such as Word documents and confidential spreadsheets • Shared • For spreadsheets that are shared over the network Guide to Operating Systems, 5th Edition
Hierarchical Structure • The folder structure from the root might be as follows: • Forms • For specific types of forms used by the legal forms software • Inetpub • For Web pages. Guide to Operating Systems, 5th Edition
Hierarchical Structure Figure 4-2 Sample folder structure for a Windows-based system Guide to Operating Systems, 5th Edition
Hierarchical Structure • For Linux systems, a typical folder structure already provided by the OS is: • bin • For user programs and utilities • sbin • For system administration utilities • lib • For runtime library files needed by programs stored in the /bin and /sbin directories • usr • For used files and programs Guide to Operating Systems, 5th Edition
Hierarchical Structure • For Linux systems, a typical folder structure already provided by the OS is: • var • For files in which content often varies or for files that are used only temporarily. • tmp • For files used only temporarily • Dev • For devices • mnt • For DVD/CD-ROM drives, flash drives, and other removable media Guide to Operating Systems, 5th Edition
Hierarchical Structure • For Linux systems, a typical folder structure already provided by the OS is: • etc • For system and configuration files • root • For files used by the root account • home • For users’ home directories (folders) and typically stored in subfolders named for each user • proc • For system resource tracking Guide to Operating Systems, 5th Edition
Hierarchical Structure Figure 4-3 Fedora root folders in the GNOME Files tool Guide to Operating Systems, 5th Edition
Hierarchical Structure • In Mac OS X, the default folder structure includes: • Applications for Mac OS X software applications • System for Mac OS X system files • Library for library files • Users for user accounts • Documents for documents Guide to Operating Systems, 5th Edition
File Metadata • In addition to the names of files and where to find them on the disk, folders (and individual files) may store information about the file or folder or the data contained in them. • This information is referred to as metadata. • Metadata is information that describes data but is not the actual data itself. Guide to Operating Systems, 5th Edition
File Metadata • The name of a file is considered metadata, as is the information in the following list: • Date and time the folder or file was created • Date and time the folder or file was last modified • Date and time the folder or file was last accessed • Folder or file size • Folder or file attributes, such as security information, or if the folder or file was backed up • If the information in a folder or file is compressed or encrypted Guide to Operating Systems, 5th Edition
File Metadata Figure 4-4 Windows file metadata Guide to Operating Systems, 5th Edition
Storage Device Space Organization • When a hard disk is delivered from the manufacturer, it is low-level formatted. • A low-level format is a software process that marks the location of disk tracks and sectors. • Every disk is divided into tracks: • Like several circles around a disk. • The number of tracks on a hard disk depends on the disk size and manufacturer. • Each track is divided into sections of equal size called sectors. Guide to Operating Systems, 5th Edition
Storage Device Space Organization Figure 4-5 Disk tracks and sectors on a platter Guide to Operating Systems, 5th Edition
Storage Device Space Organization • The OS discussed in this book use a method called block allocation to keep track of where specific files are stored on the disk. • Block allocation divides the disk into logical blocks called clusters or allocation units in Windows which correlate to sectors, heads, and tracks on the disk. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Block allocation data is stored on the disk using one of two techniques. • File allocation table (FAT) • Uses a fixed portion of the disk to store this data. • Initially implemented in MS-DOS and supported by all versions of Windows and most other OSs. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Block allocation data is stored on the disk using one of two techniques. • New Technology File System (NTFS) and UNIX/Linux file systems • Uses various locations on the disk to store a special type of file that is used for directory and file allocation information • On NTFS-formatted disks, the allocation table is called the Master File Table (MFT). • Without this data, it would be impossible to access any of the files on the system without using specialized repair tools. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Before a file system can be placed on a hard disk, the disk must be partitioned and formatted. • Partitioning is the process of blocking a group of tracks and sectors to be used by a particular file system, such as FAT or NTFS • After a disk is partitioned, it must be high-level formatted so that the partition contains the disk divisions and patterns needed by a particular OS to store files Guide to Operating Systems, 5th Edition
Storage Device Space Organization • When you want to have multiple file systems on one disk, you can partition the disk so that different file systems can be installed on different disk partitions • Example: To allow the installation of Red Hat Enterprise Linux and Windows 10 on the same computer • You can also create partitions in one OS to segment a single physical drive into multiple logical volumes to which you can assign distinct drive letters. Guide to Operating Systems, 5th Edition
Storage Device Space Organization Figure 4-6 Multiple partitions used in one Windows 10 system Guide to Operating Systems, 5th Edition
Storage Device Space Organization This technique of dividing a hard disk into multiple logical drives is very useful for organizing file storage, and was necessary with older OSs, such as MS-DOS and Windows 3.1, which did not recognize very large hard drives. When a partition is created, information about that partition is stored in a special area of the disk known as the partition table (in MS-DOS, Mac OS, and Windows) and disk label (in UNIX/Linux) Guide to Operating Systems, 5th Edition
Storage Device Space Organization In addition to the disk label and partition table, another piece of disk is reserved, known as the boot block in UNIX/Linux and Mac OS X, or the Master Boot Record (MBR) in MS-DOS and Windows. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • In Windows, the MBR can be up to 512 bytes and consists of four elements: • The boot program • Examines the partition table to determine the partition from which to boot and enables the program code in the active partition’s start area to execute and then point to the code that starts the OS. • The disk signature • Stores information about the disk and is used by management software such as the Windows Registry Guide to Operating Systems, 5th Edition
Storage Device Space Organization • In Windows, the MBR can be up to 512 bytes and consists of four elements: • The partition table • For the active partition • The end-of-MBR marker • Signifies where the MBR contents end on the disk • Not all operating systems support partitions in the same way • Each operating system uses specific utilities to create partitions Guide to Operating Systems, 5th Edition
Storage Device Space Organization When a disk partition is created, the file system is stored inside the partition. The folder structures are then built inside the file system. When files are stored on the disks, they are given some space inside the partitions, and data about the files is written in the folder area. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Windows supports two types of drive partitioning: • Basic • Support up to four partitions per hard drive. • Four primary partitions or three primary and one extended partition • Extended partition may be further divided into logical drives • Each of these logical drives can hold an individual file system. • Under control of the OS, up to 26 logical drives, each with its own file system, can be active at one time. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Windows supports two types of drive partitioning: • Dynamic • Do not use traditional partitioning techniques • Dynamic disks make it possible to set up a large number of volumes on one disk and provide the ability to extend volumes onto additional physical disks • You can convert basic disks to dynamic disks using the Disk Management tool. Guide to Operating Systems, 5th Edition
Storage Device Space Organization Figure 4-7 A disk with primary and extended partitions Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Since Windows XP, you can access a volume as a folder on another NTFS volume • When using Windows Disk Management utility to format a disk • You have the option to mount the disk instead of assigning a drive letter • The empty folder into which a volume is mounted is called a volume mount point Guide to Operating Systems, 5th Edition
Storage Device Space Organization Figure 4-8 Using a volume mount point in Windows Guide to Operating Systems, 5th Edition
Storage Device Space Organization • After you partition a disk, it is time to place the file system on the partition. • Formatting – the process of placing the file system on the partition • Necessary in order to install an operating system • If your disks are currently unpartitioned, Windows will provide the option to automatically create the necessary volumes • The System Reserved – Active and holds the boot configuration data • Another volume that will be assigned the “C” drive and hold the Windows OS. Guide to Operating Systems, 5th Edition
Storage Device Space Organization After the OS is installed, a disk management tool can be used to partition and format additional free space and disks. Formatting a disk removes all data that was on the disk. On disks that have never been formatted, the format command writes new sector and track markers on the disk. The boot block is placed in the first sector on the disk, which also contains the root folder. Guide to Operating Systems, 5th Edition
Storage Device Space Organization Table 4-1 Format command switches Guide to Operating Systems, 5th Edition
Storage Device Space Organization Table 4-1 Format command switches (continued) Guide to Operating Systems, 5th Edition
Storage Device Space Organization The root folder is also where the system stores file information, such as name, start cluster, file size, file modification date and time, and file attributes. Guide to Operating Systems, 5th Edition
Storage Device Space Organization • When a file is stored to disk: • Data is written to clusters on the disk • Filename is stored in the folder, along with the number of the first cluster the data is stored in • When the OS fills the first cluster, data is written to the next free cluster and the FAT entry corresponding with the first cluster points to the number of the second cluster used • When the second cluster is full, the OS continues with the next free cluster and the FAT entry for the second cluster points to the number of the third cluster used, and so on… • When a file is completely written to the disk, the FAT entry for the final cluster is filled with all 1s (means end of file) • This is commonly referred to as the linked-list method Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Clusters are a fixed length • When a files does not use all of the space in a cluster, the rest of the cluster is unusable • Unusable spots are marked in the FAT as bad clusters (never used for file storage) • Each partition stores an extra copy of the FAT table in case the first copy gets damaged • There is only one copy of the root directory on each partition • The FAT tables and root directory are at the beginning of each partition Guide to Operating Systems, 5th Edition
Storage Device Space Organization Figure 4-9 Typical FAT directory structure Guide to Operating Systems, 5th Edition
Storage Device Space Organization • Each FAT directory entry contains filename, file revision date and time, file size, and file attributes • Each folder entry contains status bits • Identify the type of filename contained in each entry • Status bits in use are: • Volume, Folder, System, Hidden, Read-only, and Archive Guide to Operating Systems, 5th Edition