Hyperspeed wrote:
But isn't a valid bitmap there for a reason?
Of course it is. AFAIK each of the mentioned file systems maintains a bitmap of any kind. The bitmap holds the information which blocks of the disk are in use. Each bit represents one block. 0 means it is free and 1 means it is in use (or vice versa, don't know).
The main difference is how the file system handles the bitmap.
FFS is very safe on one hand because it keeps many redundancies. But it is also very memory efficient on the other hand because is does all changes in-place.
If you write a file to an FFS disk, first the bitmap is marked invalid, then the changed directory blocks are replaced, then the file's data is written to disk, then the changed bitmap blocks are replaced and finally the bitmap is marked valid again.
Now if you crash in the middle of this process, the bitmap remains marked invalid and next time the disk is mounted, the file system has to read each and every file and directory on the disk in order to recreate the bitmap, because it does not know what was changed before the crash. This is called validation (done by a program called Disk-Validator).
PFS handles it different. (I don't know SFS but I guess it is similar). PFS does not change existing blocks but creates copies of the blocks to be changed and only the final write to the root block with pointers to the new blocks in it is an in-place replacement. So if the computer crashes while PFS does its updates, the root block still points to the old directory structure which is completely valid. All changes which were made have vanished. Of course the blocks which were written are still there, but as the old bitmap still shows them as unused and there are no pointers to them, the file system does not know about them.
So with FFS, if a file was partially written, you might have a long validation session afterwards with unrecoverable errors in the end. But part of the data you wanted to save is still there.
With PFS the file system is up and usable again immediately after a crash but all partially saved data is lost.
Bye,
Thomas