Open stuaxo opened 4 years ago
Currently the filesystems are entirely independent and don't share data. I want to explore creating some files that would be shared between the two (or more!) filesystems. Naturally, deleting them would be unsafe and induce corruption.
I don't know enough to implement this, but maybe it could work like this:
one filesystem can be written to at a time, and the others are readonly - they get synced after writes to the first one.
To start with, this could be limited to a writing to ext2/3 and syncing readonly FAT filesystem to the same files after those writes.
The ext2 and FAT filesystem would have the same size datablocks (cluster size on fat??)
This is because FAT has a relatively simple structure to write, and ext2 has debugfs to read the data blocks.
list of the datablocks in a file in the ext2 filesystem with debugfs:
https://serverfault.com/questions/29886/how-do-i-list-a-files-data-blocks-on-linux
To sync the a file to the fat filesystem
mount it, or use mtools to create a zero length file with the correct name. (this avoids having to manually deal with long filenames in the FAT fs).
iterate the datablocks on the ext file system and update the entry for the file in the FAT to point to those blocks.
Obviously there are many reasons this may not work - but maybe if the block size matches ext2 it might work ?
Is the data duplicated, or are blocks for a file only in one place + referenced by the FAT, and whatever ext2/3 does ?
Edit: The most cursed implementation I can imagine has each file stored only once.