Project 3: An Introduction to File Systems. COP4610 Florida State University

Similar documents
Week 10 Project 3: An Introduction to File Systems. Classes COP4610 / CGS5765 Florida State University

Project 3: An Introduction to File Systems. COP 4610 / CGS 5765 Principles of Operating Systems

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Operating Systems 2014 Assignment 4: File Systems

OPS235. Linux File Systems Partitioning Mounting File Systems

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

File Management 1/34

Chapter 6. Linux File System

Operating Systems 2015 Assignment 4: File Systems

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems

CST8207: GNU/Linux Operating Systems I Lab Nine Disks, Partitions, and File Systems Part 2. Disks, Partitions, and File Systems - Part 2 of 2

Chapter 7 File Operations

File Systems. File system interface (logical view) File system implementation (physical view)

Segmentation with Paging. Review. Segmentation with Page (MULTICS) Segmentation with Page (MULTICS) Segmentation with Page (MULTICS)

(32 KB) 216 * 215 = 231 = 2GB

FILE SYSTEM IMPLEMENTATION. Sunu Wibirama

Unix System Architecture, File System, and Shell Commands

Project 3 Help Document

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

File Systems. What do we need to know?

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm

File System Internals. Jo, Heeseung

Operating System: Chap10 File System Interface. National Tsing-Hua University 2016, Fall Semester

There is a general need for long-term and shared data storage: Files meet these requirements The file manager or file system within the OS

File System Implementation. Sunu Wibirama

Preview. COSC350 System Software, Fall

SLES Linux Installation Guide

Project 4: File System Implementation 1

Linux File System Study Guide

RocketRAID 2680/2684 SAS Controller Red Hat Enterprise/CentOS Linux Installation Guide

Hard facts. Hard disk drives

Fedora Linux Installation Guide

An introduction to Logical Volume Management

Rocket RAID 2644 SAS Controller opensuse Linux Installation Guide

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

Physical and Logical structure. Thursday, December 02, 2004

makes floppy bootable o next comes root directory file information ATTRIB command used to modify name

File System. Preview. File Name. File Structure. File Types. File Structure. Three essential requirements for long term information storage

RocketRAID 231x/230x SATA Controller Debian Linux Installation Guide

Introduction to Linux

RocketRAID 231x/230x SATA Controller Red Hat Enterprise/CentOS Linux Installation Guide

File System: Interface and Implmentation

RocketRAID 231x/230x SATA Controller Fedora Linux Installation Guide

Filesystem Hierarchy and Permissions

The UNIX File System

RocketRAID 2522 SATA Controller Ubuntu Linux Installation Guide

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Hard Disk Organization. Vocabulary

Manage Directories and Files in Linux. Objectives. Understand the Filesystem Hierarchy Standard (FHS)

The bigger picture. File systems. User space operations. What s a file. A file system is the user space implementation of persistent storage.

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Lecture 2: The file system

ELEC 377 Operating Systems. Week 8 Class 1

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

Operating Systems: Lecture 12. File-System Interface and Implementation

Computer Systems Laboratory Sungkyunkwan University

environment) and note down the last "End" sector ( as shown in the below example):

bytes per disk block (a block is usually called sector in the disk drive literature), sectors in each track, read/write heads, and cylinders (tracks).

Lab 1: Introduction to Linux Networking

Lab E2: bypassing authentication and resetting passwords

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

MINI-HOWTO backup and/or restore device or partition using zsplit/unzsplit

Linux Systems Administration Getting Started with Linux

Idea6410 Ubuntu User Manual V 0.19

CSC 306 Assignment 4: A Floppy Disk Dumper

UNIX File Systems. How UNIX Organizes and Accesses Files on Disk

Frequently asked questions from the previous class survey

OPERATING SYSTEMS: Lesson 12: Directories

Files and File System

A file system is a clearly-defined method that the computer's operating system uses to store, catalog, and retrieve files.

LiLo Crash Recovery. 1.0 Preparation Tips. 2.0 Quick Steps to recovery

,879 B FAT #1 FAT #2 root directory data. Figure 1: Disk layout for a 1.44 Mb DOS diskette. B is the boot sector.

IT ESSENTIALS V. 4.1 Module 5 Fundamental Operating Systems

The UNIX File System

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

CST Algonquin College 2

Distributed File Systems

Chapter 4. File Systems. Part 1

Outlook. File-System Interface Allocation-Methods Free Space Management

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Introduction to Linux. Fundamentals of Computer Science

Operating Systems. Operating Systems Professor Sina Meraji U of T

Filesystem Hierarchy and Permissions

Embedded System Design

CS370 Operating Systems

Advanced UNIX File Systems. Berkley Fast File System, Logging File System, Virtual File Systems

Operating Systems, Fall

Upgrade Cisco Interface Module for LoRaWAN IXM using the Console

Exam Actual. Higher Quality. Better Service! QUESTION & ANSWER

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

Ubuntu Linux Installation Guide

This is sometimes necessary to free up disk space on a volume that cannot have extra disk space easily added.

Chapter 11: Implementing File Systems

LAB #7 Linux Tutorial

Advanced Operating Systems

Transcription:

Project 3: An Introduction to File Systems COP4610 Florida State University 1

Introduction The goal of project 3 is to understand 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 Background Setting up your environment Mounting file systems Project 3 Specification Downloading and testing file system image General FAT32 data structures Endian-ness 3

Environment Setup Get ready for Project 3! 4

Project 3 Environment Must develop inside Linux environment with root access Make sure that they compile in the lab machines, which runs the most recent version of Linux Mint I will be grading your projects inside a similar environment 5

Project Environment Kernel version no longer matters Entire project will be in userspace, not kernel! Please use debuggers, they will save you time gdb, ddd, others Programming language is still C 6

Running out of room? You must have at least 64MB free, plus room for your source code To see how much room you have left inside your machine, issue the following command: $> df -h 7

df -h /dev/sda is root file system mounted on / Has 2.2GB currently available 8

Mounting File Systems 9

Unix File Hierarchy All files accessible in a Unix system are arranged in one big tree 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 10

mount command mount 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 Must have root privileges 11

Mount Example Mount point / /mnt /boot /home /lib files files files /dev/sda1 The device sda partition 1 is mounted at /. All files and dirs below / come from this device. 12

Mount Example Type command mount without any arguments to see what is mounted and where Root / file system mounted 13

Mount Example / /mnt /boot /home /lib files files files /dev/sda1 /dev/sdb1 Now suppose we attach a thumb drive and want our thumb drive files accessible under /mnt 14

Mount Example sudo mount /dev/sdb1 /mnt Thumb drive mounted here 15

File Hierarchy Example / Mount point /mnt /boot /home /lib files files files files /dev/sda1 /dev/sdb1 Files from the thumb drive are now accessible under /mnt 16

Un-mount Command umount <dir> In our example where the thumb drive was mounted at /mnt, we can issue $> umount /mnt Must have root privileges 17

Figuring out names of devices /etc/fstab Has list of devices and file systems that get auto-mounted on boot 18

Project 3 More than you wanted to know about FAT32.. 19

Project 3 You will create a user-space utility to manipulate a FAT32 file system image 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 20

FAT32 Manipulation Utility Utility will only recogniz the following built-in commands: open close create rm size cd ls mkdir rmdir read write 21

File System Image Manipulation utility will work on a preconfigured FAT32 file system image Actually a file File system image will have raw FAT32 data structures inside Just like looking at the raw bytes inside of a disk partition 22

File System Image Your FAT32 manipulation utility will have to Open the FAT32 file system image Read parts of the FAT32 file system image and interpret the raw bytes inside to service your utility s file system commands just like a file system! 23

File System Image Sometimes you may want to check that you haven t corrupted your file system image, or that you can add or write files successfully Mount your file system image with the OS FAT32 driver Just like the file system image is a device 24

File System Image Mount Example / /mnt /boot /home /lib files /user files fat32.img 25

File System Image Mount Example / /mnt /boot /home /lib files /user files File that contains a raw image of a file system fat32.img 26

File System Image Mount Example / /mnt /boot /home /lib files files /user files Mount image onto /mnt to read files in image fat32.img 27

File System Image Mount Example $> sudo mount fat32.img /mnt $> cd /mnt fat32.img is your image file /mnt is your mounting directory Once the file is mounted, you can go into the /mnt directory and issue all your normal file system commands like: ls, cat, cd, 28

General FAT32 Data Structures 29

Terminology 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 FAT32-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 30

FAT32 Disk Layout 3 main regions Reserved Region FAT Region Data Region Track Disk arm Sector

Reserved Region Reserved Region Includes the boot sector, the extended boot sector, the file system information sector, and a few other reserved sectors Reserved Region FAT Region Data Region Boot Sector FS Information Sector Additional Reserved Sectors (Optional)

FAT Region FAT Region A map used to traverse the data region. Contains mappings from cluster locations to cluster locations Reserved Region FAT Region Data Region File Allocation Table #1 Copy of File Allocation Table #1

Data Region Data Region Using the addresses from the FAT region, contains actual file/directory data Reserved Region FAT Region Data Region Data until end of partition

Endian Big or little? 35

Machine Endianness The endianness of a given machine determines in what order a group of bytes are handled (ints, shorts, long longs) Big-endian most significant byte first Little-endian least significant byte first This is important to understand for this project, since FAT32 is always formatted as little-endian

FAT32 Endianness The following are a few cases where endianness matters in your project: Reading in integral values from the FAT32 image Reading in shorts from a FAT32 image Combining multiple shorts to form a single integer from the FAT32 image Interpreting directory entry attributes

Endian Example (English Version) Imagine you can only communicate three letters at a time, and your word is RAPID Big-endian 1. RAP 2. ID Word = RAPID Little-endian 1. PID 2. RA Word = PIDRA (come again?)

Endian Example (data version) short value = 15; /* 0x000F */ char bytes[2]; memcpy(bytes, &value, sizeof(short)); In little-endian: bytes[0] = 0x0F bytes[1] = 0x00 In big-endian: bytes[0] = 0x00 bytes[1] = 0x0F

Endian Example (data version 2) int value = 13371337; /* 0x00CC07C9 */ char bytes[4]; memcpy(bytes, &value, sizeof(int)); In little-endian: In big-endian: bytes[0] = 0xC9 bytes[1] = 0x07 bytes[2] = 0xCC bytes[3] = 0x00 bytes[0] = 0x00 bytes[1] = 0xCC bytes[2] = 0x07 bytes[3] = 0x09

Visualizing Example 2 Value = 13371337 (0x00CC07C9) index 0 1 2 3 little endian big endian 0xC9 0x07 0xCC 0x00 0x00 0xCC 0x07 0xC9

Additional Project 3 Information Group project. 3 People in each group. Each group member will receive same grade. Deadline: December 1. Late penalties apply. Absolutely no submission after December 6 11:59 pm. 42

Until Next Time Set up your environment Download the image file Practice mounting the image file with the OS FAT32 drivers Make sure you can cd into /mnt and read/write to the files Read over the FAT32 Specification 43