Tomohiro Kusumi would like to port Hammer (1) to FreeBSD, as noted in this bug discussion. It’s not even begun to happen, but if you can contribute, please do.
Tomohiro Kusumi has been creating a near-constant stream of bugfixes and cleanups to Hammer for quite some time. I don’t often link to it, because they are incremental improvements and hard to linkblog, so to speak. In an effort to make up for this deficit, I do want to draw attention to his two recent commits: “Make hammer commands print root volume path“, and “Print volume list after volume-add|del“. Small changes, but this is what makes complex systems usable.
The ‘hammer show’ command can be used to dump the B-Tree structure of a Hammer volume, and CRC errors can be spotted. It’s rare that anyone would need it, but if you do, this dumped information will include file hierarchy information.
If that makes you a bit nervous to repost any of that information when talking about it in public, Tomohiro Kusumi has added an ‘obfuscate’ option to ‘hammer show’ that does just that – it hides path information from the debug output.
Hammer now defaults to ‘noatime’, meaning the date and time of last access are not updated on every file action. Note that creation and modification date and time are still recorded. This will help with speed and disk activity.
This may cause a problem with any software expecting this to change – mutt, possibly? We will find out. This change was done after the 4.4 branch, so it’s not in the current release of DragonFly.
Matthew Dillon has added two Hammer2 directives – ‘info’ and ‘mountall’. See his commit message for a explanation of each. This predates the 4.4 branch, so it’s available in the current release. The usual caveat applies: Hammer2 is for development only; don’t use this to store data you want to use.
I have a huge backlog of things to post, so this is originating from the 17th: Matthew Dillon has been working for some time on hardlinks and Hammer 2. Hardlinks are the same file, presented in multiple places. This can be a problem when your filesystem keeps infinite, writable snapshots. The solution he just commited is called ‘xlink’ and the commit message has details.
HAMMER2 recently gained the ability to be used as the root mount for your DragonFly system. Live deduplication of data is also now possible, which means fast copy operations, less space used, and no need to wait for an overnight batch process to do it. If you want to try it, you need a bleeding edge DragonFly system and the WANT_HAMMER2 option. It’s still not ready for production use, so don’t try it with any data you want to keep.
I don’t note it enough, but Tomohiro Kusumi has been making constant updates to HAMMER, the version we have now. Often they are the sort of update that makes the code more readable, or fixes possible problems, and so on. Very essential, but hard to post about it. In any case, I’m using his recent improvements to hammer volume-del to note his contributions, of which there are much more than the day’s worth I link here.
Hammer will perform daily housekeeping tasks each night. If you’re up late enough, it may kick off while you are working. If you want to stop the process after it’s already started (since it’s disk-intensive), John Marino has added the ‘abort-cleanup‘ command.
DragonFly committer Joris Giovannangeli has a Google Summer of Code project. He’s bringing Hammer2 to OpenBSD, in single-node form. It’s a very difficult project, but Joris is a very talented worker.
Tomohiro Kusumi has been quietly making a lot of commits to Hammer. I haven’t been linking them because they don’t necessarily equate to new features, but here’s an recent exception: the -A argument will make your Hammer command run on every PFS. It only affects reblocking/rebalancing – for now.
You can now export Hammer slave volumes as NFS mounts – but since slave volumes are updated from master, you’re mounting a snapshot of that point in time. That may actually be an advantage.
I haven’t been drawing enough attention to it, but there’s been a bunch of HAMMER filesystem activity lately: First, Tomohiro Kusumi has been working on HAMMER – these posts are a small subset of his commits. Second, Matthew Dillon has been working full steam ahead on HAMMER2. The HAMMER2 design document has been updated (read this!), and he’s already accomplished master->slave disk syncing.
It’s not ready for production, of course, which you may already realize, so don’t install it unless you want to work on the code.
If you’re monitoring your DragonFly systems with Nagios, here’s a way to check the health of your Hammer mirror-streams. Thanks, Mike!
Here’s a number of DragonFly links to clear out my backlog:
There’s a FreeBSD Forums thread about ZFS and Hammer, as several people have pointed out to me. It’s interesting to see, but there isn’t a lot of quantitative discussion. (It’s a forum post, not a white paper, though.)
John Marino has created something very useful: a graphical tool for Hammer file history. It’s called ‘Slider’, and it uses curses to work in a terminal. It shows historic versions of files and can restore those old versions as needed. This was already possible in Hammer, of course, but it required a sequence of commands that were not straight-forward. I’ve been slow enough posting it that version 2.0 is already out, offering a way to see files that no longer exist, but are still in history. (i.e. deleted some time ago) ‘Time Machine’ sounds like the best name, but that seems to be taken.
One way to keep file history on an very active Hammer disk from eating up all the space: more snapshots. This may seem counterproductive, but disk pruning eliminates historical data between snapshots, so you can keep older data at the cost of some temporal accuracy.
Not the first time that pun has been deployed, of course, but: BSDNow 053 has a Hammer tutorial, along with an interview of Reyk Floeter about OpenBSD’s httpd, along with the usual recent news and some links to some things I haven’t seen, like pfSense tricks.
A frequent question people ask when trying Hammer is “How can I do software RAID to cover a disk failure?” Hammer provides for streaming one volume to another, so you can duplicate drives, but there isn’t an automatic failover mechanism as there is with a RAID setup. The first answer is usually “get hardware RAID“; my preferred solution. The remaining software solutions are vinum, ccd, and lvm for DragonFly.
A note for everyone: use Hammer default on a very busy filesystem, and you will eat a lot of disk space since all file changes are recorded. (I’ve done this to myself a few times.) Francois Tigeot has a list of tips on how to keep that from happening.
The May BSD Magazine is out, and Siju George has written an article about using Hammer on DragonFly. It’s a free download to read.
The March issue of BSD Magazine is out, and this month has an article written by Siju George about how his company is using DragonFly and Hammer for backups.
This is a little old, but Matthew Dillon noted the status of his Hammer2 work a little while ago. Some highlights: he’s intending Hammer2 to be usable on a single host by the time of the next DragonFly release (summer 2014), the Summer of Code project for compression has already been integrated, and he listed different parts of the work that may be interesting for anyone wanting to chip in.
Slightly related: Matt posted some Hammer2 comments on the DragonFly 3.6 release story on Slashdot that may be interesting. Don’t bother reading the other comments; they’ll make your eyeballs bleed.
If you want to boot from a Hammer 2 /boot volume, you now can. Hammer 1 never worked well as /boot, though it was technically possible. Hammer 2 will be just fine.
Note that you can’t turn on recently-added disk compression since the bootloader doesn’t understand it, and Hammer 2 is not ready for anything but being worked on. Don’t try it unless you’re ready to be submitting code changes to fix Hammer2.
Remember my recent disk issues? As a side effect of protecting myself, I have a good example of deduplication results.
I have a second disk in my server, with slave Hammer PFSs to match what’s on my main disk. I hadn’t put them in fstab, so they weren’t getting mounted and updated. I got them re-created, but they were nearly full. Here’s an abbreviated df, from which you should be able to tell which drives I have :
Size Used Avail Capacity 929G 729G 200G 78% /slave/slavehome 929G 729G 200G 78% /slave/slavevar 929G 729G 200G 78% /slave/slaveusr 929G 729G 200G 78% /slave/slaveslash
That 78% is how full the Hammer volume was. I turned on Hammer deduplication, since it’s off by default. The very next day:
Size Used Avail Capacity 929G 612G 318G 66% /slave/slavehome 929G 612G 318G 66% /slave/slavevar 929G 612G 318G 66% /slave/slaveusr 929G 612G 318G 66% /slave/slaveslash
It’s a 1 terabyte disk, and I gained more than 10% back – That’s 100g of disk space that I gained overnight. There might be more tomorrow, given that it was all of 5 minutes of dedup work.
This won’t surprise you if you’ve seen previous deduplication links here, like my previous results or some real-world tests. It’s still great. I’d suggest turning it on if you haven’t – hammer viconfig the appropriate PFS and uncomment the dedup line.
Something new and odd: A port of the Hammer (1) filesystem into Go, for go-fuse. As the author has said, it’s more for the practice of learning Go and Hammer than for producing anything useful. Still, an interesting way to learn.
Encryption seems to be the accidental theme tonight. A question about Hammer 2 and encryption prompted this list of possible solutions from Matthew Dillon. Hammer 2 is still months out, so these features both require time and someone interesting in doing them – though they sound quite possible.
Still not sure if I should be writing Hammer or HAMMER.
If you were wanting to encrypt your /home directory, Pierre Abbat has written up the explicit steps he took to do that very thing.
Earlier this week, Daniel Flores posted the first-week report on his Google Summer of Code project, file compression in Hammer. He mentioned that the LZ4 algorithm he is using seems to have the best performance with repeating text data, as in logfiles. I asked for numbers, and he provided them. The important data in the results is the total compression column. It shows how many 64k blocks were able to be compressed, with that type of data.
If you’ve ever wondered about how you can resize/move a HAMMER filesystem, follow this thread for a variety of answers.
Matthew Dillon has written up another update on his progress with HAMMER2. (I need to be consistent in how I write that.) He has disks being exported and mounted on other systems, and adds an explanation of some of the issues around creating reliable multi-master setups. Before you get too excited, no, multi-master isn’t working yet, and this is not production ready.
Matthew Dillon’s put more of his Hammer work into DragonFly, with notable parts being the creation of a ‘dmsg’ setup for advertising available block devices to share between machines using Hammer. To anticipate your next question: No, it’s not something you can run right now as a test; this is the underlying framework.
The weather is finally turning cooler, which makes me happy.
- I don’t think I’ve seen this before: Very old UNIX releases, listed for running in emulation. (via)
- Where the red-black tree name came from. A red-black tree underpins Hammer 1’s data structures, though it does not in Hammer 2. (also via)
- Someone with a HP passport login want to help this guy? He just needs to reinstall Windows in IDE mode, or perhaps find the right sysctl to toggle.
- The acme editor, from Plan 9. I didn’t realize it’s 20 years old.
- Speaking of editors, Replace in Multiple Files with Vim. I haven’t seen the argdo command before, or the Vim Ninjas site. Their color schemes article is useful just for the screenshots. (via)
- Adbuntu. It’s not as bad or as inconsequential as most reactions would lead you to believe, but advertising within an OS seems heavy-handed. The BSD model has been to use the operating system as a vehicle for selling hardware, and that’s been much more successful. (see iOS, PC-BSD.)
- Where Did the Internet Come From?
- The map for Adventure. (via)
Your unrelated link of the day: Victorian Sci-Fi. It’s not just a reference list, it’s a link to a lot of the original material, since copyright no longer applies.
If you do, they don’t get cleaned up during the normal ‘hammer cleanup’ nightly routine. Chris Turner has added a way to manually specify them as a cleanup target.
I’m pretty sure in this case ‘offline’ means ‘nothing streaming to it from a master disk’. I think.
These are small, but they make life easier: Hammer now has a scoreboard file, for viewing of mirror-streams running in the background. There’s also a ssh-remote directive, so you can use ssh without enabling an interactive shell, and a HAMMER_RSH environment variable so different remote shells can be used. These are all for Hammer 1.
There’s certainly no theme to this week’s links. I even manage to avoid my usual git and vim links, strangely.
- Ethernet’s Future: How Fast Is Fast Enough? The article doesn’t answer any questions, but I like the IEEE-supplied graph it opens with that shows the trend of overall network traffic doubling yearly. (via)
- Anti-open source propaganda in Disney kids’ TV show. I’m actually more bothered by trying to hyphenate a phrase made from separate words. Anti-‘open source’? Esoteric grammar issues appeal to me.
- Bash One-liners Explained, part 3.
- Perl hex and bit pack formats were added to fix the Magellan satellite’s output. A neat origin for something I’ve used trivally. Of course, I suppose any use is trivial compared to fixing output from a broken spaceship. (via many places)
- Here’s a DragonFlyBSD article from 2010 linked on Hacker News. The ensuing conversation in the Hacker News comments is lucid and useful, and not a single bit of whining about BSD being dead. That’s so refreshing to see!
- Looks like there will be a new version of ADOM. Will it run on DragonFly? It should, since the previous version is in pkgsrc.
- Do you like set theory? Then read this. I don’t understand a word of it, but I like seeing the mathematical characters encoded on the page, apparently using MathJax.
- I also enjoy reading about BSD users’ origin stories. In this case, Dru Lavigne.
- CDE has been open-sourced. There’s a good chance it will show up in pkgsrc soon. Seeing this interface will make you nostalgic if you are the right age.
- If you’re a fan of the Hammer filesystem, does that make you a hammerhead? That’s my weak attempt to segue to this comic.
- Artisanal, hand-crafted unsigned ints. Read the bottom of the About page for an explanation. This may not make sense to you if you haven’t encountered the trend it’s making fun of, which seems to be centered in Brooklyn. (via)
- I hope you enjoy scrolling, because this history of computers and history of computer graphics are very long single documents. I like seeing the early computer art. (via)
Your unrelated comic link of the week: Cul De Sac. The strip is ending due to the creator’s health issues, but what he has done is marvelous. This is one of the few newspaper strips that is both visually interesting and often abruptly laugh out loud funny, without being patronizing.
If you wanted to try Hammer 2 and you have several DragonFly-current systems around (virtual or not), Matthew Dillon has the instructions. Keep in mind that this is not something ready for use; it can’t actually free up space, for instance. It’s neat that you can have multiple systems passing data back and forth already, though!
Matthew Dillon recent posted a status report for Hammer 2. Of interest is the spanning tree protocol being built to handle messages between Hammer volumes. As he says in the message:
For example, we want to be able to have millions of diskless or cache-only clients be able to connect into a cluster and have it actually work…
(No, it doesn’t do this, yet.)
Hammer 2 (or is it HAMMER2?) is nowhere near ready to test. But! For laughs, I think it could be set up just so you can watch the messages go back and forth. Someone want to set up a few DragonFly-current VMs and try?
Reading this HAMMER2 commit carefully shows some future plans: remote cluster control, and the ability to mount nonlocal HAMMER2 volumes. A reminder: those are future plans, not what you can do now.
As noted in a recent commit, it’s possible to set up a HAMMER2 /usr/obj and survive a buildworld. That’s good progress.
Note that this is basic work, so features like multi-master and deduplication are not present yet, and it’s still work in progress, so don’t try HAMMER2 unless you like losing data. Watch the branch for changes, though.
(I’m going with “HAMMER2” for the name.)
If you’re curious about Hammer2 development, it’s been ongoing, but there haven’t been any more juicy commits to point at. Here’s one – the start of the messaging system.
Here’s an interesting side effect that came up in Hammer 2 development: deleting files can potentially require modification of only one parent element. If I’m reading it right, that means deletion always takes about the same time, independent of the amount of data being deleted. Your ‘rm -rf /largedrive’ could complete, removing multiple terabytes of data before you realize it. I suppose it’s silly to complain about speedy results. Of course, being Hammer, it would still be available in history.
There’s a Hammer 2 branch in the DragonFly git repo now, for the next generation of DragonFly’s native file system. Don’t get too excited; as Matthew Dillon explains, it won’t be operational for months, and features won’t get added until much later this year. It’s neat to see the work happening, though, and there’s a new design document to show what’s coming.
Matthew Dillon has a very detailed commit message with changes to make sure Hammer will run overnight cleanups in situations as low as 256M of RAM. I think you can find that much RAM in breakfast cereal boxes these days.
If you’re running DragonFly on a very low-end system, you may be wondering about memory requirements for Hammer. Hammer is much less RAM-hungry than ZFS, so it looks like you can get away with 128M, as long as you don’t mind the occasional error message. You can manually tweak settings for it if you like. 256M is plenty.
It still strikes me as odd to consider systems with less than 1G of RAM as “low-memory”. What rich times we live in!
Antonio Huete Jimenez’s ‘libhammer‘, a library to make various Hammer functions available to userland programs, has been added. It implements ‘hammer info’ only at this point, if I understand correctly.
Francois Tigeot took an old Summer of Code proposal, VFS Quotas, and started running with it. He’s made some progress, as he detailed in a recent post to kernel@ (with code!) , but the nullfs-mount nature of PFSs in Hammer are making it difficult.
Well, if you tell it to do so. Matthew Dillon has added a user-settable limit to the amount of memory used during deduplication, so if your Hammer-using system is low on RAM, you can conserve. This is probably most useful if you are running DragonFly in an extremely small VM, or if your name is Venkatesh.
(inside joke; Venkatesh has a crazy old desktop for DragonFly.)
I really just like that phrase and the action movie feeling of using it, like “Watch out! The pulse-width modulated time-domain multiplexer is targeting us!” Sorta like a PU-36 space modulator. It’s actually a recently-committed mechanism to improve write performance in Hammer, but my idea sounds more exciting.
I’ve posted about my own results with Hammer deduplication here before, but Siju George put together results from his workplace using actual files in production. He recovered 138G from a 1T disk, and recovered 20% of space from another disk. Not bad for something that’s nearly automatic, and completely free.
I moved to DragonFly 2.10 over the past few days, and I tried out deduplication, to see what kind of results I would get. The procedure is outlined below. I’m using /home here as an example, just to reduce the amount of text pasted in.
/pfs/@@-1:00004 966000640 566434576 399566064 59% /home
Move my various Hammer pseudo-file systems to version 5, which supports deduplication.
# hammer version-upgrade /home 5
Issue a deduplication simulate command, to see what it guesses will be the savings:
# hammer dedup-simulate /home
Dedup-simulate /home: objspace 8000000000000000:0000 7fffffffffffffff:ffff pfs_id 4
Dedup-simulate /home succeeded
Simulated dedup ratio = 1.22
That ratio turned out to be pretty accurate for the actual deduplication. I didn’t time it, unfortunately. I don’t know if the time taken is proportional to the amount of deduplication or the total volume of data, though I suspect the latter.
# hammer dedup /home
Dedup /home: objspace 8000000000000000:0000 7fffffffffffffff:ffff pfs_id 4
Dedup /home succeeded
Dedup ratio = 1.22
462 GB referenced
378 GB allocated
14 MB skipped
6869 CRC collisions
0 SHA collisions
0 bigblock underflows
The end result?
/pfs/@@-1:00004 966000640 505887504 460113136 52% /home
That data space is shared across all file systems, and it’s a 1TB disk, so it’s 7%, or 70GB. I was hoping for more, but I don’t have any obviously duplicated data (no local mail store, no on-disk backups), so perhaps this is normal. 70GB that I didn’t have before is no bad thing, though.
Incidentally, I was able to upgrade my installed software from pkgsrc-2009Q4 to pkgsrc-2011Q1 entirely using pkg_radd -u <pkgname>. Remarkably quick and painless, though pkgin may have been able to do it even faster since it would pull from the same place.
If you follow this thread, it has some discussion on how to handle a multi-disk setup and Hammer. If a disk is going bad, you can try mirroring, though you have to be careful how your pseudo-file systems are set up.
I didn’t think of this, but I needed it: if you have an older Hammer system that now can perform deduplication because you upgraded to DragonFly 2.10, make sure to add it to the configuration for that file system, or else it won’t run.
Matthew Dillon’s been thinking about Hammer, and how to implement clustering well enough to work as a sort of RAID replacement. He’s written up a document describing his plans. Some highlights:
- writable history snapshots
- quotas and accounting
- live rebuilds of data from mirrors
- and the same history, mirroring, and snapshots as before.
It’s going to be a while before this “Hammer 2” becomes a finished product, though, so don’t count on it for the next release.
Tomas Bodzar asked about RAM usage with Hammer and deduplication, pointing at this example that shows ZFS requiring… I’m not sure. Lots? Anyway, Matthew Dillon noted that offline deduplication in Hammer would use available RAM/swap for CRCs on all files, but only a limited subset for ‘live’ dedup. For a real-world example, Venkatesh Srinivas described deduplicating about 600G down to 400G, with a machine having only 256M of RAM. Yes, only 256M.
Enabling the vfs.hammer.double_buffer=1 sysctl will greatly improve Hammer performance when you’ve exceeded your memory cache (at a possible slight penalty when you have not) and also speed things up when using live deduplication.
Update: Venkatesh Srinivas says:
“double_buffer makes sense when: 1) you want all CRCs to be checked on reads. 2) you’re running live dedup and care about dedup performance rather than say read-heavy performance; 3) you have swapcache but are often running into the vnode limit in what you can cache.”
So, not always useful.
The default Hammer version in DragonFly is now version 5, which is the one that includes deduplication. Enjoy, bleeding-edge users! Otherwise, wait for the next release.
Version 6 is there, but don’t upgrade to it yet; there aren’t significant user-visible changes, and the usual disclaimers for new versions apply.
A Phoronix test of DragonFly’s Hammer filesystem turned up, via Siju George. It’s not really a benchmark as much as it is a speed test, and it’s not a realistic comparison, but it’s interesting to see numbers.
They need a graph that shows how much historical data can be recovered by each file system, or how long fsck takes after a crash.
Update: Matthew Dillon points out the many ways these tests are wrong.