Presentation is loading. Please wait.

Presentation is loading. Please wait.

Off-line Direct Disk Access System

Similar presentations


Presentation on theme: "Off-line Direct Disk Access System"— Presentation transcript:

1 Off-line Direct Disk Access System
CSE 237A Alan Del Tredici

2 Motivation Number of portable digital devices increasing
Audio recorders Cameras Currently, data transferred to PC for Editing Storage / media transfer Network portal Requires 1. Boot PC 2. Transfer the data 3. Shut down PC

3 Proposed Solution Direct transfer to disk without booting PC
Offline Access Module

4 Project Goals Demonstrate off-line disk access procedure
Write data to disk Without standard file I/O calls Without corrupting existing data Retrieve data via standard file I/O Proof-of-concept stage is software only

5 Development Choices Chose to use Linux as native OS
Widely used, source code available, and free! Use “Second Extended File System” (Ext2) Unix-style file system De facto standard for Linux Basis from which other file systems extend

6 Development Choices (cont.)
Make use of disk partitions Make 1 large disk look like several small Provides efficiency, modularity In Linux, floppy-disk accessed just like a hard-disk partition Use floppy disk as test target No change in concept Safer for development!

7 Off-line Access Strategy:
1. Directly access disk to determine existing file system configuration 2. Add data, maintaining file system structure. 3. When booted, Linux will find the data

8 Development Approaches
Write code to directly access disk Linux has strong protection – user can’t access hardware! Linux provides raw block read/write calls… Want access to device in terms of file-system components This is provided by libext2fs. Basic functions to access file system structures Still requires us to know how to use the pieces

9 Ext2 – Partition Components
Boot sector 1 or more Groups Super block Group descriptor Block usage map I-node usage map I-node table Data blocks Redundant copies Disk is an array of “blocks” – organized by these conventions

10 Ext2 – Boot Sector Boot sector 1 or more Groups Boot code
Super block Group descriptor Block usage map I-node usage map I-node table Data blocks Boot code May be unused Partition tables List start of partitions

11 Ext2 – Super Block Boot sector 1 or more Groups Basic parameters
Group descriptor Block usage map I-node usage map I-node table Data blocks Basic parameters Block size (1 kB typ) Block counts Version info

12 Ext2 – Group Descriptor Boot sector 1 or more Groups
Super block Group descriptor Block usage map I-node usage map I-node table Data blocks Map & table locations Handy counters

13 Ext2 – Usage Maps Boot sector 1 or more Groups
Super block Group descriptor Block usage map I-node usage map I-node table Data blocks Bit-maps where each bit indicates used/unused item A 1 kB block holds 8k bits Supports 8,192 entries

14 Ext2 – Index nodes (i-nodes)
Boot sector 1 or more Groups Super block Group descriptor Block usage map I-node usage map I-node table Data blocks Ext2 i-node = 128 bytes struct ext2_inode { U32 size U32 Block count U32 Time stamps : U32 Block pointer[0] U32 Block pointer[1] U32 Block pointer[11] U32 Indirect block pointer U32 2x-indirect block pointer U32 3x-indirect block pointer }

15 Ext2 – I-node Block Pointers

16 Ext2 – Data Blocks Boot sector 1 or more Groups
Super block Group descriptor Block usage map I-node usage map I-node table Data blocks All remaining blocks in the group

17 Off-line Access Example
Initialized Disk: I-node table: 23 blocks Root directory: Directory is a type of ‘file’ Index to other i-nodes by name Root = i-node #2 “lost+found” reserve: 12 blocks Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” 1st free data block

18 Off-line Access Steps Read configuration information Super block
Block size (1 kbyte) I-node count (184 on fd) Block count (1440 on fd) Group block Location of maps Location of i-node table Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” 1st free data block

19 File Creation Read the i-node and block maps
Find the next available i-node and data block Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” 1st free data block

20 File Creation (continued)
Add entry to specified directory File name File type I-node number Perform i-node “accounting” Mark bit in i-node map Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” 1st free data block

21 File Creation (continued)
Write data to data blocks Update i-node with block numbers Allocate indirect blocks from data block area as needed Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” Our data!

22 File Creation (continued)
Finish configuring the i-node Set permissions Size of data written Time stamp When Linux reads this file system, our data will appear! Block map I-node map Group data Super block Boot block : 2 3 1 4 5 27 28 40 41 29 1439 I-node table Root directory “lost+found” Our data!

23 Accomplishments Met the technical objectives
Data stored to hard disk without file I/O calls Linux can later retrieve data Documented pertinent Ext2 operation Extracted details from source code & by testing Created working proof-of-concept application Available on web site:

24 Future Work Test on hard disk with large files
Implement on stand-alone hardware Atmel AT89C5132: A mass storage device controlling data exchange between various Flash modules, HDD and CD-ROM.

25 Off-line Disk Access Questions?

26 Off-line Disk Access Thank you!


Download ppt "Off-line Direct Disk Access System"

Similar presentations


Ads by Google