# Silly question: Is ZFS a journaling file system?



## giahung (Sep 5, 2013)

When I had to reinstall my Xubuntu desktop I found that all Linux's file systems, except EXT2, are all journaling, and NTFS is also a journaling file system. I was using ZFS (my computer is 64 bit based and has more than 4 GB RAM, so PC-BSD forces me to use ZFS) and heard that it is a next generation file system, like BTRFS. BTRFS is a journaling file system (according to the Xubuntu Installer) so is ZFS a journaling one?


----------



## SirDice (Sep 5, 2013)

ZFS is a transactional filesystem.

http://docs.oracle.com/cd/E19253-01/819-5461/zfsover-2/


----------



## ShelLuser (Sep 5, 2013)

giahung said:
			
		

> I was used zfs (my computer is 64 bit based and has more than 4GB ram, so PC-BSD forces me to use zfs) and heard that it is an next generation file system, like btrfs. Btrfs is an journalling file system (according to the Xubuntu Installer) so if zfs an journalling ones?


Yes and no, my favourite answer 

In general; a journaling filesystem basically keeps a record of all the tasks it's going to perform in order to safeguard against crashes. When a crash occurs during an operation then a utility such as fsck can check the journal logs and then apply the changes which were scheduled (but got interrupted with the crash).

Now, ZFS provides a somewhat similar setup; the ZIL. The ZFS Intent Log. You can get more information on this from the zpool(8) manual page. Under normal circumstances the ZIL is set up in your ZFS pool, but you can also opt to separate it (if you want to use a separate device for it).

But as hinted at; there are differences. The ZIL for example is only written to but not read from, except when recovering from a crash. That differs from the traditional journaling model where a journal is also somewhat 'managed' (though this heavily differs per file system). SO basically an entry is made in the log, then the actual action is performed after which the entry gets removed from the log again.

However, keep in mind that ZFS doesn't merely stop here. It also uses checksums to protect data integrity (see checksum), you can tell it to keep multiple copies of your files (see copies), you can tell it to use more thorough checksums (see dedup) and finally you can even influence the way in which synchronous requests should behave (see sync). All of those settings can be found in the zfs(8) manual page.

Which is even ignoring the fine grained control you have over the way ZFS utilizes it's cache (which can both speed things up, but also introduce certain risks).

So summing up: yes, ZFS does indeed support "journaling", but it does so in a different manner than traditional journaling filesystems do. But then again, ZFS is also no ordinary file system


----------



## kpa (Sep 5, 2013)

AFAIK ZFS still uses the transaction model if ZIL is not used but there's no guarantee that the writes are committed synchronously to disk or are recoverable in case of a system crash.


----------



## throAU (Sep 6, 2013)

In terms of the end result, the benefits you get from journaling (plus others) are also given to you by the ZIL.


----------

