User:M12/Rolling Your Own Filesystem

From OSDev Wiki
Jump to navigation Jump to search

This page is a test for an edit to this one.

Rolling your own

There are many different kinds of filesystems around, from the well-known to the more obscure ones. The most unfortunate thing about filesystems is that every hobbyist OS programmer thinks that the filesystem they design is the ultimate technology, when in reality it's usually just a copy of FAT with a change here and there, perhaps because it is one of the easiest to implement. The world doesn't need another FAT-like filesystem. Investigate all the possibilites before you decide to roll your own.

Guidelines if you do decide to roll your own


  • Consider carefully what it will be used for.
  • Use a program to figure out the layout. I recommend a spreadsheet. The basic areas needed are:
    • Bootsector. Unless you are booting with UEFI, this is a must. Even then, I'd recommend including it in the specs for compatibility with older file systems. This section should contain at a minimum the disk size, location of the file table, hidden sectors for multiple partition disks, and a version number. I'd leaving plenty of reserved space for features you don't think of. Don't forget to leave space for a jmp instruction and the boot code!.
    • File table. Don't think of this as just a simple table containing a list of files and their locations. One idea I've had and never implemented is, instead of storing files, the system would store file parts, and the file table would list the parts in each file. This would be useful for saving space if many files on the disk are the same or similar (for example, license agreements).
    • Data area. Files will be stored here.
  • Create a program to read and write disk images with your filesystem. Parts of this will be portable into the fs driver.
  • Implement the fs into your OS.


Original Text

There are many different kinds of filesystems around, from the well-known to the more obscure ones. The most unfortunate thing about filesystems is that every hobbyist OS programmer thinks that the filesystem they design is the ultimate technology, when in reality it's usually just a copy of FAT with a change here and there, perhaps because it is one of the easiest to implement. The world doesn't need another FAT-like filesystem. Investigate all the possibilites before you decide you roll your own.