cfenollosa / os-tutorial

How to create an OS from scratch
BSD 3-Clause "New" or "Revised" License
26.58k stars 3.24k forks source link

Filesystem #198

Closed cryptosbyte closed 3 years ago

cryptosbyte commented 3 years ago

I opened this issue to find out if there is any tutorial on how to make a file system; on the other responses of previous, ancient issues, the GitHub links are either not working or just wrong.

Sorry I am kind of new to C-lang and wondering if I can make one; I also looked at the PDF document but there's nothing there for filesystems.

algorithmx51 commented 3 years ago

You mean how to make a custom filesystem from scratch or use an existent format like FAT-32 or ext4?

cryptosbyte commented 3 years ago

Making a custom filesystem using the ext4 format...

algorithmx51 commented 3 years ago

To use ext4 on your filesystem, you need to know how ext2 works, because ext3 and ext4 are like patches for ext2 Here is how ext2 works What is vfs and why you need it to handle files more easily And a discussion on VFS development Ext4 changes over ext2

Here are some other filesystems in case you want to take a look (and some filesystem theory)

But to use these formats you need a disk driver, like AHCI (where you need to have a PCI driver) or use ATA PIO

AHCI is much faster (but harder to implement) than ATA PIO (easier to implement), since AHCI uses DMA but with ATA PIO you need to write to the system bus and read from it for every read/write to the hard disk

But in case you need a video tutorial, or you find hard combining all this information in order to write your filesystem, i found a tutorial on youtube about the development of a UEFI operating system, and he is going to cover filesystem development (although i am not sure if he is going to implement ext4, maybe FAT 32 and ext2 instead)

cryptosbyte commented 3 years ago

Cool thanks a lot!