Chapter 3

55
Chapter 3: File Systems A Guide to Operating Systems: Troubleshooting and Problem Solving

Transcript of Chapter 3

Page 1: Chapter 3

Chapter 3: File Systems

A Guide to Operating Systems:

Troubleshooting and Problem Solving

Page 2: Chapter 3

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

Page 3: Chapter 3

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

Page 4: Chapter 3

A File System Metaphor

Page 5: Chapter 3

Data Files Contain

• Text

• Images

• Music

• Sounds

• Video

• Web Pages for the Internet

Page 6: Chapter 3

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

Page 7: Chapter 3

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)

Page 8: Chapter 3

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)

Page 9: Chapter 3

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)

Page 10: Chapter 3

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

Page 11: Chapter 3

Sample DOS Partition Table Structure

• FDISK is used to modify partition information

Page 12: Chapter 3

MS-DOS FDISK Utility

Page 13: Chapter 3

FDISK Partition Information Screen

Page 14: Chapter 3

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

Page 15: Chapter 3

FORMAT Command Switches

Page 16: Chapter 3

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

Page 17: Chapter 3

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

Page 18: Chapter 3

Hard Disk Cluster Reference

Page 19: Chapter 3

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

Page 20: Chapter 3

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

Page 21: Chapter 3

ATTRIB Arguments and Switches

Page 22: Chapter 3

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

Page 23: Chapter 3

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

Page 24: Chapter 3

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

Page 25: Chapter 3

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

Page 26: Chapter 3

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 (./\[]:;=)

Page 27: Chapter 3

DOS 8.3 Filenames versus Long Filenames (LFN)

Page 28: Chapter 3

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

Page 29: Chapter 3

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

Page 30: Chapter 3

Long Filename Storage Scheme

Page 31: Chapter 3

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

Page 32: Chapter 3

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

Page 33: Chapter 3

DEFRAG Utility

Page 34: Chapter 3

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

Page 35: Chapter 3

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

Page 36: Chapter 3

NTFS Numerical Equivalents

Page 37: Chapter 3

NTFS Default Cluster Sizes

Page 38: Chapter 3

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

Page 39: Chapter 3

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)

Page 40: Chapter 3

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

Page 41: Chapter 3

UNIX Information Nodes (Inodes) Design

Page 42: Chapter 3

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

Page 43: Chapter 3

UNIX Directory Showing Multiple Entries Pointing to the Same Inode

Page 44: Chapter 3

UNIX File System Path Entries

Page 45: Chapter 3

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

Page 46: Chapter 3

UNIX Drive Mount Path

Page 47: Chapter 3

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

Page 48: Chapter 3

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

Page 49: Chapter 3

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

Page 50: Chapter 3

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

Page 51: Chapter 3

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

Page 52: Chapter 3

Mac Simple Text Resources, as Seen Through ResEdit

Page 53: Chapter 3

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

Page 54: Chapter 3

Mac OS 8.5’s Sherlock Search Utility

Page 55: Chapter 3

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