Search code examples
filesystemsfile-format

Custom-made archive format question


I was thinking about developing an own file archive format to use for private projects. The thing is that I am not looking for a solution like 7z or RAR, but I want to make something different, similar to a file system.

Looking at real file system, each has two sections in common in its architecture - information about files stored on disk and actual data of the files, as follows:

    ----------------------------
       METADATA  |  FILE DATA
    ----------------------------

My question is - how is it possible that these two sections will not overlap? I mean, the FAT STRUCTURE section grows towards the FILE DATA section, while the latter grows towards the end of the disk (partition). How does a file system manage these sections?

This is what I have been trying to figure out for most of the time and any tip would be more than welcome.


Solution

  • Most file systems operate with clusters or pages or blocks, which have fixed size. In many filesystems the directory (metadata) is a just a special file, so it can grow in the same way the regular data files grow. On other filesystems some master metadata block has a fixed size which is pre-allocated during file system formatting. In this case the file system can become full before files take all available space.

    On a side note, is there a reason to reinvent the wheel (custom file system for private needs)? There exist some implementations of in-file virtual file systems which are similar to archives, but provide more functionality. One of examples is our SolFS.