Time Machine and Mail: a match made in hell
rondam.blogspot.com
rondam.blogspot.com
Plan 9's Venti archival storage (http://en.wikipedia.org/wiki/Venti and http://plan9.bell-labs.com/sys/doc/venti/venti.html) stores data as blocks, which are referenced by SHA1 hashes. Since these blocks range between 512 bytes and 56 KB, a large file (like a mail file) gets split into many blocks. The brilliant thing is that a given block will only ever be stored once; your top-level filesystem then only has to keep track of which SHA1 hashes make up a file.
With this system, people have been keeping daily snapshots of their filesystems over the course of years, and the space consumption rate actually tends to decrease over time--see the graphs at http://plan9.bell-labs.com/sys/doc/venti/venti.html
Apple made the choice to have time machine operate with little CPU burden. While this would be a tremendously poor choice for an online storage system like SpiderOak, Dropbox, SugarSync, etc. it probably makes sense for them since it's usually working with a local external drive.
I admire much of Venti's design, but last I checked, Venti didn't support recovering the space from deleted items, except by way of making a new copy of the file system.
I don't know why, given that my CPU is a sunk cost. (Also, I suspect that Apple chose hard links instead of deltas for ease of implementation, not to save CPU cycles.)
last I checked, Venti didn't support recovering the space from deleted items, except by way of making a new copy of the file system.
I think the state of the art has moved on since Venti; Cumulus (and probably tarsnap) implements garbage collection to recover space. http://cseweb.ucsd.edu/~mvrable/cumulus/
Apple's implementation could have avoided linking directories - by creating new directories each time but always linking the files inside them - though I suspect that they decided it would be far quicker to replicate entire trees if you knew nothing in them had changed.
I know I've definitely seen Time Machine re-copying entire 10 GB virtual machine disk images before, with Parallels and VMware Fusion images, before I discovered this feature.
[citation needed]
$ du -sh README.markdown
4.0K README.markdown
$ time ln README.markdown README.markdown.link
real 0m0.002s
user 0m0.000s
sys 0m0.001s
$ time cp README.markdown README.markdown.copy
real 0m0.041s
user 0m0.000s
sys 0m0.002s [ron@mickey:~/foo]$ cat foo
foo
[ron@mickey:~/foo]$ time for i in {1..1000}; do cp foo foo.c.$i; done
real 0m2.705s
user 0m0.524s
sys 0m2.190s
[ron@mickey:~/foo]$ time for i in {1..1000}; do ln foo foo.l.$i; done
real 0m2.618s
user 0m0.486s
sys 0m2.008s [ron@mickey:~]$ time for i in {1..1000}; do echo foo>/dev/null; done
real 0m0.064s
user 0m0.039s
sys 0m0.025sI think the archive folder idea is a workaround for Entourage. If you have one large file that rarely changes, then making a hard link to it would be much faster than copying it.
The archive folder is for Apple Mail, not Entourage. Entourage stores all the mail in a single database so it doesn't matter which folders the messages are in.