What file system I should implement
Posted: Fri Nov 08, 2019 7:06 pm
Maybe this question was asked a lot of times, but I want to get a opinion if FAT is a good FS for starters, or there is a simpler FS to implement?
The Place to Start for Operating System Developers
https://forum.osdev.org/
The FAT specification is at http://www.fysnet.net/docs/fatgen103.pdfPipeDevice wrote:There's a guide about how implement FAT32 (besides the wiki article) that you can recomend to me?
There are numerous ways, mostly with tools that someone has already created, all depending on your development platform.PipeDevice wrote:And how I can create a HDD image formatted with FAT32 for QEMU?
I feel that ext2 is in the same level of "difficulty" in terms of programming than FAT, and ext2 is more useful than the old FAT. Or it isn't?davidv1992 wrote:One thing to note when going for FAT, keep in mind that it has no permission system. This can create future challenges if you ever attempt to retrofit your file system management code when moving to somewhat more complex/different file systems.
In my opinion, FAT is a good option for starting.PipeDevice wrote: Maybe this question was asked a lot of times, but I want to get a opinion if FAT is a good FS for starters, or there is a simpler FS to implement?
the poster asked about starting point, "security" subsystem is out of concern at that point. permissions anyway are specified differently on different FSs, so it's twofold - FS independent security subsystem of the OS and particular permission system of each FS in question. FAT won't do any challenges to this scheme, since its lack of permissions may be treated easily - "implied" or "inferred" access rights for example "anyone has access" for removable storages or "none has" - for UEFI ESP. finally, one can add his/her own addition atop of FAT that will bring permission system there, still retaining compatibility with the specification and thus - interoperability. holding permissions info in $SOME_HIDDEN_AND_SCARY_NAMED_FILE$ in each directory for example.One thing to note when going for FAT, keep in mind that it has no permission system. This can create future challenges if you ever attempt to retrofit your file system management code when moving to somewhat more complex/different file systems.
It isn't more useful. it's just old linux cr4p, nobody else cares about. supporting FAT first, gives you advantage of supporting all kinds of removable media, you and your users would be happy to try on your OS - USB flash sticks, SD cards, for which FAT is standard defined FS, etc. This is really helpful, useful and fun. Also, UEFI ESP is FAT, by the specification, again, advantage - you can access that and update efiyourfolderyourloader.efi and friends from the OS session. and now, what would you get with ext2? even linux doesn't use that.I feel that ext2 is in the same level of "difficulty" in terms of programming than FAT, and ext2 is more useful than the old FAT. Or it isn't?
You mean exFAT, which is not the same thing as FAT/FAT32.zaval wrote:supporting FAT first, gives you advantage of supporting all kinds of removable media, you and your users would be happy to try on your OS - USB flash sticks, SD cards, for which FAT is standard defined FS, etc.
You mean the filesystem based on FAT, the specification of which is part of the UEFI specs and independent of the original FAT specs?zaval wrote:Also, UEFI ESP is FAT, by the specification, again, advantage...
I thought I wrote it clearly, looks like I didn't - FAT is more useful to have as a first implemented FS for an osdev enthusiast, because it is still widely used as a FS for removable storage devices. so having it implemented, one gets 2 in 1 - experience with FSs and also his/her work will be really useful, and not just lying dormant, since ext2 is a nearly extinct linux legacy. we all have USB sticks, our imaginary users have them. and all of them are formatted as FAT disks. imagine, our poster finishes his/her FAT driver and what an excitement it will be for him/her to insert a USB stick and list its contents from within his/her own OS. (of course, it will happen only after he/she is done with EHCI/UHCI/OHCI/XHCI stuff,iansjack wrote: I think you are wrong about implementing ext2, which is a much more capable filesystem than FAT. It is a very good first step towards ext3 and ext4, and it shares many design features with other more capable filesystems. FAT is an anomaly that is nothing like most other modern filesystems. Ext2 is well documented and the level of difficulty is no more than implementing other parts of the operating system.
FAT may be easy, but it is only a stepping stone. Akin to playing with building blocks rather than building something useful with real bricks. Sure Linux doesn't use ext2 any longer; you may have noticed that it doesn't use FAT either. No modern OS uses FAT, or anything remotely related to it, as the primary filesystem; several use filesystems closely related to ext2.
So I don't really understand, why this argument about "primary" FS from you. ext2 btw is as bad for the primary FS as FAT is, but FAT is good for small removable storages and is used there, ext2 isn't.zaval wrote: Of course, as your OS advances, you will want to either invent your own fancy FS or choose some more capable one as a "boot" FS for the OS - FS on which you want your OS would be installed.
No, I meant the whole FAT family. exFAT is standard for only SDXC cards. but anyway, exFAT is being released by MS for implementations. for linux already. there are some uncertainties about others, but I believe, it will be cleared up eventually.Solar wrote: You mean exFAT, which is not the same thing as FAT/FAT32.
Can you tell what the real differences between those are and are there? The relevant passage in the spec basically tells us, that it's a fixed version of FAT32 (1.03) with no additions in future. for compatibility. I guess, FAT by itself is fixed for a long time. so, the only difference is another OSType value in the partition scheme, which is outside of a FAT driver scope anyway. The whole relevant quote:Solar wrote: You mean the filesystem based on FAT, the specification of which is part of the UEFI specs and independent of the original FAT specs?
Try to follow their logic, expressed this dimly in the quote, and you'll find*, that their FAT is not "independent" from the original one, it's fixed at the chosen version. they don't specify FAT, there is no FAT doc from UEFI, they reference MS site.12.3 File System Format
The file system supported by the Extensible Firmware Interface is based on the FAT file system. EFI defines a specific version of FAT that is explicitly documented and testable. Conformance to the EFI specification and its associate reference documents is the only definition of FAT that needs to be implemented to support EFI. To differentiate the EFI file system from pure FAT, a new partition file system type has been defined.
EFI encompasses the use of FAT32 for a system partition, and FAT12 or FAT16 for removable media. The FAT32 system partition is identified by an OSType value other than that used to identify previous versions of FAT. This unique partition type distinguishes an EFI defined file system from a normal FAT file system. The file system supported by EFI includes support for long file names.
The definition of the EFI file system will be maintained by specification and will not evolve over time to deal with errata or variant interpretations in OS file system drivers or file system utilities. Future enhancements and compatibility enhancements to FAT will not be automatically included in EFI file systems. The EFI file system is a target that is fixed by the EFI specification, and other specifications explicitly referenced by the EFI specification.
For more information about the EFI file system and file image format, visit the web site from which this document was obtained.
ext4 is just ext2 with some options. If I counted correctly, you only need to implement five incompatible options and you can already read an ext4 image. Another six read-only options and you can write to it. Another four compatible options to get improved performance. And ext4 is the default FS of most Linux distributions at this time.zaval wrote:[...] since ext2 is a nearly extinct linux legacy[...]
Oh, OK. I misunderstood you there.zaval wrote:No, I meant the whole FAT family.