Pertemuan 12 13 Storage Device
Pertemuan 12 13 Storage Device
• Space management
• Filenames
• Directories
• Metadata
• File system as an abstract user interface
• Utilities
• Restricting and permitting access
• Maintaining integrity
• User data
• Using a file system
• Multiple file systems within a single system
FileSystem
• Classifications
http://en.wikipedia.org/wiki/Comparison_of_file_systems
FileSystem
• FAT Family
File Max Allowable Characters Max Pathname Length Max File Size Max Volume
System Filename Size
Length
FAT12 8.3 (255 UCS- Any byte except for values 0-31, 127 No limit defined 32 MB 32 MB (256 MB
2 code units (DEL) and: " * / : < > ? \ | + , . ; = [] (256 MB) with 4K sectors
with VFAT (lowcase a-z are stored as A-Z). With and 64 KB
LFNs) VFAT LFN any Unicode except NUL clusters)
FAT16 8.3 (255 UCS- Any byte except for values 0-31, 127 No limit defined 2 GB (4 GB 2 GB (4 GB)
2 code units (DEL) and: " * / : < > ? \ | + , . ; = [] with LFS)
with VFAT (lowcase a-z are stored as A-Z). With
LFNs) VFAT LFN any Unicode except NUL
FAT32 8.3 (255 UCS- Any byte except for values 0-31, 127 No limit defined 2 GB (4 GB 2 TB (16 TB)
2 code units (DEL) and: " * / : < > ? \ | + , . ; = [] with LFS,256
with VFAT (lowcase a-z are stored as A-Z). With GB with
LFNs) VFAT LFN any Unicode except NUL FAT32+)
NTFS 255 Depends on namespace used 32,767 Unicode characters with each 16 EB 16 EB
characters path component (directory or
filename) commonly up to 255
characters long
MS-DOS File Allocation Table
11
12
A Free C Free E F
17
Any Question ?
Anything to discuss ?
File Attributes
• Name – only information kept in human-readable form
• Identifier – unique tag (number) identifies file within file system
• Type – needed for systems that support different types
• Location – pointer to file location on device
• Size – current file size
• Protection – controls who can do reading, writing, executing
• Time, date, and user identification – data for protection, security, and
usage monitoring
• Information about files are kept in the directory structure, which is
maintained on the disk
• Many variations, including extended file attributes such as file
checksum
• Information kept in the directory structure
File Types – Name, Extension
Typical file extensions
File types
Executable
file
Archive
Accessing a file
• Sequential access
• Read all bytes/records from the beginning
• Cannot jump around
• May rewind or back up, however
• Convenient when medium was magnetic tape
• Often useful when whole file is needed
• Random access
• Bytes (or records) read in any order
• Essential for database systems
• Read can be …
• Move file marker (seek), then read or …
• Read and then move file marker
File operations
• Create: make a new file • Append: like write, but only at the end
• Delete: remove an existing file of the file
• Open: prepare a file to be accessed • Seek: move the “current” pointer
elsewhere in the file
• Close: indicate that a file is no longer
being accessed • Get attributes: retrieve attribute
information
• Read: get data from a file
• Set attributes: modify attribute
• Write: put data to a file information
• Rename: change a file’s name
File Manager
Anything to discuss ?
Directories
Root
directory
A A B C
foo bar baz blah
29
Two-level directory system
Root
directory
A B C
A A B B C C C
foo bar foo baz bar foo blah
30
Hierarchical directory system
Root
directory
A B C
A A A B B C C C
Papers foo Photos foo Papers bar foo blah
A A A B B
os.tex sunset Family foo.tex foo.ps
A A A
sunset kids Mom
Unix directory tree
Operations on directories
attributes
games attributes games
mail attributes mail attributes
news attributes news
attributes
research attributes research
attributes
Storing all information Using pointers to
in the directory index nodes
34
Directory structure
• Structure
• Linear list of files (often itself stored in a file)
• Simple to program
• Slow to run
• Increase speed by keeping it sorted (insertions are slower!)
• Hash table: name hashed and looked up in file
• Decreases search time: no linear searches!
• May be difficult to expand
• Can result in collisions (two files hash to same location)
• Tree
• Fast for searching
• Easy to expand
• Difficult to do in on-disk directory
• Name length
• Fixed: easy to program
• Variable: more flexible, better for users
Handling long file names in a directory
Sharing files
Root
directory
A B C
A A A B B C C C
Papers foo Photos foo Photos bar foo blah
A A A B
os.tex sunset Family lake
A A ?
sunset kids ???
Any Question ?
Anything to discuss ?