Chapter 3
Transcript of Chapter 3
Chapter 3: File Systems
A Guide to Operating Systems:
Troubleshooting and Problem Solving
Chapter Objectives
• Understand the basic functions of all file systems
• Describe the major elements of the DOS and Windows 3.1/ 3.11 file system
• Compare and contrast the Windows 95/ 98 file system (FAT16 and FAT32) with the older DOS/ Windows 3.1 file system
• Describe the fundamental features of the UNIX file system
• Describe the basics of the Macintosh file system
Understanding File System Functions
• Partition and format disks to store and retrieve information
• Establish file naming conventions
• Provide utilities for functions such as file compression and disk defragmentation
• Provide for file and data integrity
• Provide storage media management functions
A File System Metaphor
Data Files Contain
• Text
• Images
• Music
• Sounds
• Video
• Web Pages for the Internet
Block Allocation
• Keeps track of where specific files are stored on disk
• In DOS and Windows, these are clusters
• Hard disk platter has two sides (read/ write head)
• Clusters are mapped to sectors, heads, and tracks
• Divided into logical blocks
• Tracks that line up on platter are called cylinders
Block Allocation
Two techniques are used to store data:
– A fixed portion of the disk is used (FAT)
– Various locations on the disk are used (UNIX and NTFS)
Partitions and Related Components
• Divides hard drive into sections
• Creates multiple logical volumes that you assign drive letters to
• Partition table (DOS, Mac OS, and Windows
• Disk label in UNIX
• Boot block in UNIX
• Master boot record in Windows (MBR)
The DOS/Windows 3.1 File System
• Uses a file allocation table (FAT) file system
• Use of 8.3 file names which can be up to 8 characters long followed by a period and an extension of 3 characters
• With DOS prior 4.0, the maximum size of file system was 32 MB (FAT12)
• With MS-DOS from 4.0, the maximum size was 2 GB (FAT16)
Partitioning
• The FAT file system supports two partitions per hard drive - a primary and a secondary partition
• A secondary partition may be divided into a maximum of three logical drives
Sample DOS Partition Table Structure
• FDISK is used to modify partition information
MS-DOS FDISK Utility
FDISK Partition Information Screen
Formatting: Placing a file system on a partition
• Boot block contains information about disk (number of tracks and sectors per track)
• Boot block contains small program to start operating system
• In DOS use the format command
• Writes all of the file system structure to disk
• A floppy uses first sector as the boot block
FORMAT Command Switches
Root Directory and File Attributes
• Root directory contains the following:
– name, start cluster, file size, file modification date and time
– every partition is a fixed size
• File attributes (characteristics) – hidden, read only and archive
Clusters
• Not fixed in length
• If a file does not exactly match the disk space available in the cluster, there will be unused space at the end of cluster
• Unused spots in FAT are marked as bad clusters
• The largest possible partition in FAT is 4 GB
Hard Disk Cluster Reference
Typical FAT Directory Structure
• The FAT table and root directory are found at the beginning of each partition, and are always at the same location.
• Each item in the directory consists of 32 bytes
Extensions
• SYS extension is generally the device driver
• COM or EXE extensions are program files that the operating system can execute
• BAT extensions are batch files of commands that can be executed as if they were typed on the keyboard
• Filename and extension cannot contain spaces
ATTRIB Arguments and Switches
DOS File System Utilities
• CHKDSK checks the contents of directories and verifies the consistency of FAT tables
• /F, for Fix allows you to correct problems
• SCANDISK is a menu driven interface
• Copies files it will manipulate to a disk
• Conducts some of the same tasks as CHKDSK
Another DOS Utility
• Defragment - rewrites files to a disk so that they are contiguous
– Looks for empty FAT location and uses the cluster indicated
– Continues to use the next empty cluster until no more free clusters are found
More About Defragmentation
• The Disk Defragmenter utility maximizes access time and makes it faster to write new files to disk
• Floppy disks do not need to be defragmented
• The hard disk should be defragmented on a regular basis
Windows 95/ 98 File System
• FAT16 is similar to the system used in DOS/ Win 3.1
• FAT32 is a new system introduced in Windows 95, release B
• Both the FAT 16 and FAT32 file system for Windows 95/ 98 have features in common with the DOS version of the FAT16 system with some new ideas
Windows 95/ 98 FAT16
• File names may contain as many as 255 characters
• File names are not case sensitive
• File name can include spaces and several characters that 8.3 names cannot (./\[]:;=)
DOS 8.3 Filenames versus Long Filenames (LFN)
Long Filenames (LFN)
• The LFN is stored by using a series of additional directory entries
• It can contain up to 13 characters in upper or lower case
• Unicode allows for representation of any character in any language
Long Filenames (LFN)
• Unicode is a 16-bit code
• ASCII (American Standard Code for Information Interchange) uses an entire byte to represent each character
• Limits number of characters represented to 255
Long Filename Storage Scheme
FAT32
• Gets around the problem of cluster size
• Allows the partitions to be up to 8 GB
• Blocks can be allocated with up to 8 KB
• The maximum partition size will be raised to 32 GB
• Don’t use FAT32 if you plan to access your hard disk from other operating systems
Windows 95/98 File System Utilities
• Windows 95/ 98 includes the capability to create compressed disk volumes
• Windows 95 also has a defragmentation utility that will run from system scheduler
• No other programs should be running while using the defragmentation utility
DEFRAG Utility
Windows NT File Systems
• Windows NT supports two types of file systems:
– The extended FAT16 system
– The New Technology File System (NTFS)
• Both systems are Portable Operating System Interface (POSIX) compliant
New Technology File System (NTFS) Features
• Built-in security
• Ability to use larger disks and larger files
• Ability to compress file and directory
contents on the fly
• Better recoverability and stability
• Less disk fragmentation
NTFS Numerical Equivalents
NTFS Default Cluster Sizes
Tracking Files and Clusters
• NTFS tracks files and clusters using a
Master File Table (MFT)
• The MFT is located at the beginning of the
partition
• The Boot sector is located ahead of the
MFT
• Normally the MFT takes up 1 MB
NT Disk Administrator
• NT Disk Administrator allows you to partition and format disks
• Allows you to change disk and partition attributes
• Performs disk maintenance
• Allows setup RAID (Redundant Arrays of Independent Disk)
NT After the Partition
• File systems can be created in two ways:– use format utility
– use the disk administrator utility (better choice)
• NTFS “features”– partitions smaller than about 512 MB take up
more overhead than FAT
– slightly more CPU intensive
UNIX Information Nodes (Inodes) Design
UNIX File System
• The UNIX File System (UFS) uses information nodes, or inodes
• Inode 0 contains the root of the file system
• The file system is identified by the superblock which contains information about the layout of blocks, sectors, and cylinder groups on the file system
• The inode does not contain a filename
• Directory entries can point to the same inode
• A hard link makes it possible for file names to appear in several directories under several names
UNIX Directory Showing Multiple Entries Pointing to the Same Inode
UNIX File System Path Entries
Mounting
• A Path starts out with /, which indicates root directory
• The mount command maps the root inode of another file system onto the empty directory
• Mount command has several options– shows no parameter results in a printout of the
disks that are currently mounted
– shows the name of the partition and the path on which it was mounted
UNIX Drive Mount Path
UNIX Special Features
• Case-sensitivity (must type file names exactly as they appear)
• There are two types of devices:– A raw device has no logical division in blocks
– A block device does have logical division
• Partitions of all disks will appear as devices which are kept in the /dev or /devices directory
• Symbolic link is merely a pointer to a file; it can point to a file that doesn’t exist
UNIX Features
• Write command saves the label to the disk• Print partition table command in fdisk or
format• File System Checker (fsck) operates when
you start up UNIX to verify the integrity of the superblock, the inodes, all cluster groups, and all directory entries
• UFS file system can be up to 4 GB in size
The Macintosh File System
• Macintosh Filing System (MFS) keeps track of 128 documents, applications, or folders
• Hierarchical Filing System (HFS) like FAT16, HFS divides a volume into units called allocation blocks
Macintosh Operating System 8.1
• Referred to as HFS+, like Windows NT (NTFS) in that it increases the number of allocation blocks per volume
• The first 2 sectors of the formatted disk are boot blocks in the volume information block
• The catalog b-tree is a list of all files in the volume,
• Catalog b-tree tracks the filename, logical location, folder structure and physical location
More About Macintosh 8.1
• It supports medium filenames (up to 31 characters)
• Rather than extensions, it uses type codes and creator codes
• Files contain two parts:– data fork contains frequently changed information
– resource fork contains fixed information
Mac Simple Text Resources, as Seen Through ResEdit
Macintosh First Aid
• Mac OS ships with two basic disk utilities:
– Disk First Aid - which repairs minor hard drive
problems
– Drive setup - which formats and partitions IDE
and SCSI hard drives
• Sherlock Program searches disks for
filenames and text within files
Mac OS 8.5’s Sherlock Search Utility
Chapter Summary
Chapter Three:
• Gives an overview of the basic functions of all file systems
• Compares the Windows 95/98 file system with the older DOS/Windows 3.1 file systems
• Describes the fundamental features of the UNIX file system
• Describes the basics of the Macintosh file system