0% found this document useful (0 votes)
27 views38 pages

Pertemuan 12 13 Storage Device

The document discusses various topics related to file systems including storage hierarchy, file system classifications and aspects, file system limitations, FAT file system details, clusters, accessing files, file operations, file managers, and directories.

Uploaded by

rafikabutone96
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views38 pages

Pertemuan 12 13 Storage Device

The document discusses various topics related to file systems including storage hierarchy, file system classifications and aspects, file system limitations, FAT file system details, clusters, accessing files, file operations, file managers, and directories.

Uploaded by

rafikabutone96
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Operating System

Tim Pengampu MK Sistem Operasi


Universitas Dian Nuswantoro
Storage-Device Hierarchy
Characteristics of Various Types of Storage

Movement between levels of storage hierarchy can be explicit or


implicit
FileSystem

It is used to control how data is stored and retrieved.


Without a file system, information placed in a storage
area would be one large body of data with no way to tell
where one piece of information stops and the next
begins.
FileSystem
• The Aspects

• 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

• Disk / Tape Filesystem


• Network Filesystem
• Special-Purpose Filesystem
FileSystem
• UFS, HFS Plus, QFS, ZFS
• Ext* family (ext2, ext3, and ext4)
• XFS, JFS, ReiserFS, btrfs
• FAT family (FAT12, FAT16, and FAT32)
• NTFS, exFAT
• etc.
http://en.wikipedia.org/wiki/List_of_file_systems
• Many file systems, sometimes many within
an operating system
• Each with its own format (CD-ROM is ISO
9660; Unix has UFS, FFS; Windows has
FAT, FAT32, NTFS as well as floppy, CD, DVD
Blu-ray, Linux has more than 130 types,
with extended file system ext3 and ext4
leading; plus distributed file systems, etc.)
• New ones still arriving – ZFS, GoogleFS,
Oracle ASM, FUSE
FileSystem
• Limitations
There are limitations for each filesystem

for more complete table list of filesystem


limitations, open :

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

Block size FAT-12 FAT-16 FAT-32


0.5 KB 2 MB
1 KB 4 MB
2 KB 8 MB 128 MB
4 KB 16 MB 256 MB 1 TB
8 KB 512 MB 2 TB
16 KB 1024 MB 2 TB
32 KB 2048 MB 2 TB

11
12

Fat on-disk Structure


• Boot sector, followed by reserved sector Area
• File Allocation Table (FAT)
• 12, 16, and 32 bit FAT
• Clusters size
• Typically two copies of FAT
• Root Directory
• Fixed size
• 32 byte Directory Entries
• 8.3 names
• Data area
• Once only for file data, later expanded to include subdirectories
13

1.44 MB Floppy format

• Number of sectors = 0xB40 (2,880)


• Sector size = 0x200 (512)
• Number of Fats = 0x2, Sectors per Fat = 0x9
• Root directory Size = 0xE (14) sectors, 0xE0 (224) entries
• Layout
• Sector 0x0: boot sector
• Sector 0x1: start of first FAT
• Sector 0xA: start of second FAT
• Sector 0x13: start of root directory
• Sector 0x21: start of data area
• Disk Edit utility to help in your project
• Added to the project4 directory (copy everything to your vhd)
14

Carving up the disk


Entire disk
Partition table
Master
Partition 1 Partition 2 Partition 3 Partition 4
boot record

Boot Super Free space Index


Files & directories
block block management nodes
Cluster

• A cluster, also known as an allocation unit, consists of one or more sectors


of storage space, and represents the minimum amount of space that an
operating system allocates when saving the contents of a file to a disk.
• The number of sectors per cluster is dependent on :
• Type of disk (floppy, hard disk)
• Version of operating systems
• Size of disk
• Every sector contains 512 bytes. (NTFS does allow you to change this
number)
• The number of clusters per disk is determined by the filling system (FAT 16,
FAT 32 or NTFS)
Contiguous allocation for file blocks
A B C D E F

A Free C Free E F

• Contiguous allocation requires all blocks of a file to be consecutive on disk


• Problem: deleting files leaves “holes”
• Similar to memory allocation issues
• Compacting the disk can be a very slow procedure…

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

A file manager or file browser is a computer program


that provides a user interface to manage files and
folders. The most common operations performed on
files or groups of files include creating, opening (e.g.
viewing, playing, editing or printing), renaming,
moving or copying deleting and searching for files, as
well as modifying file attributes, properties and file
permissions. Folder and files may be displayed in a
hierarchical tree based on their directory structure.
Any Question ?

Anything to discuss ?
Directories

• Naming is nice, but limited


• Humans like to group things together for convenience
• File systems allow this to be done with directories
(sometimes called folders)
• Grouping makes it easier to
• Find files in the first place: remember the enclosing
directories for the file
• Locate related files (or just determine which files
are related)
Single-level directory systems

Root
directory

A A B C
foo bar baz blah

• One directory in the file system


• Example directory
• Contains 4 files (foo, bar, baz, blah)
• owned by 3 different people: A, B, and C (owners shown in red)
• Problem: what if user B wants to create a file called foo?

29
Two-level directory system
Root
directory

A B C

A A B B C C C
foo bar foo baz bar foo blah

• Solves naming problem: each user has her own directory


• Multiple users can use the same file name
• By default, users access files in their own directories
• Extension: allow users to access files in others’ directories

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

• Create: make a new directory • Readdir: read a directory


• Delete: remove a directory entry
(usually must be empty) • Rename: change the name of
• Opendir: open a directory to a directory
allow searching it • Similar to renaming a file

• Closedir: close a directory • Link: create a new entry in a


(done searching) directory to link to an existing
file
• Unlink: remove an entry in a
directory
• Remove the file if this is the last
link to this file
What’s in a directory?
• Two types of information
• File names
• File metadata (size, timestamps, etc.)
• Basic choices for directory information
• Store all information in directory
• Fixed size entries
• Disk addresses and attributes in directory entry
• Store names & pointers to index nodes (i-nodes)

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 ?

You might also like