Windows Server 2008 - Community College of Rhode Island

Download Report

Transcript Windows Server 2008 - Community College of Rhode Island

Guide to Operating Systems,
4th ed.
Chapter 4: File Systems
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 Leopard
Guide to Operating Systems, 4th ed.
2
Understanding the File System 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
– Some file systems also implement recovery procedures when a
disk area is damaged or when the OS goes down
Guide to Operating Systems, 4th ed.
3
Understanding File System Functions
• File systems used by operating systems perform
the following general tasks:
–
–
–
–
Partition and format disks to store and retrieve information
Enable files to be organized through directories and folders
Establish file-naming conventions
Provide utilities to maintain and manage the file system and
storage media
– Provide for file and data integrity
– Enable error recovery or prevention
– Secure the information in files
Guide to Operating Systems, 4th ed.
4
Understanding the File System Functions
• The overall purpose of a file system is to create a
structure for filing data
– The file cabinet = the computer
– The drawers = disk drives
• Within each drawer (disk) - Information is organized into:
– Hanging folders (directories)
– Manila Folders (subdirectories)
– Individual documents (files)
Guide to Operating Systems, 4th ed.
5
Understanding File System Functions
• A file is a set of data that is grouped in some logical
manner, assigned a name, and stored on the disk
– The file system records where the file is located on the disk
• The data contained in files can be text, images,
music and sounds, video, Web pages.
– All data must be converted into digital (binary) format – a series
of 1s and 0s
• There must be a way to write digital information
onto disk, track it, update it, and retrieve it when
the user or a program wants it.
Guide to Operating Systems, 4th ed.
6
Understanding File System Functions
• To achieve this the OS:
– Groups disk sectors in some logical way;
– Creates a record of this structure;
– Builds a directory or folder to track the type of data stored in
each file.
• Directory or folder – an organizational structure
that contains files and may additionally contain
subdirectories (subfolders) under it.
• The directory connects names to the files that are
stored on the disk.
Guide to Operating Systems, 4th ed.
7
Understanding File System Functions
• Directories also stores the following information:
–
–
–
–
–
Date and time the directory or file was created
Date and time the directory or file was last modified
Date and time when the directory or file was last accessed
Directory or file size
Directory or file attributes, such as security information, or if
the directory or file was backed up
– If the information in a directory or file is compressed or
encrypted
Guide to Operating Systems, 4th ed.
8
Designing a Directory Structure
• Directories and folders can be organized in a hierarchy
that is similar to a tree structure.
• Building a hierarchy of folders and subfolders enables
you to fine-tune the organization of files and folders in a
methodical way so that information is easy to find and
use.
• Without a well-designed directory or folder structure, it
is common for a hard disk to become cluttered and
disorganized with different versions of files and
application software.
• Some users keep most of their files in the computer’s
primary level or root directory (root folder) or they
load all application software into a single directory.
Guide to Operating Systems, 4th ed.
9
Designing a Directory Structure
• Some programs use an automated setup that suggests
folders for new programs
– Example – creating new subfolders under the Program Files folder
• A chaotic file structure makes it difficult to:
– Run or remove programs;
– 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).
• Plan to design a directory structure that complements
the one already set up by the OS.
Guide to Operating Systems, 4th ed.
10
Designing a Directory Structure
• The default OS, along with the structure that you add
might consist of the following:
– OS files (set up by the OS;
– Software Applications (often set up by both 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, spreadsheet, and
database files (set up by the user any by applications);
– Public files that you share over the network (set up by the user);
– Utilities files (set up by the OS, the Utilities applications, and decisions
about how to install specific utilities);
– Temporary files (set up by the OS, applications that use temporary
files, and decisions about where to store temporary files).
Guide to Operating Systems, 4th ed.
11
Designing a Directory Structure
• In deciding how to allocate folders for specific
types of files, consider following some general
practices:
– Root folder should not be cluttered with files or too many
directories/folders
– Each software application should have its own folder/subfolder
so updates and software removal are easy to administer
– Similar information should be grouped (example: accounting
systems or office productivity software)
– Operating system files should be kept separate and protected
– Directories and folders should have names that clearly reflect
their purposes (a folder named “Shared” would contain
documents that can be shared by many users)
Guide to Operating Systems, 4th ed.
12
Designing a Directory Structure
• The folder structure from the root might be:
–
–
–
–
–
Windows – for the system files
Program Files – for general software and utilities
Documents and settings – for work files and spreadsheets
Shared – for spreadsheets that are shared over the network
Forms – for specific types of forms used by the legal forms
software
– Inetpub – for Web pages
Guide to Operating Systems, 4th ed.
13
Designing a Directory Structure
Sample folder structure for a Windows-based system
Guide to Operating Systems, 4th ed.
14
Designing a Directory Structure
• For Linux systems, a typical directory structure that
is already provided by the OS is:
– bin – for user programs and utilities (binary files)
– sbin – for system administration utilities (system binary files)
– lib – for runtime library files needed by programs stored in the
/bin and /sbin directories
– usr – for user files and programs
– var – for files in which content often varies or that are used only
temporarily
– tmp – for files used only temporarily
– dev – for devices
– mnt – for floppy drives, DVD/CD-ROM drives, flash drives, and
other removable media
Guide to Operating Systems, 4th ed.
15
Designing a Directory Structure
• For Linux systems, a typical directory structure that
is already provided by the OS is:
– etc – for system and configuration files
– root – for files used by the root account
– home – for users’ home directory (or folder) and typically
stored in subfolders named for each user
– proc – for system resource tracking
Guide to Operating Systems, 4th ed.
16
Designing a Directory Structure
• In MAC OS X, the default folder structure created
by the OS from the root level includes:
– Applications – for MAC OS X software applications
– Applications - (MAC OS 9) for applications used with the
earlier MAC OS 9
– System Folder – for MAC OS 9 system files
– System – for MAC OS X system files
– Library – for library files (such as fonts)
– Users – for user accounts, with subfolders for each user
account to store files
– Documents – for documents
Guide to Operating Systems, 4th ed.
17
Disk Storage Basics
• Hard disks arrive from manufacturer with low-level
formatting
– A low-level format is a software process that marks the
location of disk tracks and sectors
– Tracks are like several circles around a disk and each track is
divided into sections of equal size called sectors
Guide to Operating Systems, 4th ed.
18
Disk Storage Basics
Disk tracks and sectors on a platter
Guide to Operating Systems, 4th ed.
19
Block Allocation
• Block allocation – divides the disk into logical blocks
(clusters), which correlate to sectors, heads, and tracks
on the disk
– Keeps track of where specific files are stored on the disk
• Hard drives are made up of multiple disks (platters)
• Each hard disk platter has two sides, with a
read/write head on each side.
• Cylinders - tracks that line up on each platter from
top to bottom and are all read at the same time
Guide to Operating Systems, 4th ed.
20
Block Allocation
• When the OS needs to allocate disk space, it does
so based on a block address which is a way to
address the hard disks by a single sector number.
• The reference to a file in the directory and in the file
allocation data is based on block numbers.
• Data regarding block allocation is stored 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.
Guide to Operating Systems, 4th ed.
21
Block Allocation
• Data regarding block allocation is stored using one
of two techniques (contid)
– 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
(metadata)
Guide to Operating Systems, 4th ed.
22
Partitions
• Before a file system can be placed on a hard disk,
the disk must be partitioned and formatted.
• Partitioning – the process of blocking a group of
tracks and sectors to be used by a particular file
system, such as FAT or NTFS
• After partitioning, the disk must be high-level
formatted in order for the OS to store files
• It might be necessary for a disk to have more than
one file system to allow multiple OSs
– Will require a partition for each file system
– Example: To allow the installation of Red Hat Enterprise Linux
and Windows
7 on
Guide to Operating
Systems, 4th
ed. the same computer
23
Partitions
• You can partition a disk so that different file
systems can be installed on different disk
partitions.
• Logical drives – creating multiple logical volumes
on a single disk and assigning drive letters to each
volume.
• 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)
• Another piece of disk that is reserved is 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, 4th ed.
24
Partitions
• In Windows, the MBR consists of four elements:
– The boot program – examines the partition table to determine
which partition (the active partition) to boot from
• Enables them 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
– The partition table for the active partition
– The end-of-MBR marker – where the MBR ends
• Not all operating systems support partitions in the
same way
• Each operating system uses specific utilities to
create partitions
Guide to Operating Systems, 4th ed.
25
Formatting
• After the disk is partitioned, the file system is
placed on the partition.
– Necessary in order to install an operating system
• After the OS is installed, a disk management tool
can be used to partition and format additional free
space
• Another option for formatting is to use the format
command from the Command Prompt window
– Writes all of the file system structure to the disk.
– Creates the boot block / Master boot record and adds
information about the disk
• Number of tracks
• Number of sectors per track
Guide to Operating Systems, 4th ed.
26
Formatting
• When a file is stored to disk:
– The 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 process is commonly referred to as the linked-list method
Guide to Operating Systems, 4th ed.
27
Formatting
• 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 and 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 (see figure on the following slide)
• The FAT tables and root directory are at the
beginning of each partition and always at the same
location
Guide to Operating Systems, 4th ed.
28
Formatting
Typical FAT directory structure
Guide to Operating Systems, 4th ed.
29
Formatting
• Each FAT directory entry contains filename, file
change date and time, file size, and file attributes
– The filename consists of the name and the extension.
– Extensions can have a special meaning
• .sys – device drivers
• .com / .exe – program files the OS can execute
• .bat – batch files of commands that can be executed
Guide to Operating Systems, 4th ed.
30
Formatting
• The File Attributes identify the type of filename
contained in each entry:
– Volume
• Indicates a file system volume label or nickname for the file
system
• Set with the /v option of the format command
– Directory
• Signifies that a file contains folder data and should be treated as a
folder by the file system
• Folders may contain subfolders, as long as the names of all
subfolders in a path do not exceed 80 characters
Guide to Operating Systems, 4th ed.
31
Formatting
• The four remaining File Attributes indicate
additional information about a file:
– System (S flag)
• Files that are part of the OS and should not be touched by
programs or users
– Hidden (H flag)
• Files that should not be visible to the user
– Read-only (R flag)
• Files that should not be written to
– Archive (A flag) – Files that should be backed up the next time
a backup is made
Guide to Operating Systems, 4th ed.
32
Formatting
• The attrib command:
– Typing attrib followed by a folder name shows all the attribute
settings for all the files in the folder
– Typing attrib followed by a filename shows the attributes for
that file
• The attrib command can also be used to set file
attributes.
– The attrib command is followed by the attribute letter, the + sign
to set, or the – sign to unset an attribute, and the filename
Guide to Operating Systems, 4th ed.
33
Windows File Systems
• Windows XP, Vista 7, Server 2003, and Server
2008 support three files systems:
– Extended FAT16
– FAT32
– NTFS
• These OSs also support file systems for DVD/CDROM drives and USB devices (flash drives)
Guide to Operating Systems, 4th ed.
34
FAT16 and Extended FAT16
• Extended FAT16 evolved from FAT16 used in
earlier versions of MS-DOS and Windows
(3.x/95/98/Me)
• FAT16
– FAT uses a file allocation table to store directory information
– The “16” in FAT16 means that this file system uses 16-bit
entries in the file allocation table and uses 216 clusters
Guide to Operating Systems, 4th ed.
35
FAT16 and Extended FAT16
• In extended FAT16:
– Maximum size of a volume is 4GB
– Maximum size of a file is 2GB
– Has been around for awhile and can be read by non-Windows
operating systems like UNIX/Linux
– Considered a stable file system
– Long filenames (LFNs) can be used
• Can contain up to 255 characters
• Not case sensitive
• Cannot include “ / \ [ ] : ; = special characters
Guide to Operating Systems, 4th ed.
36
FAT32
• Support for FAT32 started with Windows 95
Release 2
• FAT 32:
–
–
–
–
–
–
–
–
Designed to accommodate larger capacity disks
Avoids the problem of cluster size limitations
The FAT entry is 32 bits in length and supports 228 clusters
The Root folder does not have to be at the beginning of a
volume. It can be located anywhere.
Can use disk space more efficiently than FAT16 (because it
uses smaller cluster sizes)
Largest volume that can be formatted is 32 GB
Maximum file size is 4 GB
Offers fast response on small 1 or 2 GB partitions
Guide to Operating Systems, 4th ed.
37
FAT64
• FAT64 (exFAT) is a proprietary file system
introduced by Microsoft for mobile personal storage
needs to handle large files.
– The size limit for FAT16 is 2 GB minus one byte.
– The size limit for FAT32 is 4 GB minus one byte.
• FAT64 with a limit of 16 EB is a good choice for
USB flash devices that may store large files (such
as pictures, videos, etc…).
• FAT64 is available in Service Pack 1 for Windows
Vista, Windows 7, and Windows Server 2008, Mac
OS X Snow Leopard
• Support is available for Linux from a third party
Guide to Operating Systems, 4th ed.
38
NTFS
• NTFS – the dominant Windows file system for all
Windows operating systems starting with Windows
2000.
– Designed for the needs of a networked environment.
• Uses a Master File Table (MFT) instead of FAT
tables.
– Located at the beginning of the partition.
– The boot sector is located ahead of the MFT.
– Following the MFT, there are several system files that the file
system uses to make all the features of NTFS work.
Guide to Operating Systems, 4th ed.
39
NTFS
• The MFT is nothing more than a file on the file
system.
• The second file on the disk is a copy of the first
three records of the MFT.
– This ensures that if the MFT is damaged, it can be recreated.
– File number five ($) contains the entries in the root directory.
– File number six ($Bitmap) contains data about what clusters on
the disk are in use.
• Normally, the MFT and related files take up about 1
MB of disk space
• When a file is created in NTFS, a record for that file
is added to the MFT.
Guide to Operating Systems, 4th ed.
40
NTFS
• This record contains all standard information
(filename, size, dates, and times).
• It also contains additional attributes such as
security settings, ownership, and permissions.
– The attributes can generally be repeated.
– It is possible to have a whole series of different security
attributes for different users.
• It is also possible to have multiple filenames that
refer to the same file (hard linking).
– Also available in UNIX/Linux file systems, sometimes used to
make the same file appear in multiple directories without having
to allocate disk space for the file more than once.
Guide to Operating Systems, 4th ed.
41
NTFS
• Windows Vista, Server 2008, and 7 use NTFS
version 6
• Windows XP and Server 2003 use NTFS version 5
• Windows NT 4.0 used NTFS 4
Guide to Operating Systems, 4th ed.
42
NTFS
• Basic features of NTFS:
–
–
–
–
–
–
Long filenames
Built-in security features
Better file compression than FAT
Ability to use larger disks and files than FAT
File activity tracking for better recovery and stability than FAT
Portable Operating System Interface for Unix (POSIX)
support
– Volume striping and volume extensions
– Less disk fragmentation than FAT
Guide to Operating Systems, 4th ed.
43
NTFS
• NTFS is equipped with security features that meet
the US government’s C2 security specifications
– Refers to high-level, “top-secret” standards for data protection,
system auditing, and system access
• Examples:
– System files can be protected so only the server administrator
has access
– A folder of databases can be protected with read access, but
no access to change data
– Public folder can give users in a designated group access to
read and update files, but not to delete files
Guide to Operating Systems, 4th ed.
44
NTFS
• File compression is a process that significantly reduces
the size of a file by removing unused space within a file
or using compression algorithms.
• Some files can be compressed by more than 50%,
saving disk storage for other storage needs.
• This is particularly useful for files that are accessed
infrequently.
Guide to Operating Systems, 4th ed.
45
NTFS
• NTFS has the ability to keep a log or journal of file
system activity (journaling)
– Makes it possible for files to be restored in the event of a power
failure
• NTFS supports POSIX standards to enable portability
of applications from one computer to another.
• NTFS supports volume striping
– Process that equally divides the contents of each file across two or
more volumes to extend disk life, enable fault tolerance, and
balance disk load for better performance
• NTFS has hot fix capabilities
– If a bad disk area is detected, automatically copies the information
to another disk area that is not damaged
Guide to Operating Systems, 4th ed.
46
NTFS
• In addition to NTFS 4 features, NTFS 5 adds
several new features:
–
–
–
–
–
Ability to encrypt files
No system reboot required after creating an extended volume
Ability to reduce drive designations
Indexing for fast access
Ability to retain shortcuts and other file information when files
and folders are placed on other volumes
– Ability to establish disk quotas (to control how much disk space
users can occupy)
Guide to Operating Systems, 4th ed.
47
NTFS
• With NTFS 5:
– Files can be encrypted so that their contents are available only
to those granted access.
– Volume extensions can be set up without the need to reboot
the system.
– Volume mount points can be created as a way to reduce the
number of drive designations for multiple volumes, instead of
designating a new drive for each new volume.
– Fast indexing is incorporated in conjunction with Active
Directory to make file searching and retrieval faster.
– Distributed Link Tracking is available so that shortcuts you
have created are not lost when you move files to another
volume.
– Enables you to set up disk quotas to control how much space
users can occupy.
Guide to Operating Systems, 4th ed.
48
NTFS
• NTFS 6 (latest version) adds several new features:
– Transactional NTFS – used to perform operations in
transactions (all at once or not at all).
• You can package registry and file system operations in a
transacyion so that all of the operations take place or none of them
succeed.
– Used heavily in Windows Server 2008.
– Partition resizing – allows administrator to expand or shrink
partitions.
• The capability is still very limited.
• There are third-party products that are more capable and robust.
– Self-healing – the chkdsk utility runs in the background to
correct hard disk problems (instead of having to take the
volume down to run it)
Guide to Operating Systems, 4th ed.
49
NTFS
• The chkdsk utility can detect and fix an extensive
set of file system problems in FAT and NTFS
system
– This utility is available in all versions of Windows starting with
Windows 2000
– The most common problems found are files with 0 sizes,
caused when a file is not properly closed or chains of clusters
that have no directory entries
• Windows 2000 and later versions have a built-in
disk defragmenting tool
– Rearranges data on the disk in a continuous fashion, ridding
the disk of scattered open clusters
Guide to Operating Systems, 4th ed.
50
NTFS
FAT16, FAT32, FAT64, and NTFS compared
Guide to Operating Systems, 4th ed.
51
CDFS and UDF
• Windows versions after Windows 2000 recognize
some additional file systems used by peripheral
storage technologies
• CD-ROM File System (CDFS) – supported so that
OSs can read and write files to DVD/CD-ROM
drives
• Universal Disk Format (UDF) – also used on
DVD/CD-ROMs, which are used for huge file
storage to accommodate movies and games
Guide to Operating Systems, 4th ed.
52
The UNIX File System
• There are many different file systems that can be
used with UNIX
– Some file systems are more “native” to specific UNIX operating
systems than others
• Most versions of UNIX and Linux support the UNIX
file system (ufs), which is the original native UNIX
file system
– ufs is a hierarchical (tree structure) file system that is
expandable, supports large storage, provides excellent
security, and is reliable
– Many qualities of NTFS are modeled after ufs (journaling and
hot fixes)
Guide to Operating Systems, 4th ed.
53
The UNIX File System
• In Linux, the native file system is called the
extended file system (ext or ext fs)
• ext is modeled after ufs and enables the use of the
full range of built-in Linux commands, file
manipulation, and security
• The first ext version had bugs
– ext2 – reliable file system that handles large disk storage
– ext3 – added journaling capabilities
– ext4 – supports file sizes up to 16 TB
Guide to Operating Systems, 4th ed.
54
The UNIX File System
• Both ufs and ext use the same structure
– Built on the concept of information nodes (or inodes)
– Each file has an inode and is identified by an inode number
• Inode 0 contains the root of the folder structure and is the jumping
off point for all other inodes.
– The “inode” is sometimes referred to as an index node.
– It is a file structure on a file system.
• It is a “database” of all file information except the file congtents
and the file name.
– In a file system, inodes consist roughly of 1% of the total disk
space.
– The inode space is used to “track” the files stored on the hard
disk.
Guide to Operating Systems, 4th ed.
55
The UNIX File System
• Both ufs and ext use the same structure
– The inode entries store metadata about each file, directory or
object, but only points to these structures rather than storing
the data.
– Each entry is 128 bytes in size.
– The metadata contained about each structure can include the
following:
•
•
•
•
•
•
•
Inode number
Access Control List (ACL)
Extended attribute
Direct/indirect disk blocks
Number of blocks
File access, change and modification time
File deletion time
Guide to Operating Systems, 4th ed.
56
The UNIX File System
• Both ufs and ext use the same structure
– The metadata contained about each structure can include the
following:
•
•
•
•
•
•
•
•
File generation number
File size
File type
Group
Number of links
Owner
Permissions
Status flags
– The inode space is used to “track” the files stored on the hard
disk.
– The pointer information is based on logical blocks.
Guide to Operating Systems, 4th ed.
57
The UNIX File System
• Both ufs and ext use the same structure
– The metadata does not include the file’s name.
– Rather than the name, the inode of each file uses a pointer to
the specific file, directory, or object.
– The pointer is a unique number which usually is referred to as
the inode number.
• The inode for a file contains a pointer (number) that tells the OS
how to locate the first in a set of one or more logical blocks that
contain the specific file contents.
– It tells the OS where to find a file on the hard disk.
– The pointer information is based on logical blocks.
– Each disk is divided into logical blocks ranging in size from 512
bytes to 8192 bytes or more.
• Depending on the version of UNIX/Linux.
• Blocks can also be divided into multiple subblocks or fractions as
needed by the file system.
Guide to Operating Systems, 4th ed.
58
The UNIX File System
• When the file system is created, a fixed number of
inodes are created.
• Because every unique file uses an inode on the file
system, and because it’s not possible to increase
or decrease the number of inodes, the inodes
created need to be set high enough so that the
system can hold enough files.
Guide to Operating Systems, 4th ed.
59
The UNIX File System
• Everything in the UNIX/Linux is tied to inodes.
• Space is allocated one block, or fraction of a block,
at a time.
• The directories in this file system are simple files
that have been marked with a directory flag in their
inodes.
• The file system is identified by the superblock.
– Contains information about the layout of blocks, sectors, and
cylinder groups on the file system.
• File system type
• Status
• Information about other metadata structures
Guide to Operating Systems, 4th ed.
60
The UNIX File System
– Without the superblock, the file system would be lost.
– Many copies of the superblock are written into the file system at
the time of the file system creation.
– If the superblock is destroyed, you can copy one of the
superblock copies over the original, damaged superblock to
restore access to the file system.
• The inode does not contain a filename.
• The filename is stored in a directory, which in itself
is no more than a file.
– In it is stored the names of the files and the inode to which they
are connected.
Guide to Operating Systems, 4th ed.
61
The UNIX File System
– Several directory entries can point to the same inode.
• This implements a hard link
• Makes it possible to have one file appear in several directories, or
in the same directory under several names, without using a lot of
disk space.
• The inode keeps a counter that tells how many
directory entries point to a file.
• Deleting a file is achieved by deleting the last
directory entry, which brings the inode link count
down to 0.
Guide to Operating Systems, 4th ed.
62
The UNIX File System
• A UNIX/Linux system can have many file systems
– Unlike MS-DOS and Windows where each file system must
have a letter of the alphabet assigned to it to enable access.
– Mounts file systems as a sub file system of the root file system
– All file systems are referred to by a path
– The path starts out with / (/ indicates the main root directory of
the file system) (Figure 4-14).
Guide to Operating Systems, 4th ed.
63
The UNIX File System
UNIX/Linux file system path entries
Guide to Operating Systems, 4th ed.
64
The UNIX File System
• A UNIX/Linux system can have many file systems
– The path starts out with /
• Indicates the main root directory of the root file system.
– If other file systems are to be used, a directory is created on the
root file system (“usr”).
• Using the mount command, the UNIX/Linux OS is told to associate
the root inode of another file system to the empty directory.
– This process can be repeated many times.
– There is no hard limit to the number of file systems that can be
mounted this way (short of the number of inodes in the root file
system).
Guide to Operating Systems, 4th ed.
65
The UNIX File System
• A UNIX/Linux system can have many file systems
– Directories in the file system contain a series of filenames.
• Directory names are no more than filenames.
• UNIX/Linux allows the use of long filenames, which may include
any character that can be represented by ASCII.
– A directory is nothing more than a special file.
– Other special files in the UNIX/Linux file system:
• Disks are referenced special node called a device.
– A raw device has no logical division in blocks.
– A block device does have a logical division in blocks.
– Every device the UNIX/Linux computer uses must be
represented by a device inode.
• These devices have special parameters in the inode that enable
the OS to figure out how to get to them.
Guide to Operating Systems, 4th ed.
66
The UNIX File System
• Devices are normally kept in the /dev or /devices
directory
• Symbolic link – Another special feature of the
UNIX/Linux file system.
– Used to link a directory entry to a file that is on a different
partition
– A special file that has a flag set in the inode to identify it as a
symbolic link.
– The content of the file leads to another file.
• The OS reads the content of the symbolic link file and interpretes
that as if it were the filename typed
– Merely a pointer to a file
Guide to Operating Systems, 4th ed.
67
The UNIX File System
• You must first partition a disk to use the UNIX/Linux file
system
• The command to partition the disk differs slightly
– Most UNIX systems use either fdisk or format
– Typing man fdisk or man format at the command prompt gives you an
overview of available commands
Guide to Operating Systems, 4th ed.
68
The UNIX File System
• Once a partition is made, a file system can be
created
– You must know the device name of the partition on which you
wish to create a file system.
• This name can be obtained from the print partition table command
in fdisk or format.
– The most convenient way to create a new file system is to type
newfs, followed by the name of the device.
– When newfs is completed, you can make a mount point for a
new file system.
– The newfs command uses the mkfs command to actually
create the file system.
Guide to Operating Systems, 4th ed.
69
The UNIX File System
– The newfs command is not available in all versions of Linux.
• In UNIX/Linux varieties where newfs is not available, mkfs is used
instead.
• If UNIX/Linux finds problems on the file system in
the inodes, superblock, or directory structures, it
will shut down.
Guide to Operating Systems, 4th ed.
70
The UNIX File System
• When a file is saved to disk, the system first stores
part of the data in memory until it has time to write
it to disk.
– If computer is shut down prior to data being written to disk, you
can end up with a damaged file system
– UNIX/Linux systems should always be shut down using proper
shutdown commands
• Ensures that all data waiting to be saved
– In normal operation, all data waiting to be saved to disk in
memory is written to disk every 30 seconds.
– You can manually force a write of all data in memory by using
the sync command.
Guide to Operating Systems, 4th ed.
71
The UNIX File System
– When the system is properly shut down, the file systems are
unmounted.
– A flag is set in the superblock of each file system to indicate
that the file system was properly closed, and does not need to
be checked at startup.
• Another utility is known as fsck
– Verifies the integrity of the superblock, the inodes, all cluster
groups, and all directory entries.
Guide to Operating Systems, 4th ed.
72
The UNIX File System
UNIX/Linux file system commands
Guide to Operating Systems, 4th ed.
73
The Macintosh File System
• The original Macintosh Filing System (MFS) of
1984 was limited to keeping track of 128
documents, applications or folders
– A reasonable limit when the only storage device was a 400 KB
floppy disk drive.
– As larger disks became available, the need for directories and
subdirectories became obvious.
• In 1986, Apple created the Hierarchical Filing
System (HFS)
– Divides a volume (disk or disk partition) into allocation blocks –
similar to clusters on PCs.
Guide to Operating Systems, 4th ed.
74
The Macintosh File System
• In 1998, Apple released Mac OS 8.1 with a new file
system called Hierarchical Filing System
Extended Format (HFS+)
– Used today in Mac OS X.
– Increases the number of allocation blocks
– Creates smaller allocation blocks (clusters) and more efficient
disk utilization.
Guide to Operating Systems, 4th ed.
75
The Macintosh File System
• In Mac OS X version 3.0, Mac OS Extended
(HFS+) includes new features:
– A case-sensitive format to make the file system more
compatible with other UNIX/Linux systems
– Journaling
• Turned on by default
• Data can be recovered from a journal file if there is a disk or
system problem that occurs while data is being updated or
modified.
– Ability to store up to 16 TB of data.
Guide to Operating Systems, 4th ed.
76
The Macintosh File System
• The first two sectors of a Mac-formatted disk are:
– Boot sectors (boot blocks)
• Identify the filing system, the names of important system files, and
other important information.
– Volume information block
• Points to other important areas of information
– Location of the system files
– The catalog and extent b-trees
– Catalog b-tree
• A list of all files on the volume.
• Keeps track of a file’s name, location in the folder structure, and its
physical location.
– Extents b-tree
• Keeps track of the location of the file fragments and extents
Guide to Operating Systems, 4th ed.
77
The Macintosh File System
• Macintoshes can read and write to disks from other
operating systems
• Mac OS has always supported what might be
called medium filenames (up to 31 characters)
– Any character may be used in a filename except the colon (:)
– Reason for this: Macintosh paths are written as colonseparated entities such as:
• Hard Drive:System Folder:Preferences:Finder Prefs
• The Mac uses type codes and creator codes
instead of filename extensions as in Windows
– Files created with Apple’s SimpleText editor have a type code
of APPL and a creator code of ttxt
Guide to Operating Systems, 4th ed.
78
The Macintosh File System
• Macintosh files can contain two parts (forks):
– Data fork – contains frequently changing information (such as
word processing data).
• Most Mac documents contain only a data fork.
– Resource fork – contains information that is fixed (such as a
program’s icons, menu resources, and splash screens)
• It becomes very easy to change the text of a warning dialog or the
name of a menu item without having to change the underlying
code.
• Customization and internationalization are easier.
– A clever use of the data and resource forks.
• Text is stored in the data fork.
• Style information (font face, color, font size, italics, etc.) is stored
in the resource fork.
Guide to Operating Systems, 4th ed.
79
The Macintosh File System
• Because Mac files have type and creator codes
and two forks can create problems when storing
files on non-Macintosh servers.
– The need to store Mac files on non-Mac computers has led to
several Mac file formats for online services and the Internet.
• MacBinary – format which joins the two forks into one, and safely
stores the type and creator codes and finder flags.
• BinHex – For files that must be transferred through seven-bit
gateways.
– Transforms all files into seven-bit files using the ASCII character set.
– Preserves the two forks, the type and creator codes, and the finder
flags.
Guide to Operating Systems, 4th ed.
80
The Macintosh File System
• Apple’s equivalent to a Windows shortcut is the
alias (introduced in System 7.0 in 1991)
– Files, folders, applications, and disks can be aliased.
– The system-level Alias Manager keeps track of the original
– The word “alias” is tacked onto the filename when the alias is
created and the filename is italicized
• Mac OS X comes with two disk utilities:
– Disk Utility – manages disk drives
– Disk First Aid – repairs disk problems
Guide to Operating Systems, 4th ed.
81
The Macintosh File System
• Mac OS X also comes with a utility (Sherlock) that
searches disks for filenames and text within files
– These operations are extremely fast because Sherlock preindexes local disks.
– Because indexing takes significant processor time, indexing
can be scheduled for times when the computer is not heavily
used.
Guide to Operating Systems, 4th ed.
82
The Macintosh File System
• Spotlight replaced Sherlock in Mac OS X 10.4
Tiger.
– Indexes files so you can find them faster.
– Enables you to search for something by just typing a few letters
of the name.
– Quickly searches the computer’s nooks and crannies for what
you wan5, even if you’re not sure how to spell it.
– Works in conjunction with the smart folders capability to
organize files you’ve found according to different
characteristics.
Guide to Operating Systems, 4th ed.
83
The Macintosh File System
A Spotlight search in Mac OS X Snow Leopard
Guide to Operating Systems, 4th ed.
84
The Macintosh File System
• When the Mac is shut down normally, a flag is set
on the hard drive.
• When a Mac is not shut down properly:
– This flag is not set;
– A disk integrity check will automatically run at the next startup.
• Macs will boot from a DVD/CD-ROM or various
SCSI devices
– To boot from a DVD/CD-ROM, press the “C” key while booting
up
– Pressing the Shift-Option-Delete-Apple (SODA) keys while
booting will bypass the internal hard drive and boot from the
next drive in a SCSI chain
Guide to Operating Systems, 4th ed.
85
Chapter Summary
• For the user, files are the “bread and butter” of an operating
system. Besides containing the operating system kernel, files hold
documents and programs on which users rely.
• Files are made possible by a file system that enables them to be
created, written, managed, and stored on disk media. All OSs must
have a file system that provides a file-naming convention, a way to
store files, and a means to partition and format disks.
• Besides creating and modifying files, the file system also should
offer the ability to defragment files, compress file contents, ensure
file and data integrity, secure files, and control removable storage
media.
• The main file systems used in Windows since Windows 2000 are
extended FAT16, FAT32, and NTFS.
Guide to Operating Systems, 4th ed.
86
Chapter Summary
• In FAT16 and FAT32, the file system creates a file allocation
table to store information about files.
• FAT32 is more robust than FAT16, providing for the use of
more clusters and larger partitions.
• FAT64 (exFAT) is mainly used for personal mobile storage
devices like flash drives.
• NTFS is the native file system for Windows 2000 and after
with the advantage of better security, larger disk and file
sizes, better management tools, and greater stability than
FAT16 and FAT32.
• chkdsk is an important disk verification and repair utility that
works for FAT16, FAT32, and NTFS.
Guide to Operating Systems, 4th ed.
87
Chapter Summary
• UNIX and Linux support many support many different file
systems but typically employ ufs or ext
• ufs and ext use information nodes (inodes) to organize
information about files.
• Different varieties of UNIX/Linux use different file system
utilities, such as fdisk and format to partition and format
disks. The fsck (file system checker) utility is used to verify
the integrity of UNIX/Linux file systems.
• Mac OS X uses Mac OS Extended (HFS+) file system, which
is an enhancement of HFS and was introduced in 1998 with
Mac OS 8.1.
Guide to Operating Systems, 4th ed.
88
Chapter Summary
• Two important Mac OS X disk tools include Disk Utility and
Disk First Aid.
• Table 4-8 shows the disk management tools you have
learned about in the chapter. Of these tools, the Mac OS X
tool might be the most “one-stop,” because you can use it to
configure, repair, and manage disks.
Guide to Operating Systems, 4th ed.
89