FSCK & Journaling
FSCK - File System checker
Scan the whole disk to find inconsistent part, which is too slow. And the FSCK doesn’t know the “correct” version of file, but can only guess.
Journaling
Snapshot of structure
Final version of Journaling
- (happens at the same time of 2) Data write: Write data to final location; wait for completion (the wait is optional).
- (happens at the same time of 1) Journal metadata write: Write the begin block and metadata to the log; wait for writes to complete.
- Journal commit: Write the transaction commit block (containing TxE) to the log; wait for the write to complete; the transaction (including data) is now committed.
- Checkpoint metadata: Write the contents of the metadata update to their final locations within the file system.
- Free: Later, mark the transaction free in journal superblock