Since I've been working with HFS disk images a lot more lately I've started studying the file system itself in detail. Understanding all the data structures and where data is has various advantages especially if I end up encountering any damaged disk where partial or complete recovery might be possible. (I might also like to write some utilities someday).
I've made a lot of progress but there is still one question I have that I can't come up with a satisfying answer for. I'm hoping someone out there might already know.
The documentation in Inside Macintosh: Files assigns a CNID for the Catalog and the Extend Overflow files. These never appear in the catalog since the two files are special and don't show as normal files on the disk. But, if the catalog file grows large and fragmented enough records for the catalog file can appear in the extent file and they use this CNID. I've seen this happen and it seems to work just fine.
In principle at least, it seems possible that the extent file itself could also become large and fragmented enough that it would need extent overflow records of it's own. This is obviously a horrible fringe case and creates all kinds of complexity like having to make sure the records for later extents are always stored in the earlier extents in the file (or they couldn't be found). But, the existence of the CNID seems to imply this is possible.
I've tried to create this by creating a worst case disk where two large files were interleaved with each sector being an individual extent and it still didn't come close to filling up the three "root" extents for the file stored in the MDB.
So, it seems like the system is designed such that overflow file is always over provisioned to ensure that this never actually happens. Does anyone know for sure?
It just seems odd that the ID was assigned if it was never used but I guess this could just be for completeness. If this ever does happen it seems like it would be such an obscure case that a utility could probably just treat it as unsupported and refuse to work with the image. Or, maybe just defrag the image at that point which kind of makes the whole thing moot anyway.
Thanks!!