Project 3 An Introduction to File Systems CS
- Slides: 35
Project 3: An Introduction to File Systems CS 3430 Operating Systems University of Northern Iowa 1
Introduction n The goal of project 3 is to understand q q q n basic file system design and implementation file system testing data serialization/de-serialization At the end of the project, you will feel like a file system expert! 2
Outline n Background q n Mounting file systems Project 3 q q Specification Downloading and testing file system image General FAT 32 data structures Endian-ness 3
Mounting File Systems 4
Unix File Hierarchy n All files accessible in a Unix system are arranged in one big tree q q n n Also called the file hierarchy Tree is rooted (starts) at / These files can be spread out over several devices The mount command serves to attach the file system found on some device to the big file tree 5
‘mount’ command n n mount <device> <mount directory> Typing ‘mount’ without arguments shows you what is mounted and where Second example attaches a device or partition to a directory q Must have root privileges 6
Mount Example Mount point / /mnt /dev/sda 1 /boot /home /lib files… The device sda partition 1 is mounted at “/”. All files and dirs below “/” come from this device. 7
Mount Example n Type command ‘mount’ without any arguments to see what is mounted and where Root “/” file system mounted 8
Mount Example / /mnt /boot /home /lib files… /dev/sda 1 /dev/sdb 1 Now suppose we attach a thumb drive and want our thumb drive files accessible under /mnt… 9
File Hierarchy Example / Mount point /mnt /boot /home /lib files… Files from the thumb drive are now accessible under /mnt /dev/sda 1 /dev/sdb 1 10
Mount Example n The ‘mount’ command can dynamically attach new devices to new mount points 11
Mount Example n The ‘mount’ command can dynamically attach new devices to new mount points Thumb drive mounted here 12
Un-mount Command n umount <dir> n In our example where thumb drive was mounted at /mnt, we can issue q $> umount /mnt q Must have root privileges n This means you can play with the mount command on your virtual machine, but not on the class server 13
Figuring out names of devices n n /etc/fstab – Has list of devices and file systems that get auto-mounted on boot ‘dmesg’ command shows output when plugging in a dynamic device 14
Project 3 More than you wanted to know about FAT 32. . 15
Project 3 n You will create a user-space utility to manipulate a FAT 32 file system image q n n No more kernel programming! Utility must understand a few basic commands to allow simple file system manipulation Utility must not corrupt the file system and should be robust 16
FAT 32 Manipulation Utility only recognizes the following built-in readonly commands: n n info open close size n n n cd ls read 17
File System Image n Manipulation utility will work on a preconfigured FAT 32 file system image q n Actually a file File system image will have raw FAT 32 data structures inside q Just like looking at the raw bytes inside of a disk partition 18
File System Image n Your FAT 32 manipulation utility will have to q q Open the FAT 32 file system image Read parts of the FAT 32 file system image and interpret the raw bytes inside to service your utility’s file system commands… …just like a file system! 19
General FAT 32 Data Structures 20
Terminology n n Byte – 8 bits of data, the smallest addressable unit in modern processors Sector – Smallest addressable unit on a storage device. Usually this is 512 bytes Cluster – FAT 32 -specific term. A group of sectors representing a chunk of data FAT – Stands for file allocation table and is a map of files to data 21
FAT 32 Disk Layout n 3 main regions… Reserved Region Track Sector FAT Region Data Region Disk arm
Reserved Region n Reserved Region – Includes the boot sector, the extended boot sector, the file system information sector, and a few other reserved sectors Reserved Region Boot Sector FS Information Sector FAT Region Additional Reserved Sectors (Optional) Data Region
FAT Region n FAT Region – A map used to traverse the data region. Contains mappings from cluster locations to cluster locations Reserved Region FAT Region File Allocation Table #1 Data Region Copy of File Allocation Table #1
Data Region n Data Region – Using the addresses from the FAT region, contains actual file/directory data Reserved Region FAT Region Data until end of partition
Endian Big or little? 26
Machine Endianness The endianness of a given machine determines in what order a group of bytes are handled (ints, shorts, longs) n q q n Big-endian – most significant byte first Little-endian – least significant byte first This is important to understand for this project, since FAT 32 is always formatted as little-endian
FAT 32 Endianness n The following are a few cases where endianness matters in your project: q q Reading in integral values from the FAT 32 image Reading in shorts from a FAT 32 image Combining multiple shorts to form a single integer from the FAT 32 image Interpreting directory entry attributes
Endian Example (English Version) n n Imagine you can only communicate three letters at a time, and your word is “RAPID” Big-endian q q q n 1. RAP 2. ID Word = RAPID Little-endian q q q 1. PID 2. RA Word = PIDRA (come again? )
Endian Example (data version) n n short value = 15; /* 0 x 000 F */ char bytes[2]; memcpy(bytes, &value, sizeof(short)); In little-endian: q q n bytes[0] = 0 x 0 F bytes[1] = 0 x 00 In big-endian: q q bytes[0] = 0 x 00 bytes[1] = 0 x 0 F
Endian Example (data version 2) n n int value = 1337; /* 0 x 00 CC 07 C 9 */ char bytes[4]; memcpy(bytes, &value, sizeof(int)); In little-endian: n In big-endian: q q bytes[0] = 0 x. C 9 bytes[1] = 0 x 07 bytes[2] = 0 x. CC bytes[3] = 0 x 00 q q bytes[0] = 0 x 00 bytes[1] = 0 x. CC bytes[2] = 0 x 07 bytes[3] = 0 x 09
Visualizing Example 2 Value = 1337 (0 x 00 CC 07 C 9) index 0 1 2 3 little endian 0 x. C 9 0 x 07 0 x. CC 0 x 00 big endian 0 x 00 0 x. CC 0 x 07 0 x. C 9
Helper Resources and Programs n Look at the resources page to see how to do file I/O in C q n Look at how to compile python and java programs on the Linux server q n Will have to read and seek around in the image file. If your project does not compile or run on the Linux sever, the most it can earn is 50% Parameter passing program q In C, but other languages are very similar 33
Additional Project 3 Information n n Like other projects, may work in teams or alone Project deadline is April 30 th q q No final project demo – I will just grade them myself Optional halfway demo is still open 34
Next Steps n Take a look at the fat 32 specification file from Microsoft q n Somewhat confusing – just like the real world (haha) Take a look at the image file 35
- File-file yang dibuat oleh user pada jenis file di linux
- Introduction for project file
- Difference between logical file and physical file
- Fungsi sistem file
- Remote file access in distributed file system
- What does a markup tag tells the web browser
- In a file-oriented information system, a transaction file
- Mobile file systems
- Distributed file system
- Stateless vs stateful server
- Module 4 operating systems and file management
- Color 4112010
- Ansys workbench project file management
- Ppt on an elementary school classroom in a slum
- Project on triangle
- Conclusion for computer project
- Decision support systems and intelligent systems
- Principles of complex systems for systems engineering
- Embedded systems vs cyber physical systems
- Elegant systems
- System view of project management
- Crtd sap
- Animal systems agriscience project ideas
- Earned value analysis microsoft project
- Introduction of system analysis and design
- Introduction to recommender systems
- Recommender systems: an introduction
- I/o device management in operating system
- Levels of ecological organization
- Sap systems applications and products
- Skolnik introduction to radar systems
- Introduction to healthcare delivery systems
- Introduction to information systems 6th edition
- Erp system introduction
- Web content management tools capabilities
- Principles of information systems