> Hi Kenn,
>> Journalised filesystems work by saving filesystem "meta data" at
> periodic intervals (checkpoints). If a system crashes, by power
> failure or by the kernel crashing for example, and if the
> hardware isn't damaged, then the filesystem can be automatically
> rebuilt relatively quickly from the most recent checkpoint with a
> complete "journal". It is a common misconception that journalised
> filesystems are designed to protect your ordinary data; i.e. your
> kid's school project! This is NOT the case. A journalised
> filesystem is designed to protect your filesystem! Luckily,
> recovery of the filesystem has essentially nothing to do with a
> "race between the CPU, disk electronics and disk motor"!
I agree that I didn't explain exactly what journalling protects
(i.e. primarily the filesystem's own metadata).
However, this all works by the filesystem driver writing what it's
going to change to the journal, then making the change and then
marking the journal entry as done (to simplify things).
If a CPU reset occurs during the first step, then the journal entry
is seen as incomplete, and skipped during recovery at the next mount.
So the change "never happened".
If the CPU reset occurs during the second step, the change just gets
re-done according to the journal entry during recovery.
If the CPU reset occurs during the third step, the journal entry
will be either 'done' or 'not-done' at the next mount. If it's
marked 'done' then there is nothing to do. If it's still marked
'not-done' then the change is replayed.
However, all of this depends on the data hitting persistent storage
in the order required by the driver, and exactly as written by
the driver. As power goes down in a system, this gets harder
>From (watch for line wraps)
Please keep in mind that even a journaling file system can be
damaged by power loss. When a system loses power, that system's
behavior is undefined. For example, memory contents can decay
(become randomly corrupt) as the contents are copied to a hard
drive running on the last bit of power. This is a fundamentally
different situation from the more defined sequence of events
caused by pressing the system's "reset" button while the system
is running. In addition, IDE hard drives do not provide all of
the write order guarantees that SCSI drives do.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!