Page 1 of 1

filesystem questions

Posted: Sat Sep 28, 2002 8:20 am
by gtsphere
i understand basically what a filesystem is, but how would you go about creating it? like in asm? c? lol its confusing but i understand some of it, does anyone have any good tutorials?

and the ext2fs for linux, are there any working examples of it?

thanks in advance

Re:filesystem questions

Posted: Sat Sep 28, 2002 10:27 am
by Slasher
Basically a filesystem is just a way of recording which sector is used and which one is free. To achieve this just allocate a part of the disk (learn with a floppy first) to keeping a table (you could create one of your own) that specifies the root directory(a fixed starting sector) and its size.
if you want to use inodes (just records of fixed size eg 8 bytes (a sector will hold 512/8 = 64 inodes), that hold info like starting sector,length,etc
you will need have enough records to cover the whole disk (a 1.44mb floppy has 1.44mb/512 sectors = 2949 sectors). so lets say you have in the inode 10 direct pointers to sectors and 3 indirect pointers to extra inodes (used only when the file is larger than 10 sectors) you will need to have about 2949/13 = 227 inode records to cover the whole disk.
you then write routines to allocate a new inode for CREATE_FILE, get a inode for OPEN_FILE etc
ofcourse this is just off the top of my head right now and there are a lot of other things to record in the filesystem but this is basically how it works( or how i will implements mine when i get there ;D )
hope this helps!