Journalling and storage corruption

CBFS Storage has a complex internal structure, which can be damaged if the storage is not closed properly or if some operation is interrupted in the middle. This can happen due to a system or application crash or due to an application error (in callback mode). Also, storage corruption can be caused by the failure of the physical media or by external modification of the storage contents.

When the storage is corrupted, any operation can return errStorageCorrupted error code. IsCorrupted property can also be used to check whether the storage is OK or corrupted.

If the storage is corrupted, you need to use CheckAndRepair() method to attempt to fix the storage. Be sure to create a backup before repairing the storage - while CheckAndRepair procedure attempts to fix the problems, it doesn't do miracles. Some data might become lost if the storage integrity is badly damaged.


Journalling is the technique used to reduce the chance for storage corruption caused by application or system crash. Journalling internally uses transactions, so you can read about transactions in this documentation. Journalling is enabled or disabled using UseTransactions property or UseTransactions parameter of Constructor of SolFSStorage class.

When CBFS Storage works in journalling mode, it first opens transaction and writes information to the journal, which is located inside of the storage. Then the actual data is written to the storage. Finally the transaction is commited by another writing to the journal. Due to multiple writing operations, journalling slows down writing to the storage significantly.

Journalling can be enabled or disabled on the same storage when you open the storage. In other words, you can use the same storage first with journalling, then without it, and vice versa. However, you can't enable or disable journalling while the storage is opened.

If the storage is not closed properly (due to application or system crash), there will be pending transactions in the journal. On the next start, CBFS Storage will discover the pending transactions and will attempt to commit or rollback them (depending on the state of the transaction). This way the integrity of the storage will be kept.

Note: Journalling doesn't prevent corruption caused by malfunction of the physical media or intentional damage caused to the storage (altering bytes of data inside of the storage).