0% found this document useful (0 votes)
57 views5 pages

File System: CIT 595 Spring 2008

The document discusses disk data storage and file systems. It explains that a file system provides a logical view of storage that is easier to access than the low-level view of tracks and sectors. It also describes how files are stored in blocks, which are allocated contiguously or linked through indexes. Directories contain metadata that points to the blocks containing file data.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
57 views5 pages

File System: CIT 595 Spring 2008

The document discusses disk data storage and file systems. It explains that a file system provides a logical view of storage that is easier to access than the low-level view of tracks and sectors. It also describes how files are stored in blocks, which are allocated contiguously or linked through indexes. Directories contain metadata that points to the blocks containing file data.
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 5

Disk Data Storage

„ To access data in low-level format is cumbersome


„ Need to know about tracks and sectors

File System „ OS provides a uniform logical view of information


storage via the File-System
„ Known as high-level or logical formatting
„ Logical storage unit a.k.a file
CIT 595 „ File System provides method for storing and organizing files
and the data they contain to make it easy to find and access
Spring 2008 them

„A file is nothing more than a sequence of bytes

„A file is stored in one or more blocks on disk


„ A block is unit of transfer between Memory and Disk

CIT 595 2

Block Disk Partitioning


„A block comprises of one or more sectors of the disk „ Is the creation of logical divisions (isolated sections) of a hard disk
„ Partitioned into one or more groups of cylinders
„ Depends on block allocation method used by the OS „ Gives appearance of more than one hard drive e.g. C drive, D drive

„ OS maintains info on which blocks belong to a file „ Disk can be prepared for use, or even dedicated to different uses
„ Allows one to apply OS-specific logical formatting per partition
„ Data structures use logical block numbers
„ Allow more than one OS per partition
¾ Starting at 0 and running through consecutive integers up
to some maximum „ Encapsulate your data
„ Corruption is local to a partition, so stand to lose only some of your
data if an accident occurs
„ Logicalblock number is converted into physical disk
address „ Also improve disk efficiency
„ E.g. Windows depending on the File System, assigns block sizes
„ i.e. Physical Disk Address -> track/cylinder, surface, sector based on partition size
„ Conversion is performed by the device driver which outputs ¾ Larger disk size implies larger block size that can result in wasted
space
low-level hardware specific instructions to disk controller

CIT 595 3 CIT 595 4

1
Disk Layout Boot Block
„ Master Boot Block (MBR) „ Upon boot, the BIOS (Basic Input/Output System)
„ A known sector on disk is used to boot the computer
program is executed
„ Partition Table „ Is stored in ROM that gets executed on startup
„ Starting and Ending Addressing of each partition „ Conducts a basic hardware check, to determine whether all of
„ One of the partitions is marked as active the attachments are present and working
„ Disk Partitions „ Then executes program located in the MBR
„ Boot Block
¾ Contains a program where the OS resides in the partition
„ MBR program locates active partition, reads in its first
¾ Even if no OS for that partition, a boot block is set aside
block i.e. boot block and execute it
„ Partition Control Block
¾ Magic number to denote what kind of file system e.g. FAT, NTFS,
UFS „ Boot block loads the OS and then the OS takes over
¾ Number of Blocks and the size of blocks

„ Data Structure for Free Blocks, Directory, File Allocation Info, and the
files itself

CIT 595 5 CIT 595 6

Directory Block Allocation for files


„ Directory provides information needed to find the disk data blocks „ How do we allocate files on disk so that
of a file „ Space is utilized effectively
„ Allow accesses that are
„ A directory is nothing more than a file itself, except it is specially ¾ Random/Direct: each block can be accessed independently of
structured other
¾ Quick – try to minimize seek time
„ Each entry in the directory contains
„ Symbolic file name
„ Indicate where file is located on disk
„ Two kinds of allocation
¾ Depends on the Block Allocation Scheme for files
„ Contiguous
„ File attributes: size, access-information, time and date „ Linked
¾ File Allocation Table (FAT)
¾ File Index
„ Root directory contains information about where each sub-
directory is located
„ Always contained at fixed within a partition

CIT 595 7 CIT 595 8

2
Contiguous Allocation Contiguous Allocation (contd..)

„ Requires files to occupy a set of contiguous blocks Advantage


„ Random access is possible
Directory „ If all blocks of one file fit physically on track then
File Start Size
CIT593doc 5 6
„ Disk seek is minimized after the starting block
..
CIT595doc 18 3
Disadvantage
„ Finding contiguous space for file
„ Suffers from external fragmentation i.e. disk is broken
into pieces
„ A new request may not be able to fit into any of the pieces
„ Need to compact all free space into one continuous space -
disk defragment

CIT 595 9 CIT 595 10

Linked Allocation Linked Allocation (contd..)


Advantage:
Directory „ No external fragmentation
File Start
CIT595doc 5
Disadvantage:
CIT595doc 18
„ Random Access is not possible

„ Disk seek time is increased for a file as the blocks are


now scattered all over
„ Pointer storage overhead
„ Some of the storage in each block devoted to the pointer

CIT 595 11 CIT 595 12

3
File Allocation Table (FAT) FAT (contd..)
„ One implementation of Linked „ Random Access is possible
Allocation scheme
„ Pointers to data blocks are „ Does not solve the seek problem
stored in FAT „ Considerable arm movement to read the FAT and actual file
blocks
„ FAT is an array – one entry for
each disk block „ Seek time can be minimized by caching the FAT
„ Indexed by the block number „ Store in main memory
„ Each array entry is a pointer to EOF „ No disk I/O needed for FAT lookup – only block requests are
the next block sent to disk

„ FAT is also kept on disk


„ Caching FAT also has another overhead
„ One per partition
„ Tells OS parts of the disk are „ E.g. 5 GB disk partition, 1K block size - 5M block entries with
currently used by files, and each entry size of 3 bytes, hence FAT occupies 15 MB of
which are free for use Memory

CIT 595 13 CIT 595 14

FAT (contd..) File Index Block


„ Disadvantage: If drives have big sizes, then the block/cluster „ Only a few files are open at any one time
sizes increase leading to wasted space per block
„ So keep only necessary information about open files in
memory to get good performance
„ FAT12 was used in floppy disk (1.44 MB)
„ Each entry stores 12 bits, so number of blocks restricted to 212
„ Good for fixed sizes „ The index block groups together index information
about each file individually
„ FAT16
„ Called Inode in Unix
„ Advantage of FAT16 is that it is compatible across a wide variety of
OS, including Windows 95/98/Me, Linux, and some versions of UNIX
„ Limitation, drives over 2GB require 64KB block sizes
„ The index block is an array of block numbers but it
„ FAT32 can only have a subset of block numbers
„ Actually use only 28 bits „ Less memory overhead when cached
„ Over come FAT16 limitation, can support 1TB with block size of 4KB
„ Not recognized like FAT16
„ Updating the index is like writing to any block on disk
CIT 595 15 CIT 595 16

4
File Index File Index (contd..)
„ If the number of blocks need cannot fit in one index
block, then apply levels of indirection
Directory
File Index
CIT595doc 17

Block 17 Figure 12.9


OS Concepts by
18 Silberschatz, Galvin &
Gagne
19
2
-1
-1 „ Any disadvantages ?
-1
CIT 595 17 CIT 595 18

Free-Space Management
„ A free-space list is maintained that records all free
blocks

„ Linked-list Technique
„ Just like linked allocation – Pointer to first free block is
maintained in fixed location on disk
„ Or can be accounted in part of the allocation data structure
¾ E.g. in FAT, block entries that not occupied have special
symbol written in them

„ Grouping Technique
„ Store the address of n free blocks in the first free block
„ n – 1 entries are actually free and the last block contains a the
address of the next n free blocks

CIT 595 19

You might also like