Unix File System Internal Structures - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Unix File System Internal Structures

Description:

Understand partition and file system. Understand the file system components ... fdisk /dev/fd0. create/modify disk partition table. System Components. File System ... – PowerPoint PPT presentation

Number of Views:154
Avg rating:3.0/5.0
Slides: 17
Provided by: RU
Category:

less

Transcript and Presenter's Notes

Title: Unix File System Internal Structures


1
Unix File System Internal Structures
  • By C. Shing
  • ITEC Dept
  • Radford University

2
Objectives
  • Understand partition and file system
  • Understand the file system components
  • Understand the component structure
  • Understand the difference between file and
    directory
  • Understand how a new file is stored
  • Understand how Unix search file through directory
    tree

3
Partition and File System
  • Partition logically independent disk, accessed
    by own devices (SCSI disk supports 8 sd, IDE disk
    can have 4 hd)
  • A file system has directory structure, created
    to store and retrieve data in files and directory
    (using disk blocks)
  • Note One file system is usually on one partition

4
File System Type
  • ext2 for Linux
  • ufs for SVR4
  • hsfs or iso9660 for CD-ROM
  • msdos or pcfs for DOS

5
Filesystem - Creation
  • Unix commands
  • mkfs ext2 /dev/fd0
  • construct a filesystem
  • format t ext2 /dev/fd0
  • format, repair and analyze disk
  • fdisk /dev/fd0
  • create/modify disk partition table

6
System Components
  • File System
  • Boot block disk block 0
  • Super-block disk block 1
  • Inode table disk block 2 on
  • Data blocks disk block starts after inode
    table blocks

7
System Components boot block
  • Sometimes called MBR (Master Boot Record) in
    Windows
  • Contains bootstrap program and disk partition
    table

8
System Components super-block
  • Similar to Windows Boot Block
  • A bitmap of blocks
  • 1 block used
  • 0 free block
  • A bitmap of inode
  • 1 inode used
  • 0 inode block
  • Note newer system has super-block back-up to
    prevent system corruption

9
System Components inode table
  • List of inodes (index nodes) starts from inode
    2
  • Inode 128 Bytes size, represents file, unique in
    a file system, contains
  • Meta-data
  • Direct block pointers 10, points to data block
  • Indirect block pointers 4GBgt file size gt 40K(for
    4K block)
  • Double block pointers file size gt 4 GB
  • Note Inode 1 not used bad block (location of
    un-usable blocks), prevent from allocating to
    other files

10
System Components data block
  • Store actual user data (contents of file)

11
File and Directory
  • File stream of bytes, represented by inode
  • Directory filenames and their location of inodes

12
File and Directory
  • Example
  • File inode

Meta-data Data Block location
13
File and Directory
  • Example
  • Directory /

Name Inode Number
. 2
.. 2
adminrootfile 100
/usr 32704
14
Store New File
  • When a new file is created, the file system will
    perform the following
  • Find a free inode (from super-block) to store
    file properties
  • Find a free block (from super-block) to store the
    file contents from Kernel buffer
  • Store the block number in the inode
  • Puts filename and the inode number in the current
    directory

15
Directory/File Traversal
  1. Starts from / (. has inode 2)
  2. Find the subdirectory name
  3. Find its inode number and its block number
  4. Go to the block
  5. Go back to step 2, until filename is found

16
Reference
  • Ch. 14 Unix Internals
Write a Comment
User Comments (0)
About PowerShow.com