Roll Your Own Filesystem
This page or section is a work in progress and may thus be incomplete. Its content may be changed in the near future. |
Difficulty level |
---|
Master |
This page or section is unconventional. You shouldn't do this. |
Introduction
Please note that rolling your own filesystem IS NOT RECOMMENDED. You're likely to make it a FAT style filesystem, and please, we don't need another one of those. However, for those of you who wish to defy convention, then we need to stop you making another FAT for sanity's sake. So here is a tutorial on how to avoid a FAT (of course, the design is up to you, so we can't give you a complete tutorial on how to make it).
Use FUSE
The best practice for a new file system is to start with a FUSE driver. This is a simple user space application running on your build machine that allows mounting partition images of your file system. With that, you can easily create files and directories in the image, and later you can re-use significant parts of the code in your kernel when you'll write your native FS implementation. It is much preferable than writing your own image creator.
Avoiding FAT
So how do you avoid a FAT? It all comes down to recognizing a FAT and punching yourself if your FS matches the description.
Dos
- Use trees
- others?
Don'ts
- Use a File Allocation Table
- others?
Booting from your filesystem
You have 4 options here. Here are your options, in order of difficulty (and reward)
- Don't boot from it. Use a dedicated boot partition (like EFI System Partition) and your FS as the root.
- Use BOOTBOOT which can load an initial ramdisk from any file system.
- Roll your own bootloader
- Use GRUB by Writing a GRUB Module. You didn't expect GRUB to by pshycic and magically code itself, did you?