1 / 16

Unix File System Internal Structures

Unix File System Internal Structures. By C. Shing ITEC Dept Radford University. Objectives. Understand partition and file system Understand the file system components Understand the component structure Understand the difference between file and directory

eloise
Download Presentation

Unix File System Internal Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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: 4GB> file size > 40K(for 4K block) • Double block pointers: file size > 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

  13. File and Directory • Example: • Directory: /

  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(meta-data) • 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 • Starts from / (. has inode #2) • Find the subdirectory name • Find its inode number and its block number • Go to the block • Go back to step 2, until filename is found

  16. Reference • Ch. 14: Unix Internals

More Related