[Dirvish] replicate a vault with hardlinks

Richard Hector richard at walnut.gen.nz
Sun Oct 9 07:11:25 UTC 2016

On 09/10/16 19:26, Vortex wrote:
> Hi Richard,
> On 09.10.2016 07:50, Richard Hector wrote:
>> I'm shifting a directory (containing my mail store) from one
>> server to another.
> Are they located on the same hard drive? Only then would hard
> links work. Just asking to be on the safe side.
>> Does it make sense, and would it work, to "cp -al" the entire
>> tree of my existing mailserver to the new one, before doing the
>> first backup of the new one?
> Depends what you want to achieve. Doing that, both server trees
> would point to the same data in the files. Thus, if you change the
> contents of a file in one tree, its twin in the other tree would
> change also. If that's what you want, cp -al would be fine. New
> files created in either tree would have separate data, though.
> On 09.10.2016 08:12, Richard Hector wrote:
>> Apologies for replying to myself ...
> Your new mail got me right in writing you an answer to the first
> on. :p
>> I mean "cp -al" the dirvish vault, of course. Except I presumably
>> want real copies of the index.gz, summary, and log files. Would
>> they need editing to reflect the new client name etc?
> I'm not sure what you want to achieve in the end. Why you want to
> have those real copies for example. Could you please elaborate on
> your final goal?

My earlier mail confused things a bit I think :-)

Yes, both vaults will be on the same filesystem.

I'm replacing the old mail server with the new one. When I
decommission the old server, I'll discard all the backup history,
except for the actual mail.

The mail, however, I want to retain the backup history for. I don't,
however, want to use up all that space a second time on my dirvish server.

So, I want to have (during the transition), two vaults that are mostly
hardlinked, in the same way that the multiple snapshots in each vault are.

My current plan is to write a script (which I've started) which will
copy the structure of the vault, possibly editing the config and other
administrative files, but merely hardlinking the contents of the
actual backup trees.

Hopefully you're using a fixed-width font ...

vault1/dirvish/*                 )
vault1/20161009-2004/index.gz    )
vault1/20161009-2004/log         ) <- unique files, based on those in
vault1/20161009-2004/rsync_error )
vault1/20161009-2004/summary     )
vault1/20161009-2004/tree/*      <- all hardlinked into vault0

Once I've done this, I hope I'll be able to continue backing up to
both vaults temporarily (just in case I stuff up the migration, and
have the old server writing to its maildir instead of relaying to the
new one), which will of course cause them to diverge. Then when I've
finished, and decommissioned the old server, I'll be able to delete
its vaults, but still have all the history of my mail.

> I find it more convenient to have separate vaults for different
> sources. It keeps them clearly arranged and I can address them
> separately or move one of them to another medium easily.

Agreed. But having the actual backed-up files hardlinked between
vaults shouldn't hinder that, right?


More information about the Dirvish mailing list