So, reading through your thread I conclude that we agree that
- write caching is a hardware feature
- journaling is a software feature
- every hard drive supports write caching
- every major filesystem supports journaling
Of course, write caching and journaling are completely not related to each other.
Write caching is a technique to minimize hard disk seek time by ordering pending write/read-operations so that the write-heads have to move as little as possible. For example, if one file is fragmented to the beginning and the end of the disk and another file is in the middle, it is more efficient to firstly read the first chunk of the first file, then the second file, then the second chunk of the first file. Without write caching, one would first read the whole first file, then the second file, which would take about 150% of the time.
Journaling is a technique that memorizes all pending read/write-operations and checks if they were completed successfully. For example, it memorizes that a file should be updated. The hard drive then starts to search for free memory, write the new file to that memory and then frees the old memory. If this process got interrupted while writing the new file, the journaled file system will discard the half-written new copy and continue working with the old one. If it got interrupted while freeing the old file, the file system will note that it was not freed and continue to do so when the computer is restarted.
So write caching is a performance hack and journaling makes sure that the file system always makes sense.
Of course, write caching can be a security risk, in that single read/write-operations take generally more time and so the risk of a power loss in that time is greater. But this is something that journaling easily fixes in that it absolutely assures that a failed read/write-operation does not make the file system inconsistent.
If the power loss occures during a write, neither write caching nor journaling will rescue the not-written data. However, without journaling, there is that half-written new file that the file system is not able to deal with. With journaling, it knows that it is a broken chunk of data and will discard it, thus avoiding errors.
Anyway, I did not experience a power loss in years. Are they more frequent in the US?
Last edited by Paperflyer; 05-24-2008 at 01:21 PM.
Greetings from northern Germany,