2. File Systems
File Systems
File organization
File organization
Access methods
Access methods
Directory Organization: single, two-level,
Directory Organization: single, two-level,
hierarchy
hierarchy
File system and directory implementation
File system and directory implementation
Allocation schemes : contiguous, linked,
Allocation schemes : contiguous, linked,
indexed
indexed
3. File system
File system
In a computer, a file system (sometimes written
In a computer, a file system (sometimes written
filesystem) is the way in which files are named and
filesystem) is the way in which files are named and
where they are placed logically for storage and retrieval.
where they are placed logically for storage and retrieval.
The logical unit within a file system is the file
The logical unit within a file system is the file
logical files are mapped into physical entities by the OS
logical files are mapped into physical entities by the OS
in user's view, file is the smallest unit that can be saved
in user's view, file is the smallest unit that can be saved
to disk
to disk
4. A file system defines the structure and the rules used to
A file system defines the structure and the rules used to
read, write, and maintain information stored on a disk.
read, write, and maintain information stored on a disk.
Which system used is determined by;
Which system used is determined by;
Hardware
Hardware
Software
Software
Security needs
Security needs
Need for a dual-booting system
Need for a dual-booting system
5. File Attributes
File Attributes
name
name : provides handle for reference
: provides handle for reference
•
• DOS (8 chars + 3 char extension), Windows
DOS (8 chars + 3 char extension), Windows
(unlimited? length)
(unlimited? length)
•
• UNIX (spaces tricky, no extension needed)
UNIX (spaces tricky, no extension needed)
type
type : indicates how the file should be treated
: indicates how the file should be treated
•
• DOS/Windows rely on extension, can map extensions
DOS/Windows rely on extension, can map extensions
to programs
to programs
•
• Mac associates creator attribute with each file (OS X?)
Mac associates creator attribute with each file (OS X?)
•
• UNIX uses "magic number", first few bytes of file
UNIX uses "magic number", first few bytes of file
specify file type
specify file type
6. protection : permissions, access control information
• UNIX utilizes permission string: chmod 644 foo.txt
-rw-r--r—
owner & group: chown, chgrp
• Windows utilizes file properties/attributes: NoAccess,
List, Read, Read & Add, …
Location & Size
Accounting Information
7. e.g. MS-DOS filename
e.g. MS-DOS filename
Filename: 1 to 8 characters
Filename: 1 to 8 characters
File extension: 1 to 3 characters
File extension: 1 to 3 characters
DOS only uses uppercase
DOS only uses uppercase
You cannot use spaces
You cannot use spaces
A single period separates the file extension from the
A single period separates the file extension from the
filename
filename
You cannot use these characters:
You cannot use these characters:
/ : * ? “ < > | + = ; , [ ]
/ : * ? “ < > | + = ; , [ ]
8. The Full Path
The Full Path
What does it mean?
What does it mean?
The complete path from the root of the files system
The complete path from the root of the files system
to the desired object.
to the desired object.
Use
Use
(vs. /)
(vs. /)
C: - the root
C: - the root
For Example;
For Example;
E:BSIT6th SemesterSystem AdministrationFile
E:BSIT6th SemesterSystem AdministrationFile
System.ppt
System.ppt
9. File Names continued
File Names continued
Filenames consist of two parts
Filenames consist of two parts
Main part of filename
Main part of filename
Identifies the contents of the file
Identifies the contents of the file
File extension
File extension
Identifies the file type
Identifies the file type
The last period separates the file extension from the
The last period separates the file extension from the
main part of the filename.
main part of the filename.
Windows typically associates a file extension with an
Windows typically associates a file extension with an
application installed on a computer
application installed on a computer
10. Folder Names
Folder Names
Folder names follow the same guidelines for naming files
Folder names follow the same guidelines for naming files
Folder names usually do not have a file extension
Folder names usually do not have a file extension
11. File Operations
File Operations
create : find space on disk and make entry in directory
create : find space on disk and make entry in directory
write : write to file, requires positioning within the file
write : write to file, requires positioning within the file
read : read from file, involves positioning within the file
read : read from file, involves positioning within the file
delete : delete directory entry, reclaim disk space
delete : delete directory entry, reclaim disk space
reposition : move read/write position
reposition : move read/write position
12. the OS must maintain
the OS must maintain
information about all open files
information about all open files
file pointer : the current position of the read/write
file pointer : the current position of the read/write
pointer in the file
pointer in the file
disk location : the location of the file on the disk
disk location : the location of the file on the disk
file open count : keep track of number of processes
file open count : keep track of number of processes
currently accessing the file
currently accessing the file
such a table of information allows the OS to enforce
such a table of information allows the OS to enforce
policies such as only one process can write to a file at a
policies such as only one process can write to a file at a
given time
given time
13. File Structure
File Structure
files can be stored physically as
files can be stored physically as
Bytes
Bytes
Lines
Lines
records
records
whatever entity is stored, OS must map into
whatever entity is stored, OS must map into
a disk sector
a disk sector
because on a physical disk, sectors are
because on a physical disk, sectors are
smallest writeable unit
smallest writeable unit
14. access methods:
access methods:
sequential : information in the file is accessed from first
sequential : information in the file is accessed from first
to last
to last
readNext , writeNext , reset
readNext , writeNext , reset
direct : possible to reposition read/write pointer to any
direct : possible to reposition read/write pointer to any
position
position
such files are generally made up of fixed-length records
such files are generally made up of fixed-length records
readRecord N, writeRecord N, positionAt N, reset
readRecord N, writeRecord N, positionAt N, reset
indexed : built on top of direct access, but accesses
indexed : built on top of direct access, but accesses
records in file using a key
records in file using a key
each record has a key associated with it, an index of
each record has a key associated with it, an index of
keys is stored with the file
keys is stored with the file
readRecord KEY, writeRecord KEY, positionAt KEY, reset
readRecord KEY, writeRecord KEY, positionAt KEY, reset
15. FAT???
FAT???
file allocation table – where the OS records how the disk
file allocation table – where the OS records how the disk
space is used
space is used
locates the file allocation table near the beginning of the
locates the file allocation table near the beginning of the
volume
volume
the location of the FAT is specified in the boot sector
the location of the FAT is specified in the boot sector
(BIOS Parameter Block)
(BIOS Parameter Block)
actually, 2 copies of the FAT are stored for redundancy
actually, 2 copies of the FAT are stored for redundancy
the FAT number refers to the number of bits per table
the FAT number refers to the number of bits per table
entry
entry
16. File Systems
File Systems
FAT12:
FAT12: The earliest version the file system, FAT12
The earliest version the file system, FAT12
allows a partition to contain up to 4096MB/ (212)clusters.
allows a partition to contain up to 4096MB/ (212)clusters.
FAT 16
FAT 16:
: oldest, created for DOS, supported by most
oldest, created for DOS, supported by most
OS’s, cannot be installed on partitions larger than 2 GB, or on
OS’s, cannot be installed on partitions larger than 2 GB, or on
hard drives larger than 4GB.
hard drives larger than 4GB.
FAT 32
FAT 32:
: supports disks from 512MB to 2TB, compatible
supports disks from 512MB to 2TB, compatible
with Windows 98 and up
with Windows 98 and up
17. Contd..
Contd..
the FAT number refers to the number of
the FAT number refers to the number of
bits per table entry
bits per table entry
FAT12 -> 212 = 4M different clusters can
FAT12 -> 212 = 4M different clusters can
be addressed (used for floppy disks)
be addressed (used for floppy disks)
FAT16 -> 216 = 64M different clusters can
FAT16 -> 216 = 64M different clusters can
be addressed (MS-DOS compatible)
be addressed (MS-DOS compatible)
FAT32 -> 228 = 256G different clusters (4
FAT32 -> 228 = 256G different clusters (4
bits are reserved)
bits are reserved)
18. Advantages of FAT File System
Advantages of FAT File System
The FAT file system is best for drives and/or partitions
The FAT file system is best for drives and/or partitions
under approximately 200 MB
under approximately 200 MB
It is better to format system partition as FAT
It is better to format system partition as FAT
19. Disadvantage of FAT File System
Disadvantage of FAT File System
It is not better to use FAT on partitions that are greater
It is not better to use FAT on partitions that are greater
than 200 megabytes. FAT partitions are limited in size to a
than 200 megabytes. FAT partitions are limited in size to a
maximum of 4 Gigabytes (GB) under Windows NT and 2
maximum of 4 Gigabytes (GB) under Windows NT and 2
GB in MS-DOS.
GB in MS-DOS.
Any FAT partitions that use DOS-based disk compression
Any FAT partitions that use DOS-based disk compression
(such as DriveSpace) will not have readable files when
(such as DriveSpace) will not have readable files when
running Windows NT
running Windows NT
The FAT file system is also prone to fragmentation
The FAT file system is also prone to fragmentation
.
.
20. NTFS
NTFS
New technology file system
New technology file system
Better file security (Encrypting File
Better file security (Encrypting File
System),
System),
Disk compression- can compress a
Disk compression- can compress a
file/folder, any Windows app will
file/folder, any Windows app will
automatically expand as needed
automatically expand as needed
Disk Quota features-
Disk Quota features- Can enforce quotas
Can enforce quotas
on disk usage
on disk usage
21. Contd..
Contd..
Recovery features-each file operation
Recovery features-each file operation
broken down into atomic transactions.
broken down into atomic transactions.
maintains a
maintains a transaction log
transaction log – updates disk
– updates disk
after each transaction
after each transaction
if
if failure
failure occurs during a transaction, info is
occurs during a transaction, info is
sufficient to complete or rollback
sufficient to complete or rollback
if a
if a bad sector
bad sector is found when writing, will
is found when writing, will
automatically map to a different sector
automatically map to a different sector
22. NTFS volumes can not be accessed by
NTFS volumes can not be accessed by
DOS,
DOS,
or Windows 95 or Windows 98.
or Windows 95 or Windows 98.
23. Advantages of NTFS
Advantages of NTFS
Large disks and large files:
Large disks and large files: NTFS is best for
NTFS is best for
use on volumes of about 400 MB or more
use on volumes of about 400 MB or more
Recoverability:
Recoverability: The recoverability designed into
The recoverability designed into
NTFS is such that a user should never have to run any
NTFS is such that a user should never have to run any
sort of disk repair utility on an NTFS partition.
sort of disk repair utility on an NTFS partition.
Security:
Security: NTFS uses the Windows NT object model
NTFS uses the Windows NT object model
to enforce security. An open file is implemented as a file
to enforce security. An open file is implemented as a file
object with a security descriptor that defines its security
object with a security descriptor that defines its security
attributes
attributes.
.
24.
General indexing facility:
General indexing facility: NTFS associates
NTFS associates
a collection of attributes with each file. The set of files in
a collection of attributes with each file. The set of files in
the file management system is organized as a relational
the file management system is organized as a relational
database, so that files can be indexed by any attribute.
database, so that files can be indexed by any attribute.
25. Disadvantages of NTFS
Disadvantages of NTFS
It is not recommended to use NTFS on a volume that is
It is not recommended to use NTFS on a volume that is
smaller than approximately 400 MB
smaller than approximately 400 MB
Currently, there is no file encryption built into NTFS
Currently, there is no file encryption built into NTFS –
–
encryption is available as an external option .
encryption is available as an external option .
It is not possible to format a floppy disk with the NTFS
It is not possible to format a floppy disk with the NTFS
file system
file system
26. File Systems
File Systems
➨ The operating system keeps track of data (documents,
The operating system keeps track of data (documents,
pictures, etc.) by placing it into a file.
pictures, etc.) by placing it into a file.
➨ To store and retrieve files:
To store and retrieve files:
➨ Disk divided into tracks
Disk divided into tracks
➨ Tracks are divided into sectors
Tracks are divided into sectors
➨ Sectors grouped into clusters
Sectors grouped into clusters
➨Number of sectors in a cluster is determined by
Number of sectors in a cluster is determined by
➨Size of the hard drive
Size of the hard drive
➨File allocation system – FAT, FAT32, NTFS
File allocation system – FAT, FAT32, NTFS
28. A
A cluster
cluster,
, also known as an allocation unit
also known as an allocation unit, consists of
, consists of
one or more sectors of storage space, and represents
one or more sectors of storage space, and represents
the minimum amount of space that an operating system
the minimum amount of space that an operating system
allocates when saving the contents of a file to a disk.
allocates when saving the contents of a file to a disk.
The number of sectors per cluster is dependent on
The number of sectors per cluster is dependent on
Type of disk (floppy disk, hard disk)
Type of disk (floppy disk, hard disk)
Version of operating systems
Version of operating systems
Size of disk
Size of disk
Every sector contains 512 bytes. (NTFS does allow you
Every sector contains 512 bytes. (NTFS does allow you
to change this number.)
to change this number.)
The number of clusters per disk is determined by the
The number of clusters per disk is determined by the
filing system (FAT 16, FAT 32 or NTFS).
filing system (FAT 16, FAT 32 or NTFS).
Clusters?
Clusters?
29. DRIVE SIZE
DRIVE SIZE
FAT 16
FAT 16
Cluster Size
Cluster Size
FAT 32
FAT 32
Cluster Size
Cluster Size
NTFS
NTFS
Cluster Size
Cluster Size
260 to 511 MB
260 to 511 MB 8 KB
8 KB Not Supported
Not Supported 512 bytes
512 bytes
512 to 1023 MB
512 to 1023 MB 16 KB
16 KB 4 KB
4 KB 1KB
1KB
1024 MB to 2
1024 MB to 2
GB
GB
32 KB
32 KB 4 KB
4 KB 2 KB
2 KB
2 to 4 GB
2 to 4 GB 64 KB
64 KB 4 KB
4 KB 4 KB
4 KB
4 to 8 GB
4 to 8 GB Not Supported
Not Supported 4 KB
4 KB 4 KB
4 KB
8 to 16 GB
8 to 16 GB Not Supported
Not Supported 8 KB
8 KB 4 KB
4 KB
16 to 32 GB
16 to 32 GB Not Supported
Not Supported 16 KB
16 KB 4 KB
4 KB
>32 GB
>32 GB (up to 2 TB)
(up to 2 TB) Not Supported
Not Supported 32 KB
32 KB 4 KB
4 KB
30. OS and File System Compatibility
OS and File System Compatibility
Operating System
Operating System FAT16
FAT16 FAT32
FAT32 NTFS
NTFS
Windows XP
Windows XP
Windows 2000
Windows 2000
Windows NT
Windows NT
Windows 95, 98, ME
Windows 95, 98, ME
Windows 95
Windows 95
MS-DOS
MS-DOS
31. What happens during the
What happens during the
Formatting Process?
Formatting Process?
OS creates four tables in the 1
OS creates four tables in the 1st
st
sectors
sectors
Boot Record
Boot Record – the name & version number of the OS,
– the name & version number of the OS,
info. on the physical characteristics of the disk
info. on the physical characteristics of the disk
Master File Table #1-
Master File Table #1- keeps track of
keeps track of
Available clusters
Available clusters
Clusters that contain data
Clusters that contain data
Clusters that are defective
Clusters that are defective
Clusters that contain OS files
Clusters that contain OS files
Master File Table #2
Master File Table #2 – copy of MFT #1
– copy of MFT #1
Directory Table
Directory Table – top level folder and file information
– top level folder and file information
32. Formatting Process, cont.
Formatting Process, cont.
Full Format
Full Format
lays down new tracks and sectors
lays down new tracks and sectors
Verifies the integrity of each sector
Verifies the integrity of each sector
By doing a surface scan – OS will put dummy data
By doing a surface scan – OS will put dummy data
into sectors and then try to read the sector
into sectors and then try to read the sector
Quick Format
Quick Format
Removes files
Removes files
Does not check for defective sectors
Does not check for defective sectors
33. Formatting Process, cont.
Formatting Process, cont.
Should you format
Should you format
brand new
brand new
preformatted disk?
preformatted disk?
34. Registered Files
Registered Files
A file that is associated with an application on your
A file that is associated with an application on your
computer via its file extension.
computer via its file extension.
Where is this information kept?
Where is this information kept?
THE REGISTRY – a database that consists of a set of
THE REGISTRY – a database that consists of a set of
files where Windows XP stores your computer’s
files where Windows XP stores your computer’s
hardware, software, network, security,user settings or
hardware, software, network, security,user settings or
profiles, and property settings for folders and programs.
profiles, and property settings for folders and programs.
35. Compare FAT and NTFS File
Compare FAT and NTFS File
System
System
Compatibility
Compatibility
Only Windows NT supports NTFS partitions , Windows
Only Windows NT supports NTFS partitions , Windows
NT and Windows 95 supports both NTFS and FAT
NT and Windows 95 supports both NTFS and FAT
Volume size
Volume size
FAT supports partition sizes only up to 2 GB , the
FAT supports partition sizes only up to 2 GB , the
maximum size of an NTFS partition is 16 EB
maximum size of an NTFS partition is 16 EB
36. Fault tolerance
Fault tolerance
Windows NT offers software support for several
Windows NT offers software support for several
alternate disk-access methods that increase speed
alternate disk-access methods that increase speed
and/or fault tolerance, While FAT does maintain two
and/or fault tolerance, While FAT does maintain two
copies of the file-allocation table, in case one copy is
copies of the file-allocation table, in case one copy is
damaged, it’s incapable of automatically fixing errors
damaged, it’s incapable of automatically fixing errors)
)
File compression
File compression
NTFS has its native support for file compression, It
NTFS has its native support for file compression, It
offers you the chance to compress individual files and
offers you the chance to compress individual files and
directories of your choice
directories of your choice
37. The system partition
The system partition
A better solution is to format your system partition as
A better solution is to format your system partition as
FAT
FAT because
because NTFS partitions are accessible only via
NTFS partitions are accessible only via
Windows NT. If you have a fatal error with Windows NT,
Windows NT. If you have a fatal error with Windows NT,
you can’t simply boot a system disk to a command
you can’t simply boot a system disk to a command
prompt and fix a problem on an NTFS partition
prompt and fix a problem on an NTFS partition
Converting to NTFS
Converting to NTFS
In MS-DOS type command: CONVERT drive: /FS:NTFS
In MS-DOS type command: CONVERT drive: /FS:NTFS
38. Security
Security
NTFS has a built-in security system
NTFS has a built-in security system , FAT has no local
, FAT has no local
protection, it only has the share permission (protect the
protection, it only has the share permission (protect the
file from network
file from network
39. Ext3 third extended file
Ext3 third extended file
system
system
Stephen Tweedie
Stephen Tweedie
November,2001
November,2001
Journaled file system commonly used by linux.
Journaled file system commonly used by linux.
(journaling capability means no worrying about
(journaling capability means no worrying about
metadata corruption. What is most noticeable is that you
metadata corruption. What is most noticeable is that you
can switch back and forth between ext2 and ext3 on a
can switch back and forth between ext2 and ext3 on a
partition without any problem: it is just a matter of
partition without any problem: it is just a matter of
giving the mount command the right file system type. )
giving the mount command the right file system type. )
40. Advantages
Advantages
(over ext2 file system)
(over ext2 file system)
Simple
Simple
Have the facility of backup and restore data
Have the facility of backup and restore data
journaling improves reliability
journaling improves reliability
indexing for larger directories.
indexing for larger directories.
42. Journaling levels
Journaling levels
There are three levels.
There are three levels.
Journal (lowest risk)
Journal (lowest risk)
Ordered (medium risk)
Ordered (medium risk)
Write back (highest risk)
Write back (highest risk)
43. Both metadata and file contents are written to the journal
Both metadata and file contents are written to the journal
before being committed to the main file system.
before being committed to the main file system.
Only metadata is journaled; file contents are not, but it's
Only metadata is journaled; file contents are not, but it's
guaranteed that file contents are written to disk before
guaranteed that file contents are written to disk before
associated metadata is marked as committed in the journal.
associated metadata is marked as committed in the journal.
Only metadata is journaled; file contents are not. The
Only metadata is journaled; file contents are not. The
contents might be written before or after the journal is
contents might be written before or after the journal is
updated.
updated.