Russell Coker: BTRFS and ZFS as Layering Violations
LWN has an interesting article comparing recent developments in the Linux world to the Unix Wars that essentially killed every proprietary Unix system [1]. The article is really interesting and I recommend reading it, it s probably only available to subscribers at the moment but should be generally available in a week or so (I used my Debian access sponsored by HP to read it).
A comment on that article cites my previous post about the reliability of RAID [2] and then goes on to disagree with my conclusion that using the filesystem for everything is the right thing to do.
The Benefits of Layers
I don t believe as strongly in the BTRFS/ZFS design as the commentator probably thinks. The current way my servers (and a huge number of other Linux systems) work of having RAID to form a reliable array of disks from a set of cheap disks for the purpose of reliability and often capacity or performance is a good thing. I have storage on top of the RAID array and can fix the RAID without bothering about the filesystem(s) and have done so in the past. I can also test the RAID array without involving any filesystem specific code. Then I have LVM running on top of the RAID array in exactly the same way that it runs on top of a single hard drive or SSD in the case of a laptop or netbook. So Linux on a laptop is much the same as Linux on a server in terms of storage once we get past the issue of whether a single disk or a RAID array is used for the LVM PV, among other things this means that the same code paths are used and I m less likely to encounter a bug when I install a new system.
LVM provides multiple LVs which can be used for filesystems, swap, or anything else that uses storage. So if a filesystem gets badly corrupted I can umount it, create an LVM snapshot, and then take appropriate measures to try and fix it without interfering with other filesystems.
When using layered storage I can easily add or change layers when it s appropriate. For example I have encryption on only some LVs on my laptop and netbook systems (there is no point encrypting the filesystem used for .iso files of Linux distributions) and on some servers I use RAID-0 for cached data.
When using a filesystem like BTRFS or ZFS which includes subvolumes (similar in result to LVM in some cases) and internal RAID you can t separate the layers. So if something gets corrupted then you have to deal with all the complexity of BTRFS or ZFS instead of just fixing the one layer that has a problem.
Update: One thing I forgot to mention when I first published this is the benefits of layering for some uncommon cases such as network devices. I can run an Ext4 filesystem over a RAID-1 array which has one device on NBD on another system. That s a bit unusual but it is apparently working well for some people. The internal RAID on ZFS and BTRFS doesn t support such things and using software RAID underneath ZFS or BTRFS loses some features.
When using DRBD you might have two servers with local RAID arrays, DRBD on top of that, and then an Ext4 filesystem. As any form of RAID other than internal RAID loses reliability features for ZFS and BTRFS that means that no matter how you might implement those filesystems with DRBD it seems that you will lose somehow. It seems that neither BTRFS nor ZFS supports a disconnected RAID mode (like a Linux software RAID with a bitmap so it can resync only the parts that didn t change) so it s not possible to use BTRFS or ZFS RAID-1 with an NBD device.
The only viable way of combining ZFS data integrity features with DRBD replication seems to be using a zvol for DRBD and then running Ext4 on top of that.
The Benefits of Integration
When RAID and the filesystem are separate things (with some added abstraction from LVM) it s difficult to optimise the filesystem for RAID performance at the best of times and impossible in many cases. When the filesystem manages RAID it can optimise it s operation to match the details of the RAID layout. I believe that in some situations ZFS will use mirroring instead of RAID-Z for small writes to reduce the load and that ZFS will combine writes into a single RAID-Z stripe (or set of contiguous RAID-Z stripes) to improve write performance.
It would be possible to have a RAID driver that includes checksums for all blocks, it could then read from another device when a checksum fails and give some of the reliability features that ZFS and BTRFS offer. Then to provide all the reliability benefits of ZFS you would at least need a filesystem that stores multiple copies of the data which would of course need checksums (because the filesystem could be used on a less reliable block device) and therefore you would end up with two checksums on the same data. Note that if you want to have a RAID array with checksums on all blocks then ZFS has a volume management feature (which is well described by Mark Round) [3]. Such a zvol could be used for a block device in a virtual machine and in an ideal world it would be possible to use one as swap space. But the zvol is apparently managed with all the regular ZFS mechanisms so it s not a direct list of blocks on disk and thus can t be extracted if there is a problem with ZFS.
Snapshots are an essential feature by today s standards. The ability to create lots of snapshots with low overhead is a significant feature of filesystems like BTRFS and ZFS. Now it is possible to run BTRFS or ZFS on top of a volume manager like LVM which does snapshots to cover the case of the filesystem getting corrupted. But again that would end up with two sets of overhead.
The way that ZFS supports snapshots which inherit encryption keys is also interesting.
Conclusion
It s technically possible to implement some of the ZFS features as separate layers, such as a software RAID implementation that put checksums on all blocks. But it appears that there isn t much interest in developing such things. So while people would use it (and people are using ZFS ZVols as block devices for other filesystems as described in a comment on Mark Round s blog) it s probably not going to be implemented.
Therefore we have a choice of all the complexity and features of BTRFS or ZFS, or the current RAID+LVM+Ext4 option. While the complexity of BTRFS and ZFS is a concern for me (particularly as BTRFS is new and ZFS is really complex and not well supported on Linux) it seems that there is no other option for certain types of large storage at the moment.
ZFS on Linux isn t a great option for me, but for some of my clients it seems to be the only option. ZFS on Solaris would be a better option in some ways, but that s not possible when you have important Linux software that needs fast access to the storage.
- [1] http://lwn.net/Articles/494248/
- [2] http://etbe.coker.com.au/2012/02/06/reliability-raid/
- [3] http://www.markround.com/archives/37-ZFS-as-a-volume-manager.html
- Starting with BTRFS Based on my investigation of RAID reliability [1] I have...
- ZFS vs BTRFS on Cheap Dell Servers I previously wrote about my first experiences with BTRFS [1]....
- Reliability of RAID ZDNet has an insightful article by Robin Harris predicting the...
It was almost 6 years in
In a simple world, if you wanted to store some objects and distribute them
on 4 nodes, you would split your hash space in 4. You would have 4
partitions, and computing hash(object) modulo 4 would tell you where to
store your object: on node 0, 1, 2 or 3.
But since you want to be able to extend your storage cluster to more nodes
without breaking the whole hash mapping and moving everything around, you
need to build a lot more partitions. Let's say we're going to build
210 partitions. Since we have 4 nodes, each node will
have
Data replication
Now that we have our storage theory in place (accounts, containers and
objects distributed into partitions, themselves stored into multiple zones),
let's go the replication practice.
When you put something in one of the 3 rings (being an account, a container
or an object) it is uploaded into all the zones responsible for the ring
partition the object belongs to. This upload into the different zones is the
responsibility of the swift-proxy daemon.
But if one of the zone is failing, you can't upload all your copies in all
zones at the upload time. So you need a mechanism to be sure the failing
zone will catch up to a correct state at some point.
That's the role of the swift- container,account,object -replicator
processes. This processes are running on each node part of a zone and
replicates their contents to nodes of the other zones.
When they run, they walk through all the contents from all the partitions on
the whole file system and for each partition, issue a special REPLICATE
HTTP request to all the other zones responsible for that same partition. The
other zone responds with information about the local state of the partition.
That allows the replicator process to decide if the remote zone has an
up-to-date version of the partition.
In case of account and containers, it doesn't check at the partition level,
but check each account/container contained inside each partition.
If something is not up-to-date, it will be pushed using rsync by the
replicator process. This is why you'll read that the replication updates are
"push based" in Swift documentation.
Just a short update for those who are wondering what is Kannada Dictionary bot, it is
a small Jabber chat bot written in Python which pulls out meaning for given English or Kannada
word from
LED Fireworks. Or, parent helpers go overboard
My friend, Mike Ward, and I help out at our kids school by teaching
5th and 6th graders programming in conjunction with a Lego class. For
several years, I was teaching Logo on ancient Apple II machines. The
teacher had a great curriculum and the kids learned a lot, but
this year we decided to switch things around and try them out on
Arduinos.
This spring, the kids are building a Lego display centered around
a birthday party theme for the star elephant at the Oregon Zoo
(Packy), who turned 50 last weekend. In a moment of fun, I suggested
that perhaps we should have some fireworks, along with the presents
and birthday cake. How hard could it be to wire up a couple of LEDs to
an Arduino to make something that looked like fireworks?
Selecting parts.
Mike and I sat down to order some parts from Digikey. We found these
nice, cheap,
You can see the LED driver chip sitting on a set of extension leads
plugged into the breadboard. It s hooked to the SPI port on the
Arduino board, with the clock set as fast as it will go. If you
watch the video, you can see that the LEDs actually vary in
brightness. They re actually being pulse-width modulated. Clocked at
2MHz, there s enough bandwidth in the SPI bus to drive 160 LEDs with
127 discrete pulse widths at nearly 100Hz (100 * 127 * 160 = 2032000).
Is bread boarding practical?
With the chip propped up on its extension wires, and the LEDs plugged
in, the whole setup was not surprisingly fragile. Getting five
of these chips wired up and running for the length of the Lego show
(one day at school and two days at the zoo) seemed unlikely. So, we
decided to build some custom circuit boards.
Using the GEDA tools to make circuit boards
My business partner, Bdale Garbee, and I build rocketry electronics
through 








Samuel Thibault is a French guy like me, but it took years until we met. He tends to keep a low profile, even though he s doing lots of good work that deserves to be mentioned.
He focuses on improving Debian s accessibility and contributes to the Hurd. Who said he s a dreamer?
So, the 
A few years ago I started to run my own server. This was an interesting challenge back then but today I only consider it a waste of time and money. Therefore I'm searching for (a) service provider(s) to substitute my self hosted applications:
As student application period of Google Summer of Code 2012 is over, it's time to look at proposals we got for
(and then complain, that they don't have enough time to submit patch as described in our
Please note that the numbers are not 100% accurate as some proposals really did not fit into above categories.
Anyway we're just waiting for last people submitting patches today and evaluation will finalize in upcoming days. Of course you will know the results from Google on April 23rd.