-1

I'm still confused with how file systems are implemented exactly.

From a Unix / Linux point of view, does each file system need its own driver? Hence special executable code in the kernel used to communicate with it. Or does it just contain data structures?

When we format an SD card for example with a file system, example EXT4 or FAT, my guess is that the kernel is able to figure out which file system is on it and hence already have the capability to communicate with it.

What happens now if we create our own new file system and format the SD card with it, how would the kernel know how to write to it etc. ? Thanks in advance.

3

This question is almost a duplicate, but of two separate questions, so I'll keep it short and refer you to the earlier questions for details. Yes, each filesystem needs its own driver. (The same piece of code can sometimes serve as a driver for similar filesystems; for example the Linux ext4 driver is also an ext3 driver.) See How does Linux, the kernel, mount filesystems? What actually does this? for more details.

The generic file system support code determines which driver to use based on instructions to the mount command or system call, and based on metadata stored in the filesystem or outside of it (partition metadata — this is rarely used because it's very incomplete, possibly unreliable, and usually redundant with metadata in the filesystem). See Where is the information about the file system format stored in External Hard Disks

If you create your own filesystem, you need to provide a driver for it.

| improve this answer | |
  • Thanks for your reply. In the case of formatting an SD card with a particular file system, must the kernel only be able to identify which file system the card has and then use the appropriate driver, or does logic actually exist on the SD card itself for managing the file system access? This part I still don't get – Engineer999 Apr 21 at 15:39
  • @Engineer999 There's no logic on the SD card, only data. – Gilles 'SO- stop being evil' Apr 21 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.