Git Product home page Git Product logo

fat12's Introduction

FAT 12, as used on Floppies

A floppy disk consists of 1.44MBytes of data, arranged as 512 byte sectors. A FAT-12 filesystem groups these sectors into clusters and then maintains a File Allocation Table, with one entry per cluster. This allows a larger block size than 512 bytes. However, on a floppy disk, the block size is normally 512 bytes (i.e, one sector per cluster).

The implementation are slightly trimmed down versions of the C header files from FreeBSD’s implementation of the FAT-12 filesystem.

There're three programs:

  • dos_l s: This will do a recursive listing of all files and directories in a FAT12 disk image file. For example “. / dos_l s f l oppy. i mg” would list all the files and directories in the disk image file called floppy.img.

  • dos_cp: This can be used to copy files into and out of the disk image file. For example, “. / dos_cp f l oppy. i mg a: f oo. t xt bar . t xt ” will copy the file foo.txt from the disk image called floppy.img and save it as bar.txt in the regular filesystem.

  • dos_scandisk that takes a disk image file, checks it for the two types of inconsistency listed above, and fixes the inconsistencies.

    1. Print out a list of clusters that are not referenced from any file. Print these out separated by spaces in a single line, preceeded by “Unreferenced: ”. For example: Unreferenced: 5 6 7 8

    2. From the unreferenced blocks your code found in part 1., print out the files that make up these blocks. Print out the starting block of the file and the number of blocks in the file in the following format: Lost File: 58 3 This indicates that a missing file starts at block 58 and is three blocks long.

    3. Create a directory entry in the root directory for any unreferenced files. These should be named “found1.dat”, “found2.dat”, etc.

    4. Print out a list of files whose length in the directory entry is inconsistent with their length in the FAT. Print out the filename, its length in the dirent and its length in the FAT. For example:f oo. t xt 23567 8192 bar.txt 4721 4096

    5. Free any clusters that are beyond the end of a file (as indicated by the directory entry for that file). Make sure you terminate the file correctly in the FAT.

There're 3 disk image files:

  • floppy1.img contains a few files and a single directory (in addition to the root directory). This is a consistent filesystem.
  • badfloppy1.img is similar to floppy1.img, but contains an unreferenced file.
  • badfloppy2.img is similar to floppy1.img but contains unreferenced files and a length inconsistency.

fat12's People

Contributors

qihaiyan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.