Download File Systems_PPT_ch04

Document related concepts

Unix wikipedia , lookup

MTS system architecture wikipedia , lookup

Berkeley Software Distribution wikipedia , lookup

Object storage wikipedia , lookup

Library (computing) wikipedia , lookup

Security-focused operating system wikipedia , lookup

DNIX wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

Commodore DOS wikipedia , lookup

RSTS/E wikipedia , lookup

Windows NT startup process wikipedia , lookup

OS 2200 wikipedia , lookup

Batch file wikipedia , lookup

System 7 wikipedia , lookup

Burroughs MCP wikipedia , lookup

Spring (operating system) wikipedia , lookup

Paging wikipedia , lookup

File Allocation Table wikipedia , lookup

Computer file wikipedia , lookup

VS/9 wikipedia , lookup

CP/M wikipedia , lookup

Unix security wikipedia , lookup

Transcript
Guide to Operating Systems,
th
5 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
© Cengage Learning 2017
2
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
© Cengage Learning 2017
3
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
© Cengage Learning 2017
4
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
© Cengage Learning 2017
5
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
© Cengage Learning 2017
6
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
© Cengage Learning 2017
7
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.
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
8
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
© Cengage Learning 2017
9
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
© Cengage Learning 2017
10
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
© Cengage Learning 2017
11
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
© Cengage Learning 2017
12
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
© Cengage Learning 2017
13
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
© Cengage Learning 2017
14
Hierarchical Structure
Figure 4-2 Sample folder structure for a Windows-based system
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
15
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
© Cengage Learning 2017
16
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
© Cengage Learning 2017
17
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
© Cengage Learning 2017
18
Hierarchical Structure
Figure 4-3 Fedora root folders in the GNOME Files tool
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
19
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
© Cengage Learning 2017
20
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
© Cengage Learning 2017
21
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
© Cengage Learning 2017
22
File Metadata
Figure 4-4 Windows file metadata
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
23
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
© Cengage Learning 2017
24
Storage Device Space Organization
Figure 4-5 Disk tracks and sectors on a platter
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
25
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
© Cengage Learning 2017
26
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
© Cengage Learning 2017
27
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
© Cengage Learning 2017
28
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
© Cengage Learning 2017
29
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
© Cengage Learning 2017
30
Storage Device Space Organization
Figure 4-6 Multiple partitions used in one Windows 10 system
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
31
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
© Cengage Learning 2017
32
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
© Cengage Learning 2017
33
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
© Cengage Learning 2017
34
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
© Cengage Learning 2017
35
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
© Cengage Learning 2017
36
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
© Cengage Learning 2017
37
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
© Cengage Learning 2017
38
Storage Device Space Organization
Figure 4-7 A disk with primary and extended partitions
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
39
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
© Cengage Learning 2017
40
Storage Device Space Organization
Figure 4-8 Using a volume mount point in Windows
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
41
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
© Cengage Learning 2017
42
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
© Cengage Learning 2017
43
Storage Device Space Organization
Table 4-1 Format command switches
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
44
Storage Device Space Organization
Table 4-1 Format command switches (continued)
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
45
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
© Cengage Learning 2017
46
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
© Cengage Learning 2017
47
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
© Cengage Learning 2017
48
Storage Device Space Organization
Figure 4-9 Typical FAT directory structure
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
49
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
© Cengage Learning 2017
50
Storage Device Space Organization
Table 4-2 Attribute command (attrib) arguments and switches
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
51
Windows File Systems
• Windows XP through Windows Server 2008 R2
support three files systems:
– Extended FAT16
– FAT32
– NTFS
• Windows 8, Windows Server 2012, and later
versions also support ReFS
• These OSs also support file systems for DVD/CDROM drives and USB devices (flash drives)
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
52
FAT16 and Extended FAT16
• Extended FAT16 evolved from FAT16 used in
earlier versions of MS-DOS and Windows
(3.x/95/98/Me)
• In extended FAT16:
–
–
–
–
–
Maximum size of a volume is 4GB
Maximum size of a file is 2GB
Can be read by non-Windows OSs like UNIX/Linux
Considered a stable file system
Long filenames (LFNs) can be used
• Can contain up to 255 characters
• Not case sensitive
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
53
FAT32
• Support for FAT32 started with Windows 95
Release 2
• Designed to accommodate larger capacity disks
• FAT32:
– Root folder does not have to be at the beginning of a
volume
– Can use disk space more efficiently than FAT16
• 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, 5th Edition
© Cengage Learning 2017
54
FAT64
• FAT64 is also known as exFAT
• Proprietary file system introduced by Microsoft for
mobile personal storage
• Good choice for USB flash devices that may store
large files (such as pictures, videos, etc…)
– Maximum size of a file is 16 EB
• Available starting in Service Pack 1 for Windows
Vista
• Support is available for Linux from a third party
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
55
NTFS
• NTFS – primary Windows file system for all
Windows OSs starting with Windows NT 3.1
• Uses a Master File Table (MFT) instead of FAT
tables
• The MFT and related files take up about 1 MB of
disk space
• When a file is created, a record for that file is
added to the MFT
– Contains additional attributes such as security
settings, ownership, and permissions
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
56
NTFS
• The MFT record reflects the sequence of clusters
that a file uses
• It is possible to have multiple filenames that refer to
the same file
– A technique known as hard linking
– This feature is also available in UNIX/Linux file
systems
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
57
NTFS
Table 4-3 NTFS versions
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
58
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, 5th Edition
© Cengage Learning 2017
59
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
• Some files can be compressed by more than 40%,
saving disk storage for other storage needs
• NTFS has the ability to keep a log or journal of file
system activity (called journaling)
– Makes it possible for files to be restored in the event
of a power failure
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
60
NTFS
• 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, 5th Edition
© Cengage Learning 2017
61
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
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
62
NTFS
• NTFS 6 (latest version) adds several new features:
– Transactional NTFS – used to perform operations in
transactions (all at once or not all)
– Partition resizing – allows administrator to expand or
shrink partitions
– 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, 5th Edition
© Cengage Learning 2017
63
NTFS
Table 4-4 FAT16, FAT32, FAT64, and NTFS compared
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
64
NTFS
• Basic disks use traditional disk partitioning
techniques
– Limited to four primary partitions or three primary
partitions and one extended partition
• Dynamic disks do not use traditional partitioning
techniques
– Make it possible to set up a large number of volumes
– Can convert basic disk to dynamic disks using the
Disk Management tool
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
65
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
• Windows 2000 and later versions have a built-in
disk defragmenting tool
– A defragmenter is a tool that rearranges data on the
disk in a continuous fashion, ridding the disk of
scattered open clusters
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
66
NTFS
Table 4-5 Chkdsk switch options
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
67
NTFS
Figure 4-11 Disk Defragmenter in Windows 10
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
68
Resilient File System (ReFS)
• ReFS became available staring with Windows
Server 2012
– Main use is in large file-sharing applications where
volumes are managed by Storage Spaces
– Mostly backward-compatible with NTFS
• Doesn’t support file compressions, disk quotas, and
EFS (Encrypting File System)
– Windows can’t be booted from an ReFS volume
– Can correct some types of data corruption
automatically
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
69
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 large file
storage to accommodate movies and games
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
70
The UNIX/Linux 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 file system that is expandable,
supports large storage, provides excellent security,
and is reliable
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
71
The UNIX/Linux 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, 5th Edition
© Cengage Learning 2017
72
The UNIX/Linux File System
Table 4-6 Typical file system supported by UNIX/Linux
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
73
The UNIX/Linux 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
– An inode contains general information about that file
such as:
• User and group ownership, permissions, size and type
of file, date the file was created, and the date the file
was last modified and read
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
74
The UNIX/Linux File System
• Both ufs and ext use the same structure
– Each disk is divided into logical blocks
• The superblock contains information about the layout
of blocks, sectors, and cylinder groups on the file
system
– The inode does not contain a filename; the filename
is stored in a folder
– Several folder entries can point to the same inode
• Called a hard link
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
75
The UNIX/Linux File System
• A UNIX/Linux system can have many file systems
– 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)
• The mount command has several options
– Typing it without parameters results in a display of
the disks currently mounted
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
76
The UNIX/Linux File System
Figure 4-14 UNIX/Linux file system paths
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
77
The UNIX/Linux File System
• Disks are referenced by a special inode called a
device
• There are two types of devices:
– Raw device – has no logical division in blocks
– Block device – does have logical division in blocks
• Devices are normally kept in the /dev or /devices
directory
• Symbolic link – used to link a directory entry to a
file that is on a different partition
– A pointer to a file
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
78
The UNIX/Linux 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, 5th Edition
© Cengage Learning 2017
79
The UNIX/Linux File System
Figure 4-15 The man page for the fdisk command
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
80
The UNIX/Linux 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
– Type newfs, followed by the name of the device
– The newfs command is not available in all versions
of Linux
• Use the mkfs command instead
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
81
The UNIX/Linux File System
• When a file is saved to disk, the system stores part
of the data to memory
– Until it has time to write to disk
– If computer is shut down prior to data being written
to disk, you can end up with a damaged file system
– Manually force a write of all data in memory by using
the sync command
• Fsck – a utility that verifies the integrity of the
superblock, the inodes, all cluster groups, and all
directory entries
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
82
The UNIX/Linux File System
Table 4-7 UNIX/Linux file system commands
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
83
The Macintosh File System
• Macintosh Filing System (MFS) of 1984 was limited
– Kept track of 128 documents, applications or folders
– Reasonable limit when the only storage device was
a 400 KB floppy disk drive
• In 1986, Apple created Hierarchical Filing System
(HFS)
– Divided a volume (disk partition) into allocation
blocks – similar to clusters on PCs
• In 1998, Apple released Mac OS 8.1 with a new file
system called Hierarchical Filing System Extended
Format (HFS+)
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
84
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
– Ability to store up to 16 TB of data
• The first two sectors of a Mac-formatted disk are:
– Boot sectors, or boot blocks
– Followed by volume information block – contains
catalog b-tree
• A list of all files on the volume.
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
85
The Macintosh File System
• Macintoshes can read/write to disks from other OSs
• Mac OS has always supported medium filenames
(up to 31 characters)
– Any character may be used in a filename except the
colon (:)
– Macintosh paths are written as colon-separated
entities such as:
• Hard Drive:System Folder:Preferences:Finder Prefs
• Mac uses type codes and creator codes instead of
filename extensions as in Windows
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
86
The Macintosh File System
• Macintosh files can contain two parts, or forks:
– Data fork – contains frequently changing information
(such as word processing data)
– Resource fork – contains information that is fixed
(such as a program’s icons, menu resources, and
splash screens)
• Apple’s equivalent to a Windows shortcut is the alias
– 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
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
87
The Macintosh File System
• Mac OS X comes with two disk utilities:
– Disk Utility – manages disk drives
– Disk First Aid – repairs disk problems
• Older versions of Mac OS X came with a utility
(Sherlock) that searches disks for filenames and
text within files
– Spotlight replaced Sherlock in Mac OS X 10.4 Tiger
• Spotlight indexes by filenames and by metadata
associated with documents
– Does not work on files in the UNIX system/kernel
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
88
The Macintosh File System
Figure 4-19 A Spotlight search in Mac OS X
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
89
The Macintosh File System
• When a Mac is not shut down properly 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, 5th Edition
© Cengage Learning 2017
90
Summary
• One of the basic functions of an OS is to enable
you to store and access information on a
computer or other digital device
• Tasks performed by a file system include
providing a convenient interface, providing a
hierarchical structure, storing file metadata,
organizing space on a storage device, and
providing utilities to maintain and manage the
file system
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
91
Summary
• The file system should offer the ability to
defragment files, compress file contents,
ensure file and data integrity, secure files, and
control removable storage media
• Before a file system can be placed on a hard
disk, the disk must be partitioned and formatted
• FAT64 (exFAT) is mainly used for flash drives
• NTFS is the native file system for Windows
2000 and later
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
92
Summary
• ReFS became available starting with Windows
Server 2012
• Chkdsk is an important disk verification and repair
utility that works for FAT16, FAT32, and NTFS
• UNIX and Linux support many different file systems
• 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
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
93
Summary
• Mac OS X uses the Mac OS Extended (HFS+) file
system
• Two important Mac OS X disk tools include the
Disk Utility and Disk First Aid
Guide to Operating Systems, 5th Edition
© Cengage Learning 2017
94