Slashdot Mirror


ZFS Gets Built-In Deduplication

elREG writes to mention that Sun's ZFS now has built-in deduplication utilizing a master hash function to map duplicate blocks of data to a single block instead of storing multiples. "File-level deduplication has the lowest processing overhead but is the least efficient method. Block-level dedupe requires more processing power, and is said to be good for virtual machine images. Byte-range dedupe uses the most processing power and is ideal for small pieces of data that may be replicated and are not block-aligned, such as e-mail attachments. Sun reckons such deduplication is best done at the application level since an app would know about the data. ZFS provides block-level deduplication, using SHA256 hashing, and it maps naturally to ZFS's 256-bit block checksums. The deduplication is done inline, with ZFS assuming it's running with a multi-threaded operating system and on a server with lots of processing power. A multi-core server, in other words."

59 of 386 comments (clear)

  1. Does that mean... by Anonymous Coward · · Score: 4, Funny

    Duplicate slashdot articles will be links back to the original one?

    1. Re:Does that mean... by ezzzD55J · · Score: 3, Insightful

      The single block is still stored redundantly, of course. Just not redundantly more than once.

    2. Re:Does that mean... by Methlin · · Score: 2, Insightful

      Er, isn't block deduplication really really bad at a hard drive block failure point of view? You'd have to compress or otherwise change the data to have a copy now, or it'd just be marked redundant; if that block where all those redundant nodes are pointing to go bad, all of those files are now bad.

      If you were concerned about block level failure or even just drive level failure, you wouldn't be running your ZFS pool without redundancy (mirror or raidz(2)).

    3. Re:Does that mean... by hedwards · · Score: 2, Insightful

      That requires a citation.

      ZFS isn't that much different than traditional file systems. I'm not quite sure how that reconciles with the fact that it reports unrecoverable bits of information when it couldn't self heal to you. If it were that unusable there'd be no point. Additionally there isn't really much likelihood of that happening considering that ZFS isn't really supposed to be used outside of a ZMIRROR or RAIDZ environment. Sure you can do it, but most of the goodness comes from multiple disks.

    4. Re:Does that mean... by noidentity · · Score: 2, Insightful

      Duplicate slashdot articles will be links back to the original one?

      No, see, this de-duplication is transparent at the interface level. So while dupes won't take extra disk space on Slashdot servers, we'll still see them as normal. Isn't it nice to know that this optimization will be taking place?

    5. Re:Does that mean... by mr+crypto · · Score: 2, Interesting

      De-dup also means some unexpected behavior. Want to copy a 5 GB file? Done in less than a second.

      Over-write a section of a dup'ed file with new content? Suddenly you're using more disk space, or could even get a "disk full" message even though you were just replacing data, but not increasing it's size in an obvious way.

      Trying to make space on a drive by deleting lots of big files that happen to be dup'ed? No effect.

  2. Hash Collisions by UltimApe · · Score: 2, Interesting

    Surely with high amounts of data (that zfs is supposed to be able to handle), a hash collision may occur? I'm sure a block is > 256bits. Do they just expect this never to happen?

    Although I suppose they could just be using it as a way to narrow down candidates for deduplication... doing a final bit for bit check before deciding the data is the same.

    --
    "Infecting minds with my own memetic virus, one post at a time." Ultimape
    1. Re:Hash Collisions by CMonk · · Score: 3, Informative

      That is covered very clearly in the blog article referenced from the Register article. http://blogs.sun.com/bonwick/en_US/entry/zfs_dedup

    2. Re:Hash Collisions by Rising+Ape · · Score: 2, Informative

      The probability of a hash collision for a 256 bit hash (or even a 128 bit one) is negligible.

      How negligible? Well, the probability of a collision is never more then N^2 / 2^h, where N is the number of blocks stored and h is the number of bits in the hash. So, if we have 2^64 blocks stored (a mere billion terabytes or so for 128 byte blocks) , the probability of a collision is less than 2^(-128), or 10^(-38). Hardly worth worrying about.

      And that's an upper limit, not the actual value.

    3. Re:Hash Collisions by pclminion · · Score: 2, Funny

      Suppose you can tolerate a chance of collision of 10^-18 per-block. Given a 256-bit hash, it would take 4.8e29 blocks to achieve this collision probability. Supposing a block size of 512 bytes, that's 223517417907714843750 terabytes.

      Now, supposing you have a 223517417907714843750 terabyte drive, and you can NOT tolerate a collision probability of 10^-18, then you can just do a bit-for-bit check of the colliding blocks before deciding if they are identical or not.

    4. Re:Hash Collisions by pclminion · · Score: 2, Interesting

      Oops. I didn't mean 10^-18 per-block, I meant 10^-18 for the entire filesystem. (Obviously it doesn't make sense the other way)

    5. Re:Hash Collisions by icebike · · Score: 2, Funny

      If blocks that are supposedly from different files have the same block data, does it really matter if it's marked redundant?

      I thing the hash collision people are worrying about is when two blocks/files/byte-ranges are hashed to be identical but in fact differ.

      When that happens your Power Point presentation contains your Bosses bedroom-cam shots.

      --
      Sig Battery depleted. Reverting to safe mode.
    6. Re:Hash Collisions by shutdown+-p+now · · Score: 4, Informative

      Before I left Acronis, I was the lead developer and designer for deduplication in Acronis Backup & Recovery 10. We also used SHA256 there, and naturally the possibility of a hash collision was investigated. After we did the math, it turned out that you're about 10^6 times more likely to lose data because of hardware failure (even considering RAID) than you are to lose it because of a hash collision.

    7. Re:Hash Collisions by dotgain · · Score: 2, Interesting
      Before the instruction you posted, I found this explanation in TFA:

      An enormous amount of the world's commerce operates on this assumption, including your daily credit card transactions. However, if this makes you uneasy, that's OK: ZFS provies a 'verify' option that performs a full comparison of every incoming block with any alleged duplicate to ensure that they really are the same, and ZFS resolves the conflict if not. To enable this variant of dedup, just specify 'verify' instead of 'on':

      I fail to see how someone can sit down and rationally decide whether their data will be more susceptible to hash collisions or not. While I would be very surprised if any two blocks on my computer hash to the same value in spite of being different, it seems to me that someone's going to get hit by this sooner rather than later. And what a nasty way to find hash collisions! Who would have thought my Aunt's chocolate cake recipe had the same SHA1 as hello.jpg from goatse.cx!.

      On one hand, 2^256 is a damn big keyspace. I've heard people say a collision is about as likely as winning every lottery in the world simultaneously, and then doing it again next week. Bug give enough computers with enough blocks enough time, and find a SHA1 collision you will. Depending on what kind of data it happens to, you might not even notice it.

  3. Any other file systems with that feature? by Dwedit · · Score: 2

    Are there any other filesystems with that feature? If not, I'm very strongly considering writing my own.

    1. Re:Any other file systems with that feature? by iMaple · · Score: 5, Informative

      Windows Storage Server 2003 (yes, yes I know its from Microsoft) shipped with this feature (that is called Single Instance Storage)
      http://blogs.technet.com/josebda/archive/2008/01/02/the-basics-of-single-instance-storage-sis-in-wss-2003-r2-and-wudss-2003.a

    2. Re:Any other file systems with that feature? by hapalibashi · · Score: 2, Informative

      Yes, Venti. I believe it originated in Plan9 from Bell Labs.

    3. Re:Any other file systems with that feature? by ZerdZerd · · Score: 2, Interesting

      I hope btrfs will get it. Or else you will have to add it :)

      --
      I'm not insane! My mother had me tested.
    4. Re:Any other file systems with that feature? by TheSpoom · · Score: 2, Interesting

      What I'm wondering about all of this is what happens when you edit one of the files? Does it "reduplicate" them? And if so, isn't that inefficient in terms of the time needed to update a large file (in that it would need to recopy the file over to another section of the disk in order to maintain the fact that there are two now-different copies)?

      --
      It's better to vote for what you want and not get it than to vote for what you don't want and get it.
      - E. Debs
    5. Re:Any other file systems with that feature? by buchner.johannes · · Score: 4, Informative

      From that link: It is file-based and a service indexes it (whereas in ZFS it is block-based and on-the-fly). And they first introduced it in Windows Server 2000. Amazing. I'm sure it is a ugly hack since Windows has no soft/hard-links IIRC.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    6. Re:Any other file systems with that feature? by hedwards · · Score: 3, Informative

      ZFS is a copy on write filesystem, it already creates a temporary second copy so that the file system is always consistent if not quite up to date. I'd venture to guess that the new version of the file, not being identical to the old file would just be treated like copying it to a new name.

    7. Re:Any other file systems with that feature? by jpmorgan · · Score: 4, Informative

      You recall wrong. NTFS has long supported both hard links and a mechanism called 'reparse points,' which are much more powerful than simple symlinks.

    8. Re:Any other file systems with that feature? by bertok · · Score: 3, Informative

      Windows Storage Server 2003 (yes, yes I know its from Microsoft) shipped with this feature (that is called Single Instance Storage)
      http://blogs.technet.com/josebda/archive/2008/01/02/the-basics-of-single-instance-storage-sis-in-wss-2003-r2-and-wudss-2003.a

      It's not even close to the same thing.

      We investigated this a while back, and it is basically a dirty, filthy hack on top of vanilla NTFS.

      First of all, it doesn't compare blocks or byte-ranges, but entire files only. If two files are 99% identical, then they are different, and SIS won't merge them.

      Second, it uses a reparse point to merge the files, which has significant overhead, at least 4KB for each file, if I remember correctly. That is, SIS won't save you any disk space for small files, which is actually quite common on file servers. The overhead erases much of the benefit even for larger files, to the level that SIS will skip files smaller than 32KB by default.

      Third, it operates in the background, after files have been written. This means that files have to be written out in their entirety, read back in, compared byte-for-byte to another file, and then erased later. This is incredibly inefficient. On large file servers, the disk was thrashed like crazy.

      Lastly, we found that the Copy-on-Write mechanism immediately copied out the entire file if it was changed even slightly. For small files, this is not noticable, but for large files this can be a massive performance hog. A 4kb write can be potentially translated into a multi-GB copy!

      Proper single-instancing systems use in-memory hash tables that are often partitioned using "file similarity" heuristics to prevent cache thrashing. Even more advanced systems can maintain single-instancing during replication and backups, reducing bandwidth requirements enormously. Take a look at the features of the Data Domain filers for an idea of what the current state of the art is.

    9. Re:Any other file systems with that feature? by binaryspiral · · Score: 4, Interesting

      Microsoft's SIS is a joke. A few folks have dedupe down to a science - Data Domain and NetApp.

      We virtualized our filers into an ESX 3.5 cluster and dropped the VMDK files onto a NetApp 3140... deduped them to 18% of their original size. No performance impact, actually faster than our original servers and much more efficient.

      ROI - three months.

      Difficulty to implement dedup? A checkmark and the OK button.

  4. More reason to be a ZFS fanboy by BitZtream · · Score: 3, Insightful

    I'm wondering how long its going to take for them to do something with ZFS that actually makes me slow down my overwhelming ZFS fanboyism.

    I just love these guys.

    My virtual machine NFS server is going to have to get this as soon as FBSD imports it, and I'll no longer have to worry about having backup software (like BackupPC, good stuff btw) that does this.

    I don't use high end SANs but it would seem to me that they are rapidly losing any particular advantage to a Solaris or FBSD file server.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    1. Re:More reason to be a ZFS fanboy by HockeyPuck · · Score: 3, Informative

      The advantages of SANs are easy to realize, they need not necessarily be FibreChannel vs NAS (NFS/CIFS) as a SAN could be iSCSI, FCOE, FCIP, FICON etc..

      -Storage Consolidation compared with internal disk.
      -Fewer components in your servers that can break.
      -Server admins don't have to focus on Storage except at the VolMgr/Filesystem level
      -Higher Utilization (a WebServer might not need 500GB of internal disk).
      -Offloading storage based functions (RAID in the array vs RAID on your server's CPU, I'd rather the CPU perform application work rather than calculating parity, replacing failed disks etc). This increases when you want to replicate to a DR site.

      This is not a ZFS vs SANs argument. I think ZFS running on SAN based storage is a great idea as ZFS replaces/combines two applications that are already on the host (volmgr & filesystem).

    2. Re:More reason to be a ZFS fanboy by Anonymous Coward · · Score: 5, Informative

      How about this: you can't remove a top-level vdev without destroying your storage pool. That means that if you accidentally use the "zpool add" command instead of "zpool attach" to add a new disk to a mirror, you are in a world of hurt.

      How about this: after years of ZFS being around, you still can't add or remove disks from a RAID-Z.

      How about this: If you have a mirror between two devices of different sizes, and you remove the smaller one, you won't be able to add it back. The vdev will autoexpand to fill the larger disk, even if no data is actually written, and the disk that was just a moment ago part of the mirror is now "too small".

      How about this: the whole system was designed with the implicit assumption that your storage needs would only ever grow, with the result that in nearly all cases it's impossible to ever scale a ZFS pool down.

    3. Re:More reason to be a ZFS fanboy by Methlin · · Score: 4, Informative

      Mod parent up. These are all legit deficiencies in ZFS that really need to be fixed at some point. Currently the only solutions to these is to build a new storage pool, either on the same system or different system, and export/import; big PITA and potentially expensive. Off the top of my head I can't think of anyone that lets you do #2 except enterprise storage solutions and Drobo.

    4. Re:More reason to be a ZFS fanboy by SLi · · Score: 2, Interesting

      Mod parent up. These are all legit deficiencies in ZFS that really need to be fixed at some point.

      Only if it's costworthy. For a case I know about XFS lacks filesystem shrinking too, and it has been asked for many times. It has been estimated that it would take months for a skilled XFS engineer to code. If it's so important that someone is willing to put up that money (or effort), it may happen; otherwise it will not. I'm sure the same applies to ZFS.

    5. Re:More reason to be a ZFS fanboy by KonoWatakushi · · Score: 3, Informative

      How alarmist and uninformed; borderline FUD. The reality is as follows...

      First, you can't remove a vdev yet, but development is in progress, and support is expected very soon now. Same with crypto.

      Second, mistakenly typing add instead of attach will result in a warning that the specified redundancy is different, and refuse to add it.

      Third, yes, you can't expand the width of a RAID-Z. You can still grow it though, by replacing it with larger drives. Once the block pointer rewrite work is merged, removal will be possible, and expansion won't be far off either.

      Forth, vdevs no longer autoexpand by default. If you want that behavior, you can to set the autoexpand property to yes.

      Last, there was no such assumption, it is simply a matter of priorities. If it were an easier problem, it would have been done long ago, but I'm happy to be patient, knowing that it will be done right. Most everyone who has seriously used ZFS will understand that the advantages will hugely outweigh these minor nits, which are easily worked around.

    6. Re:More reason to be a ZFS fanboy by greg1104 · · Score: 4, Informative

      How alarmist and uninformed; borderline FUD. The reality is as follows...

      First, you can't remove a vdev yet, but development is in progress, and support is expected very soon now.

      The bug report for this problem goes back to at least April of 2003. With that background, and that I've been hearing ZFS proponents suggesting this is coming "very soon now" for years without a fix, I'll believe it when I see it. Raising awareness that Sun's development priorities clearly haven't been toward any shrinking operation isn't FUD, it's the truth. Now, to be fair, that class of operations isn't very well supported on anything short of really expensive hardware either, but if you need these capabilities the weaknesses of ZFS here do reduce its ability to work for every use case.

    7. Re:More reason to be a ZFS fanboy by symbolset · · Score: 2, Insightful

      I'm curious about these storage needs that shrink. Is this a hypothetical case, or can you provide a real world citation of an example? In a broad world many strange things are found but I always considered this one mythical.

      --
      Help stamp out iliturcy.
    8. Re:More reason to be a ZFS fanboy by paulhar · · Score: 2, Informative

      TCP overhead at 1GbE for a modern processor is negligible - you're only talking about processing 120MB/sec or so.

      Here is a document including a pretty graph: http://media.netapp.com/documents/tr-3628.pdf

      "...enabling the TCP Offload Engine (TOE) on the Linux hosts did not noticeably affect performance on the IBM blade side."

  5. Re:This is good news... by bcmm · · Score: 4, Insightful

    ...and would normally make me happy; except I'm a Mac user. Still good news, but could've been better for a certain sub-set of the population, darn it.

    Use open source, get cutting edge things.

    --
    # cat /dev/mem | strings | grep -i llama
    Damn, my RAM is full of llamas.
  6. Next home server will be OpenSolaris (or fBSD) by 0100010001010011 · · Score: 2, Insightful

    ZFS, from what I can tell, kicks ass. I've played around with it in virtual machines, taking drives off line, recreating them, adding drives, etc.

    When I search NewEgg I also search OpenSolaris' compatibility list.

    The two areas that Linux is playing catchup is Filesystems (like this) and Sound (OSS, Pulse, Alsa Oh My!). And before you go pointing out the btrfs project, this has been in servers for years. It's tried in an enterprise environment. Your file system is still in beta with a huge "Don't use this for important stuff" warning.

    1. Re:Next home server will be OpenSolaris (or fBSD) by buchner.johannes · · Score: 2, Funny

      Oh yeah? Well tux is cuter so I'm not switching.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    2. Re:Next home server will be OpenSolaris (or fBSD) by buchner.johannes · · Score: 2, Interesting

      I'm sure btrfs -- once fully implemented and tested -- will also have problems reaching the performance of reiser4.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
  7. Wake me when they build it into the hard disk by icebike · · Score: 4, Interesting

    Imagine he amount of stuff you could (unreliably) store on a hard disk if massive de-duplication was built into the drive electronics. It could even do this quietly in the background.

    I say unreliably, because years ago we had a Novell server that used an automated compression scheme. Eventually, the drive got full anyway, and we had to migrate to a larger disk.

    But since the copy operation de-compressed files on the fly we couldn't copy because any attempt to reference several large compressed files instantly consumed all remaining space on the drive. What ensued was a nightmare of copy and delete files beginning with the smallest, and working our way up to the largest. It took over a day of manual effort before we freed up enough space to mass-move the remaining files.

    De-duplication is pretty much the same thing, compression by recording and eliminating duplicates. But any minor automated update of some files runs the risk of changing them such that what was a duplicate, must now be stored separately.

    This could trigger a similar situation where there was suddenly not enough room to store the same amount of data that was already on the device. (For some values of "suddenly" and "already").

    For archival stuff or OS components (executables, and source code etc) which virtually never change this would be great.

    But there is a hell to pay somewhere down the road.

    --
    Sig Battery depleted. Reverting to safe mode.
    1. Re:Wake me when they build it into the hard disk by icebike · · Score: 3, Interesting

      Bad design on Novell's part, but the problem persists in the de-duplicated world, where de-duplicating to memory only is not a solution.

      Imagine a hundred very large file containing largely the same content. Not imagine CHANGING just a few characters in each file via some automated process. Now 100 files which were actually stored as ONE file balloon to 100 large files.

      On a drive that was already full, changing just a few characters (not adding any total content) could cause a disk full error.

      You really can't fake what you don't have. You either have enough disk to store all of your data or you run the risk of hind-sight telling you it was a really bad design.

      --
      Sig Battery depleted. Reverting to safe mode.
    2. Re:Wake me when they build it into the hard disk by ArsonSmith · · Score: 3, Informative

      No you still have it stored the size of one file + 100 block sizes, in size. You'd need a substantially large number of random changes through all 100 files to balloon up from 1x file size, to 100x file size.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    3. Re:Wake me when they build it into the hard disk by jcr · · Score: 2, Insightful

      what was one block replicated hundreds of times now becomes hundreds of blocks exhausting all storage.

      What? Why would that happen?

      If you have a block and a hundred COW pointers to it, and you modify one, then you get two blocks, with 99 references to the old one and one reference to the new one.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
  8. Re:This is good news... by jeffb+(2.718) · · Score: 3, Funny

    Use open source, get cutting edge things.

    The last time I tried to build an Intel box for Linux work, I lost my grip on the cheap generic case, and sustained a cut that sent me to the emergency room. One of the things I like about my Mac is the lack of cutting edges.

  9. Re:This is good news... by Anonymous Coward · · Score: 4, Funny

    Shoulda gone with a blade server, then you wouldn't have had to worry about the emergency room.

  10. Re:This is good news... by Tynin · · Score: 2, Informative

    Not sure when you tried building it, but I build cheap computers for friends / family, at least 2 or 3 computers a year. Almost a decade ago... maybe really only 8 years ago, all cheapo generic cases stopped having razor sharp edges. I used to get cuts all the time, but cheap cases, at least in the realm of having sharp edges, haven't been an issue in a long time. (I purchase all my cheapo cases from newegg these days)

  11. Re:This is good news... by Trepidity · · Score: 4, Informative

    If you're running a normal desktop or laptop, this isn't likely to be of great use in any case. There's non-negligible overhead in doing the deduplication process, and drive space at consumer-level sizes is dirt-cheap, so it's only really worth doing this you have a lot of block-level duplicate data. That might be the case if e.g. you have 30 VMs on the same machine each with a separate install of the same OS, but is unlikely to be the case on a normal Mac laptop.

  12. Par for the course.. by Junta · · Score: 4, Interesting

    Any filesystem implementing copy-on-write at all, data dedupe, and/or compression is already a strategy where the risk of exhausting oversubscribed storage due to unanticipated compression ratios or uniqueness is a risk. It's a reason why you have to be pretty explicit to NetApp filers implementing these features that you are accepting the risk of exhausting allocations if you actually make use of these features to the point of advertising more storage capacity than you actually have.

    You don't even need a fancy filesystem to expose yourself to this today:
    $ dd if=/dev/zero of=bigfile bs=1M seek=8191 count=1
    1+0 records in
    1+0 records out
    1048576 bytes (1.0 MB) copied, 0.00426769 s, 246 MB/s
    jbjohnso@wirbelwind:~$ ls -lh bigfile
      8.0G 2009-11-02 20:06 bigfile
    ~$ du -sh bigfile
    1.0M bigfile

    This possibility has been around a long file and the world hasn't melted. Essentially, if someone is using these features, they should be well aware of the risks incurred.

    --
    XML is like violence. If it doesn't solve the problem, use more.
    1. Re:Par for the course.. by odie_q · · Score: 2, Informative

      The trick isn't using /dev/zero, the trick is using the seek parameter. The dd command skips nearly 8 GiB into a newly created file and writes something there. This creates a file that is 8 GiB large, but with no data (not zero, just nothing at all) in the first 8191 MiB. Therefore, the system doesn't actually write anything there, and doesn't even allocate the storage. If you read from these blocks, you will get generated zeros. This is called a sparse file.

      --
      ...ceterum censeo Carthaginem esse delendam.
  13. Re:Open Source Cures Cancer by Anonymous Coward · · Score: 5, Funny

    Like a cutting edge CAD packages, games, financial management and office suites?

    Umm, dia, nethack, perl, emacs?

  14. There are three types of files. by Animats · · Score: 5, Interesting

    I'd argue that file systems should know about and support three types of files:

    • Unit files. Unit files are written once, and change only by being replaced. Most common files are unit files. Program executables, HTML files, etc. are unit files. The file system should guarantee that if you open a unit file, you will always read a consistent version; it will never change underneath a read. Unit files are replaced by opening for write, writing a new version, and closing; upon close, the new version replaces the old. In the event of a system crash during writing, the old version of the file remains. If the writing program crashes before an explicit close, the old file remains. Unit files are good candidates for unduplication via hashing. While the file is open for writing, attempts to open for reading open the old version. This should be the default mode. (This would be a big convenience; you always read a good version. Good programs try to fake this by writing a new file, then renaming it to replace the old file, but most operating systems and file systems don't support atomic multiple rename, so there's a window of vulnerability. The file system should give you that for free.)
    • Log files Log files can only be appended to. UNIX supports this, with an open mode of O_APPEND. But it doesn't enforce it (you can still seek) and NFS doesn't implement it properly. Nor does Windows. Opens of a log file for reading should be guaranteed that they will always read exactly out to the last write. In the event of a system crash during writing, log files may be truncated, but must be truncated at an exact write boundary; trailing off into junk is unacceptable. Unduplication via hashing probably isn't worth the trouble.
    • Managed files Managed files are random-access files managed by a database or archive program. Random access is supported. The use of open modes O_SYNC, O_EXCL, or O_DIRECT during file creation indicates a managed file. Seeks while open for write are permitted, multiple opens access the same file, and O_SYNC and O_EXCL must work as documented. Unduplication via hashing probably isn't worth the trouble and is bad for database integrity.

    That's a useful way to look at files. Almost all files are "unit" files; they're written once and are never changed; they're only replaced. A relatively small number of programs and libraries use "managed" files, and they're mostly databases of one kind or another. Those are the programs that have to manage files very carefully, and those programs are usually written to be aware of concurrency and caching issues.

    Unix and Linux have the right modes defined. File systems just need to use them properly.

    1. Re:There are three types of files. by greg1104 · · Score: 3, Insightful

      The main corner case in your suggested "unit file" implementation is where someone is overwriting a file too large for the filesystem to contain two copies of it. You have to truncate when this happens to fit the new one, you can't just keep the old one around until it's replaced. This makes it impossible to meet the spec you're asking for in all cases. The best you can do is try to keep the original around until disk space runs out, and only truncate it when forced to. However, if that's how the implementation works, then applications can't just blindly rely on the filesystem to always do the right thing and "give you that for free". They've still got to create the new file and confirm it got written out before they touch the original if they want to guarantee never losing the original good copy, so that they bomb with a disk space error rather than risk truncating the original. That's why this whole path doesn't go anywhere useful; better to work on poplarizing an API for atomic rewrites or something.

      As for your "managed files" case, that won't work for all database approaches. For example, in PostgreSQL, only writes to the database write-ahead log are done with O_SYNC/O_DIRECT. The main data block updates (and writes that are creating new data blocks) are written out asynchronously, and then when internal checkpoints reach their end any unwritten blocks are forced to disk with fsync if they're still in the OS cache. You'd be hard pressed to detect which of your suggested modes was the appropriate one for just the obvious behavior there, and there's still more weird corner cases to worry about buried in there too (like what the database does with the data blocks and the WAL to repair corruption after a crash).

      Both these highlight that it's hard to make improvements here at just the filesystem level. Some of the really desirable behavior is hard to do unless applications are modified to do something different too. That hasn't really been going well for ext4 this year, and how that played out highlights how hard an issue this is to crack.

  15. Re:Open Source Cures Cancer by Anpheus · · Score: 4, Funny

    But if it breaks, or doesn't work, or you've hit a deadline on a project and can't deliver because Wine or the application broke, who are you going to call for support exactly? Not the people who made the software. Are you going to email the Wine mailing list and then, when they fail to deliver a timely solution for free, tell the client that open source is to blame?

    At least when I buy software, or make purchasing decisions from a business standpoint, knowing that the company will stand behind the product and our implementation of it is more important than that trying to pursue some ideal about information and it's anthropomorphized desire to be free.

  16. BTRFS is better by Theovon · · Score: 2, Interesting

    At first, BTRFS started out as an also-ran, trying to duplicate a bunch of ZFS features for Linux (where licensing wasn't compatible to incorporate ZFS into Linux). But then BTRFS took a number of things that were overly rigid about ZFS (shrinking volumes, block sizes, and some other stuff), and made it better, including totally unifying how data and metadata are stored. I'm sure there are a number of ways in which ZFS is still better (RAIDZ), but putting aside some of the enterprise features that most of us don't need, BTRFS is turning out to be more flexible, more expandable, more efficient, and better supported.

  17. Re:This is good news... by joe_bruin · · Score: 2, Insightful

    Use open source, get cutting edge things.

    I run Linux, where's my ZFS? No, FUSE doesn't count.

  18. Re:This is good news... by 644bd346996 · · Score: 2, Insightful

    Time Machine has by far the easiest to use interface of any backup solution that is at least as powerful. And because it does file-level deduplication using hardlinks, the backups themselves are standard directory trees, browsable in every way that the rest of the filesystem is. If the block-level deduplication is part of the backup software and not the filesystem, the the archives will be opaque files that usually can only be manipulated by the backup software itself. This means the user has little or no choice between UIs for restoring from the archive, and it usually prevents the archives from being indexed by something like Spotlight.

    By adding one small filesystem feature (hardlinks to directories), Apple made it possible to trivially implement a good incremental backup system. (The under-the-hood parts of Time Machine could be implemented in a fairly short shell script run as a cron job.) They then proceeded to put the slickest UI ever around their backup system, but still left it open for other programs. If Apple added block-level deduplication to their filesystem, they wouldn't even have to touch the Time Machine code and it would become the best personal backup software in history.

  19. Re:well ... by TrevorDoom · · Score: 2, Interesting

    My company used a X4500 and we discovered the bug that caused Sun to make the X4540 - the Marvell SATA chipset in the X4500 had a serious bug in firmware that was exacerbated by the Solaris X86 Marvell chipset driver.
    Under heavy small block random IO intermingled with heavy sequential large block IO, the box would kernel panic and hang - only a power cycle would reset the box.

    Sun ended up refunding us the cost of the servers and providing us exceptionally large incentives to purchase Sun StorageTek storage.

    It wouldn't surprise me if the X4540 would have similar issues because they were rushing to replace the X4500 to try and minimize the possibility about bad PR over the X4500 being amazingly unstable.

    This is why I'll be waiting for FreeBSD to support this because they will probably have better SATA chipset drivers and the chances of the system hanging because the Solaris kernel drivers for the SATA chipset (nevermind that it's a SATA chipset that Sun put into their own board).

  20. Infinite compression? by n9hmg · · Score: 3, Funny

    If a hash were a replacement for data. that's all we'd need....goedelize the universe? Sometimes I just want to scream, or weep, or shoot everybody....or just drop to my knees and beg them to think - just a little tiny insignificant bit - think. Maybe it'll add up. Probably not, but it's the best I can do.

    1. Re:Infinite compression? by jimicus · · Score: 2, Interesting

      If a hash were a replacement for data. that's all we'd need....goedelize the universe?

      Sometimes I just want to scream, or weep, or shoot everybody....or just drop to my knees and beg them to think - just a little tiny insignificant bit - think. Maybe it'll add up. Probably not, but it's the best I can do.

      Which is why ZFS allows you to specify using a proper file comparison rather than just a hash.

      It's unlikely you'll have a collision considering it's a 256-bit hash but, as you allude, that likelihood does go up somewhat when you're dealing with a filesystem which is designed to (and therefore presumably does) handle terabytes of information.

  21. Not quite the wonderful thing it appears to be by pjr.cc · · Score: 2, Insightful

    De dupe has been around for a while and has some advantages and quite a few negatives... First off, i'd be interested to see how many patent trolls this might stumble over. But de-dup has always gone hand in hand with backups and golden images. EMC, HDS and co never did a good job supporting golden images, but other storage have done well with it (3par, compellent, equalogic).

    For the uninitiated, golden images usually consist of building a machine on a SAN, and then using that one image to power many machines (i.e. the same blocks on disk). It then usually just stores deltas from the golden image for each machine... its got its advantages and disadvantages much like de-dup.

    Now, the reasons for its use are simple "pay less for storage" which sounds dumb in this day and age (with 1tb drives costing virtually nothing), but the reality is in the SAN world 1tb drives cost a fortune and wherever you use de-dup or golden images, you usually use the fastest (and smallest) disk you can get your hands on. (if you dont understand why this is, see the backblaze article from a little while ago - ultimately, putting more space in a bit of SAN storage kit is freeking expensive). In the enterprise world, its almost impossible to step away from SAN storage (unless your google or backblaze).

    The big problem with de-dup (and why its primarily used for backups, and primarily only disk-based backups) is how it effects the storage. If you suddenly have one hot spot, even on fast disk, the storage starts grinding to a halt (even when considering caching) because lots of things start accessing the same blocks on the disk. This is not a problem for backups because its usually a once-written, rarely-read scenario. On file servers and databases, its a performance killer (something akin to raid5/6 in software). But de-dup is fantastic for archival storage!... De-dup and performance often tend to be a self-fulfilling prophecy though, simply because data that is duplicated is often duplicated cause its heavily accessed. Take email as a good example. Joe sends out an email with an attachment of some form (perhaps its a document template, but it really doesn't matter so long as he's sending it to a large number of people), all those people save the attachment and probably make some edits. This introduces the next load of pain, fragmentation. All those delta's from the original now need to be saved "somewhere else" and meanwhile all these people are accessing not just the de-dup'ed blocks but the fragmented changes (consider the kernel source for linux as well, tonnes of branches of code that would possible get de-duped and fragmented). Databases are another great example. Often in tablespaces there is quite a load of block-alligned duplicate data, often this is the nature of how databases store data. Sometimes this data can be quite critical to their function and to have a database slamming the same blocks (again with small fragmented changes) is pain personified.

    Still, i wonder how many patents sun are likely to trip up on... I see this being non-fun as there are many people who make serious cash from de-dup at various levels....

  22. Re:Open Source Cures Cancer by sjames · · Score: 3, Interesting

    The same people you call when your proprietary system breaks and you discover that the official tech support people can't find their posterior with both hands and a map. Most cities have a number of grief councilors ready to support you in your time of need. If it was really critical, try the suicide hotline.