News for hackers. Stuff that matters.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by barrkel on Saturday November 22, 2014 @01:52PM (#8646291)
Zfs, to take one example, does do approximately what you want - the file system (or rather, the underlying block storage) has a tree structure, and changes to files are propagated via copy-on-write rewrites up the tree, so that earlier snapshots still get to see the original file.

This does make rolling things back trivial.

It doesn't give you dedupe for free, though. Think about what would have to happen: every modification would mean rehashing the modified block (not a problem, that should happen anyway to verify integrity). Let's say we dedupe at the block level rather than the file level to avoid the need for more expensive hashing operations, and to increase the likelihood of actually sharing stuff. Now, to determine whether we can deallocate the new block, we need to look up the hash. So we need an index of every block on the file system by hash. That necessarily involves either a big chunk of memory or a bunch of random I/O. Both are at a premium for a filesystem - the former for cache, the latter for throughput.

If you just want file dedupe, it's a smaller problem, but is less likely to create gains - most people don't store many copies of the same file, unless they're in the third party file storage business. So it isn't really suited to a general file system. If this is something you want, you could periodically go through your file system, hash all files with only one link count in the inode, and hard link them using the hash as a file name, into an set of directories fanning out by hash prefix. There may be some wrinkles with permissions; I believe btrfs has a different kind of copy with copy-on-write semantics that might be useful here.

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by marcosdumay on Saturday November 22, 2014 @09:04PM (#8647535)
Deleting is not a time sensitive command anyway.

But I don't think you'd have this problem. Just like we have an inode telling every block of a file, a filesystem like that would need a similar structure telling every hash of the file. When you delete a block, you look at this structure, the same way you look at an inode.

The only thing missing is that you'll need a counter at the blocks. And this counter will create some synchronization problems that may turn out more important than saving disk space.

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by vidoc on Saturday November 22, 2014 @03:25PM (#8646556)
I haven't used freebsd for 5-6 years, so I've never tried to use it with root on ZFS. Wondering if it suffers the same problems as btrfs when used as root: last time I tried that on Ubuntu, the fsync() performance made a lot of stuff just horribly slow (e.g: dpkg operations two orders of magnitude slower).
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by laumars on Sunday November 23, 2014 @06:40PM (#8650388)
I run FreeBSD with ZFS as root and it doesn't suffer from those issues. But then ZFS is quite significantly more mature than Btrfs anyway.

It's also worth noting that ZFS has been available as a root file system long before FreeBSD added ZFS to RELEASE. I remember running OpenSolaris (and some of it's forks, eg Nexenta) with ZFS root about 6 years ago. Possibly longer actually.

The issue with ZFS as root was more of a problem with the boot menu than the OS. OpenSolaris used GRUB where as FreeBSD obviously doesn't, so FreeBSD needs to either port their ZFS drivers to their bootloader, or employ a hacky method of having a UFS boot volume that then points to a ZFS root partition (which, sadly, is how FreeBSD currently works).

Interestingly, since GRUB is GPL, it meant that technically there were GPL ZFS drivers even before Btrfs started life (never mind the various Linux ports of CDDL-licenced ZFS drivers that have appeared since). Albeit those GPL ZFS drivers were read only

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by Freaky on Monday November 24, 2014 @10:41AM (#8652845)
> FreeBSD needs to either port their ZFS drivers to their bootloader, or employ a hacky method of having a UFS boot volume that then points to a ZFS root partition (which, sadly, is how FreeBSD currently works).

A ZFS-aware loader hit CURRENT in late 2008, and a dedicated zfsloader for use from (gpt)zfsboot hit the stable branches in late 2009.

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by laumars on Monday November 24, 2014 @12:36PM (#8653469)
AFAIK it's not in RELEASE yet though.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by Freaky on Monday November 24, 2014 @12:41PM (#8653504)
They were in 7.3-RELEASE, March 2010.

https://www.freebsd.org/releases/7.3R/announce.html

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by laumars on Monday November 24, 2014 @01:06PM (#8653658)
Just looked at the config on my file server and it turns out I'm booting FreeBSD in this way. I have no idea why I thought I was bootstrapping from UFS (possibly because I still had to manually create a boot GPT partition and since forgotten why?)

Anyhow, thank you for the correction :)

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by ClashTheBunny on Saturday November 22, 2014 @04:09PM (#8646672)
I don't know when this was fixed, but I have no longer had any problems with btrfs on root with ubuntu. I don't remember when it started working well, but I do remember those bad old days. I don't know if dpkg changed or if btrfs changed.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by ClashTheBunny on Saturday November 22, 2014 @02:28PM (#8646396)
cp --reflink
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by eeZi on Saturday November 22, 2014 @03:39PM (#8646590)
One of the few feature btrs has which ZFS hasn't.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by wtallis on Saturday November 22, 2014 @05:42PM (#8646930)
At this point, I don't think it's fair to imply that btrfs is lagging behind ZFS. Yes, there are quite a few things that ZFS does better than btrfs, but btrfs isn't following in ZFS's footsteps and has some killer features that ZFS will never have, like on-the-fly changing between RAID modes and resizing arrays in either direction.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by crest on Monday November 24, 2014 @12:55AM (#8651229)
Btrfs has a broken by design on disk format. Btrfs went with self describing checksums inside blocks instead of a Merkle-DAG with a round robin root. In doing so they ignored existing research at the start of the btrfs project and the only fix is to change the on disk format to add the children's checkums to the parent nodes.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by wtallis on Monday November 24, 2014 @02:30AM (#8651400)
That doesn't sound "broken by design" to me, just less thoroughly safeguarded than ZFS but still more than almost any other filesystem. It's completely consistent with my claim that btrfs isn't trying to follow exactly in the footsteps of ZFS. (And it's not like Merkle trees don't have any tradeoffs.)
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by ptman on Sunday November 23, 2014 @06:35AM (#8648490)
ZFS would need block pointer rewrites to implement those features, right? I don't think ZFS developers are opposed to that, but progress is just stalled. So I think "will never have" is a bit strongly worded.
Re:Ask HN: Can we talk about FreeBSD vs. Linux? by wtallis on Sunday November 23, 2014 @10:22AM (#8648965)
https://www.youtube.com/watch?v=G2vIdPmsnTI#t=44m53s

The above video is an explanation of a bunch of the barriers to implementing block pointer rewrites. The conclusion is that it would make the code a lot more complicated and break a lot of the layering, and probably make addition of other new features a lot harder. Even a standalone offline rewriting tool wouldn't necessarily be accepted into the OpenZFS codebase because of the maintenance burden. Their advice is that if you think you need that feature to solve a particular problem, you should be looking for a workaround to solve that problem without requiring the huge block pointer rewrite project (which nobody's working on), even if the workarounds have a significant and permanent performance impact.

When you take into account how long the feature's been in demand and been on the roadmaps under "eventually", it's clearly not going to happen anytime soon and won't happen without a major change to how ZFS development is being done. It's not definitely impossible, but it's perpetually several years away from happening. With btrfs already having it's equivalent to that feature and stealing an ever-growing slice of the users who need that feature, it's probably never going to happen for ZFS.

Re:Ask HN: Can we talk about FreeBSD vs. Linux? by allanjude on Wednesday November 26, 2014 @01:45PM (#8663932)
A feature similar to this was discussed at the OpenZFS Developers Summit earlier this month

http://open-zfs.org/w/images/7/71/Fast_File_Cloning-Pavel_Za...