FAT file system

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
com1
Member
Member
Posts: 105
Joined: Sat Apr 28, 2007 11:57 am
Location: TN

FAT file system

Post by com1 »

since i am a relative beginner to osdeving, should i use someone else's file system (FAT32), before i write my own?
oh microsoft, microsoft, what souls you have dismayed
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Don't write your own filesystem until you've finished your kernel. It's too much of a distraction. Use FAT (but not only FAT32, also FAT16 and FAT12).
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

pcmattman wrote:Don't write your own filesystem until you've finished your kernel. It's too much of a distraction. Use FAT (but not only FAT32, also FAT16 and FAT12).
As much as I understand the first rule, I disagree on the use of FAT. FAT is bad for you, especially those kinds of saturated FAT's like FAT32. Try using something else that your operating system also supports, but do shy away from the most complex filesystems (no NTFS, ReiserFS etc.). What about FFS or Ext2?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

The reason to put FAT first, is that it is standard for floppy disks. Most likely that is the first file system you'd get into contact with. If you have linux + harddisk driver candy's right and Ext2 is probably a better choice.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Combuster wrote:The reason to put FAT first, is that it is standard for floppy disks. Most likely that is the first file system you'd get into contact with. If you have linux + harddisk driver candy's right and Ext2 is probably a better choice.
I would consider FAT a bad choice for a first filesystem for any new operating system, as the assumptions you will implicitly make during its implementation will limit any other filesystem's performance. Also, you'll further the commonality of FAT, encouraging others to do the same.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Actually, I disagree, Candy.

The reason why I choose and promote FAT is because it is standard. Linux supports it, Windows supports it (even Apple computers support it). If I write a FAT32 driver I know that people's USB devices will work with my OS (once I get usb working :D).

Also, I use Windows which makes working with anything other than FAT filesystems tedious and difficult.

If I only ever used Linux and every drive I owned was Ext2, well, then I would have to write an Ext2 driver.

And,
as the assumptions you will implicitly make during its implementation will limit any other filesystem's performance
A filesystem should be implemented to be transparent. I should be able to have my fread function decide, based on what it has already found out about the drive, which filesystem driver to call.

I don't see how implementing one filesystem can affect another's performance, unless you treat Ext2 more like FAT or something insane like that.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

pcmattman wrote:And,
as the assumptions you will implicitly make during its implementation will limit any other filesystem's performance
A filesystem should be implemented to be transparent. I should be able to have my fread function decide, based on what it has already found out about the drive, which filesystem driver to call.

I don't see how implementing one filesystem can affect another's performance, unless you treat Ext2 more like FAT or something insane like that.
The filesystem and interface SHOULD be implemented based on what the device can do and what a file system can use/do. However:

- If my filesystem supports arbitrary attributes, your interface won't be able to handle them
- If you think about permissions, FAT is a disaster
- You can't use inodes in your interface since FAT doesn't know them
- Copy on write files
- Name changing directories
- Symlinks
- Need I continue?

You will limit your interface to the filesystem to the lowest common denominator, effectively halting progress. Especially since you'll adapt new file systems to the old interface since that only involves changing one driver and not two or more. Not to mention people in the past having made interfaces specifically tailored to FAT, such as being able to cache the disk area where the FAT would be (explicitly) and only allowing 32k/64k reads to be efficient.

Nothing mentioned above that I haven't already seen in existing implementations, by the way. This is purely practical experience.
1234
Posts: 24
Joined: Sat May 26, 2007 7:58 pm

Post by 1234 »

[post deleted]
Last edited by 1234 on Wed Nov 21, 2007 5:23 pm, edited 1 time in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

SFS isn't quite Candy's homegrown filesystem. He uses something with a load of guru features even I probably won't even bother with the next few years... :roll:

There was a thread on it - here
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

mikegonta wrote:
Candy wrote:Also, you'll further the commonality of FAT, encouraging others to do the same.
Another grain of salt in the ocean.

But seriously, could you elaborate on these SFS features.
Candy wrote:- If my filesystem supports arbitrary attributes, your interface won't be able to handle them
- If you think about permissions, FAT is a disaster
- You can't use inodes in your interface since FAT doesn't know them
- Copy on write files
- Name changing directories
- Symlinks
Mike Gonta
http://groups.google.com/group/aeBIOS/about?hl=en
SFS supports, iirc, symlinks. It isn't intended to be a full-blown filesystem for OS hosting use, it's intended for removable media and exchanging information. I'm developing my own filesystem with support for at least the items above; you don't have to take my FS for it though, the very recently developed ZFS has nearly all of them as well. There's ext3cow for copy on write (without decent interface, I think), you can rename files in any unix without any effect and so on & forth.

If you base your OS on FAT, it'll show clearly in your unix file system support code.
Post Reply