Documentation about file systems for flash drives - filesystems

My bachelor work is about file systems for flash drives. What can I read and where can I find documentation about this?

http://www.linux-usb.org/ would be a good start, but your question is a bit too open-ended.
Cheers

The most common file system for USB flash drives is FAT16 or FAT32. Consequently,
reading their description is a good place to start.

Related

How to omit the Bios Parameter Block in a bootloader?

I am creating a simple boot loader. My boot loader doesn't support any of Fat file systems. I read in some tutorials that some processors expects the BPB.
So, how can I be on safe side by omitting BPB. I saw a source code of legacy Grub and its first stage has no BPB.
Help me out..
Thanks
The BPB is an artifact of the FAT bootloader, and it only makes sense for floppy disks, and that only because it's not practical to detect the format geometry of floppy disks. If you are not using floppy disks, you do not need to bother.

Ext2 Filesystem On A USB

I'm using the osdev wiki as a resource for programming an OS. So far I've got a 2 stage bootloader, with a very minimal 32-bit Protected mode kernel.
However, For the bootloader, I've been writing to a specific sector, and reading from a specific sector, and I've decided to do it the "right way", and use a file system, so I picked the ext2 file system, as the wiki has documentation on it. So I formatted my flash drive with ext2, using gparted on Ubuntu 11.10, and grabbed lde (linux disc editor), and ran it with my flash drive.
The problem is that, I don't see table as described on the ext2 page, I've looked at byte 1024 (0x400), among other places, and I can't seem to find the table. I went back into gparted, and it's still formatted. Also, lde says "unrecognized file system", even when I specify that it's ext2. Does a flash drive not use the standard ext2 file system, has the file system been changed so much that it resemble that described on the page, or am I just not looking in the right place?
Links:
Ext2 - http://wiki.osdev.org/Ext2
OsDev Wiki - http://wiki.osdev.org/Main_Page
As stated in the comments, I've answered my question. My problem wasn't with formatting my flash drive, or the way the flash drive is used, or anything else technical. The problem was that when I was using my disc editor, I told it to read the drive itself (/dev/sdb), and I needed to use the partition (/dev/sdb1). When I looked at the partition, I looked at 0x400 (the start of the superblock), and the superblock was indeed where it was supposed to be. I also compared the superblock, and several of the other blocks / inodes with the ones on my hard drive, and the format was the same, but not the data, as to be expected.

How to write your own basic disk scanner

I would like to write some basic disk scanner utility. Basically I would like to be able to read raw bytes of a certain file(s) as written to the disk in the way system's disk utilities (like error checking and defragmentation in windows) do it. I would like to do it in C.
What should be my first steps? Obviously fopen is not enough.
Any guidance would be much appreciated (I don't ask for a solution, just a bit of theory and push in a right direction as I don't even know where to start from...).
The following resources might be of use:
http://support.microsoft.com/kb/100027
http://www.codeproject.com/KB/system/rawsectorio.aspx
You are venturing into the land of the driver here. Most of the file access APIs still hold you at a level higher than the disk itself. You could be talking to a file system on a CD, a RAMDisk, a SAN or HDD and you shouldn't care.
If you need to hit the disk directly then the Volume Managment API should help you out on Windows:
Volume Management API
fopen and fread will work. If you want to use an unbuffered interface, use open and read instead. Open and read are part of the POSIX standard, so they work in Windows too, although you may want to find manual pages for windows to be sure to catch any subtle differences in behaviour.

Simple in memory file system

Can anybody point me to a simple (can't stress this enough) implementation of an in memory file system? If I can create a file and do a simple cat file.txt it's more than enough.
I would like to use it as part of my toy OS.
The OSDev wiki site might help you. You can also ask your questions there and if you look at wiki and their forum you will pretty likely get your answer.
In my opinion, in-memory file systems should be as basic as possible. Here is a virtual file system implemented in user-mode from Windows, but its design principals can be used in your own OS. http://www.flipcode.com/archives/Programming_a_Virtual_File_System-Part_I.shtml . Even this might be too much for your basic OS. I say just wing it and create a linked list of file descriptors that include only file attributes, file name, and file path with each file.
This belongs on Super User IMHO, but anyway, you might want to look at ImDisk. It should be more than enough for just creating a RAM disk.
Wait, I misread... this is for your "toy OS"? Your toy OS supports file systems? You're going to have to implement it yourself, since there's no way something preexisting will work with your home-made OS.

reading FAT12 image file in C

I have a FAT12 image file and I have to open it and read it. I would like to view this image file(directories/files with in) so I can have an idea of what outcomes I should be getting. Anyone know of a good software that would let me view this FAT12 image file? Also can someone guide towards the right directions when trying to read the content of this image file?
There are a number of open source FAT filesystem implementations around.
One which I think has nice clear portable code, though there are bugs, particularly in FAT12 implementation, is http://www.larwe.com/zws/products/dosfs/index.html.
On Linux you can just mount it using the loopback device.
There is Segger files system called emFile. It is portable fs, i have emFile working on number of embedded operating system with minimal (almost none, a few simple function that need to be implemented for each os) development effort. It's not expensive as well,i mean if you doing something for fun you probably don't want to spend money at all , but for commercial use it's cheap.
http://hachoir.org/wiki/hachoir-parser
HTH

Resources