operating system concepts and techniques lecture 18
DESCRIPTION
Operating System Concepts and Techniques Lecture 18. Information management-2* FFS, UFS2, NTFS M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., 2011. To order: www.iUniverse.com , www.barnesandnoble.com, or www.amazon.com - PowerPoint PPT PresentationTRANSCRIPT
Operating System Concepts and
Techniques Lecture 18
Information management-2*FFS, UFS2, NTFS
M. Naghibzadeh
ReferenceM. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., 2011.
To order: www.iUniverse.com, www.barnesandnoble.com, or www.amazon.com
* Information management is not usually covered in the first course of operating systems
Fast file systemLarger block size than UFS
To avoid excess internal fragmentation: A data block is divided into a number of equal size
fragments (often eight). These fragments can be independently assigned to files and directories
Since UNIX frequently has many small files and directories, most of the time these are placed in the
fragments left over by larger directories and files In the file’s or directory’s i-node eight bits are
reserved to show which segments of the last data block is occupied by this file
A one means it is used and a zero means otherwise
2
Fast file system...Based on UFS
Data blocks of a file or directory are stored in cylinders that are placed as close as possible to
each other A number of adjacent cylinders are called a cylinder
group The on-disk i-node of a file or directory is stored in
the same cylinder group of the file or directory Data blocks of directories are distributed across the
whole disk’s data area so that a directory’s data blocks are close to its files data blocks
Furthermore, a file’s and directory’s on-disk i-node is stored as close as possible to the file’s or directory’s
data blocks
3
Fast file system...Other improvements:
The Berkeley FFS has two superblocks instead of one. If one of the superblocks becomes
faulty the system immediately switches to the other and starts repairing
Another FFS enhancement is the increase in the file name’s length to 255 characters
Yet another improvement is its two different block sizes, for example, 4K and 8K
For small size files (or directories), the first block size is used and for large size files
there is the second block size.
4
FFS adv/disadvAdvantages:
Accessing a directory’s or file’s data is faster because the number of seek times is usually less than that of the original UFS file system
Disk head movements are reduced thus raising overall performance
Superblock failure recovery is possible Can be used with UFS and USF2
Disadvantage: Increases the complexity of the file system
implementation
5
UNIX File System 2Based on UFS
Pointers to USF2 data blocks are eight bytes long, one tera byte file can be stored
the size of each i-node is 256 bytes Usually few bunch of consecutive blocks are
assigned, simultaneously Number of pointes is reduced
6
NTFS file systemObjectives:
Supporting a wide range of systems; has many versions
Recoverability File system recovery; use of transaction concept
Security and protection File and directories are considered object, must
have the right to access Memories are cleared before allocation
Windows provides the capability to encrypt file information upon the user’s request
Very large files A file can be as large as 264 bytes
7
VolumeVolume is a collection of clusters for which a file
system is usedCan be part of a disk, a disk, or a set of parts of
many disksThe maximum size of a volume is 264 bytes
Four general sections are identified in a volume
Like UNIX, files and directories are treated the same
in NTFS, name, attributes, and data of files all called attributes
8
Boot sector Master file table Recovery data Attributes and data blocks
Boot sectorOne OS per volume possible, one boot sector
per OSBoot sector (Master Boot Record (MBR) in 32-
bit or GUID (Globally Unique Identifier) Partition Table (GPT) in 64-bit )
512 bytes Very essential metadata of the volume such as, the
number of bytes per sector, the number of sectors per cluster, disk type (floppy, hard), the number of
sectors per record, the location of master file tables, disk identification, and whether the volume is
bootable or not A small machine language program
9
10
NTFS Boot Sector0x00 3B Jump Instruction
0x03 8B OEM-ID (original equipment manufacturer-id)
0x0B 25B BPB (BIOS Parameter Block)*0x24 48B Extended BPB*
0x54 426B Bootstrap Code. 0x1FE 2B End of Sector Marker
* 0x0B, Bytes per sector.
0x0D Sectors per Cluster
0x15 Media descriptor. F8: HD; F0: HD Floppy
0x28 Total sectors.
0x30 Logical cluster number for the MFT
0x38 Logical cluster number copy of the MFT
0x40 Clusters per MFT Record.
0x48 Volume serial
NTFS Master File TableInformation on how to find files and directories
attributes and dataA record based file; each record is 1K
There is at least one record for each file (or directory) called base record
A file’s entire metadata may not fit in one record; in such case, extended records are allocated
A file of variable sizeNot all attribute names are applicable to all filesFirst 16 records are reserved for metadata files,
their name begins with $First four entries are replicated for MFT repair
11
Master File Table
12
$Mft Master file table $MftMirr Mirror copy of Mft $LogFile Log file for recovery $Volume Volume file $AttrDef Attribute definition $ Root directory $Bitmap Bitmap of clusters used $Boot Bootstrap loader $BadClus List of bad clusters $Secure Security descriptors of files $Upcase Case conversion table $Extend Extension: quotas, etc Reserved for future use Reserved for future use Reserved for future use Reserved for future use A User file A User file . . .
0123456789101112131415...
System files
User filesand system and user
files extensions
1K
An MFT recordDifferent sections of a MFT record
13
Some metadata Other MFT records for this file File data clusters Unused
ExampleExample: Suppose a file’s data is stored in
cluster numbers 501, 502, 503, 585, 586, 587, 588, 589, 621, 622, 623, 624, 625, 674, 675,
676, 677, 678, 690, and 691How this information is stored in the file’s base
and extended MFT records?If each set of adjacent clusters is called a
bunch, then this file’s clusters will form five bunches: 501 to 503, 585 to 589, 621 to 625,
674 to 678, and 690 to 691Suppose also that two MFT records are needed
to save the attributes of this file
14
Example…The first record is the base record with record
number sya 125 and the second one is an extended record with record number say 482
Roughly speaking, the information shown in the figure above is stored in the base record of
this fileThe information in the figure below is stored in
the extended record of this file
Headers are delimeters
15
Headers and file attributes Header 482 Header 501 3 583 5 621 5
Headers 674 4 690 2 Free space
Accessing a file and its data
Suppose the following figure is the structure of the files and directories of the specific volume
in which file K’s data is to be located
The absolute path of the file is /C/R/KD
16
B C
RSWX
A D
P
Q L K
Directory
File
Accessing a file and its data...
17
Root directory is stored in record number 5 of MFTSuppose root’s data are stored in say cluster no. 950
Cluster number 950 is accessed, the information is the names and base MFT records of the root directory’s files
and directoriesA sequential or B+ search locates C and its base MFT
record is 125This record is accessed just as C was searched for with record 5 replaced by 125 and C replaced by R, suppose
record 85 is the base MFT record for RNow, K must be found; suppose this is done and the
base MFT record 94 is extracted for file KFrom this base record and its extensions, all metadata
and data of file K can be located
18
NTFS SummaryBerkeley Fast File System was briefly discussedUNIX File System 2 was also briefly introduced
The design details of New Technology File System was studied
Each file on an NTFS volume is represented by a record in a special file called the master file
table (MFT)The first 16 records of MFT are for special filesEach file and directory has a base MFT record and zero or more extended record to store its
metadataDirectories are also viewed as files by NTFS
An example was presented to show how a file’s metadata and data are stored and how we can
locate a file or directory
19
Find outThe advantages of UFS2 over USF
The detailed information stored in base MFT record
What is the purposes of record numbers 12, 13, 14, and 15 of the MFT file
The maximum size of a file whose metadata and data can completely fit in its base MFT record
The purposes of record number four of MFT fileHow we can use two disks as one volume
Which records of the MFT file are duplicatedThe purposes of duplicating some records of the
MFT file
20
Any questions?