David A. Harding on 20 Feb 2009 14:38:48 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] How File System Journals Work, was Re: Final backup question, at least I hope so

On Fri, Feb 20, 2009 at 04:04:18PM -0500, Joseph Terranova wrote:
> Well the problem with journaling is that each write goes like this*:

A typical file system journal is a lot like a personal journal. You
don't write every detail about your life in your personal journal; you
only write the most important things. Similarly, a file system journal
doesn't write every bit of data to its journal; it also only writes
about the most important things.

What's important to a file system?  On Unix-style file systems, including
the ext series, the important things are the file meta data and the
directory entries.  The file meta data keeps track of which blocks on the
hard drive hold the file data.  On Unix-style systems, the directories
let you open files using their file names.

For example, if you want to write a new file, it goes a little bit
like this:

> write it to the journal

    1. Write the new file's meta data to the journal
    2. Write updated directory entry to the journal

> write it to the main file system

    3. Write the actual data to the file system

> remove it from the journal

    4. Move the new file's meta data from the journal to the file system
    5. Move the updated directory entry from the journal to the
       file system

> It's 2 writes and a delete instead of one write, so you're actually
> sending the data twice. 

Since you're only sending the meta data and directory information twice,
it probably only slows you down if you add or delete a lot of small or
empty files.

If you're interested in journaling, I suggest you start with its
Wikipedia article:


> ext4 is just ext3 plus extra stuff.

I don't think all the ext4 extra features are backwards compatible with
ext3 and ext2.

David A. Harding	    Website:  http://dtrt.org/
1 (609) 997-0765	      Email:  dave@dtrt.org
			Jabber/XMPP:  dharding@jabber.org
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug