You are not logged in.

#1 2011-02-03 17:55:05

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

General question about filesystem journalling

I asked it here first. But noone could answer the last post yet. So I thought maybe some folks on this forum know the answer...

I don't understand journalling mode of ext4 then. I mean - in maximum journal mode ext4 journals not only meta-data but also data (it journals data before actual writing data to the HDD). Like - it'll help to save data in case of crash along with FS working condition. As it turns out - full journalling of ext4 doesn't save data because of flushing mechanism... Then what's the point of journalling data?

Offline

#2 2011-02-04 06:04:05

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: General question about filesystem journalling

I _think_ it is for when you overwrite a file (like you edited a document and then save the new document over the old one) and while saving your power fails.


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#3 2011-02-04 17:06:14

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: General question about filesystem journalling

If you can site your claim that "full journaling of ext4 doesn't save data because of flushing mechanism," then I can probably explain it.

Offline

#4 2011-02-05 08:06:12

Mr. Alex
Member
Registered: 2010-08-26
Posts: 623

Re: General question about filesystem journalling

tavianator, when I use ext4 with full journalling, does the system cache data before writing it on the HDD? If yes and if it makes delay before moving data from cache to HDD (cache is in RAM, right?) then data can be lost in case of power crash after the data is written to cache but hasn't moved to HDD yet?

Offline

#5 2011-02-05 17:35:33

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: General question about filesystem journalling

Ah I see what you mean.  data=journal only provides a stronger guarantee that a file will not be corrupted if the system crashes during a write to disk.  But by default, a write to disk may happen much later than the actual write to the file, due to caching (which is in RAM, yes).  Applications like databases which care about this behaviour use fsync() and related calls to ensure that data gets to disk.  If you want to do it for a whole filesystem, mount it with the "sync" and "dirsync" options, but be ready for serious performance loss.

Offline

Board footer

Powered by FluxBB