meithecatte / cursedfs

Make a disk image formatted with both ext2 and FAT at once
Do What The F*ck You Want To Public License
377 stars 12 forks source link

Question about implementation #2

Open stuaxo opened 4 years ago

stuaxo commented 4 years ago

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.

meithecatte commented 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.

stuaxo commented 4 years ago

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

Obviously there are many reasons this may not work - but maybe if the block size matches ext2 it might work ?