From: Junio C Hamano <gitster@pobox.com>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: bill lam <cbill.lam@gmail.com>, git@vger.kernel.org
Subject: Re: how to backup git
Date: Mon, 12 May 2008 15:26:59 -0700 [thread overview]
Message-ID: <7vej87xioc.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LNX.1.00.0805121647540.19665@iabervon.org> (Daniel Barkalow's message of "Mon, 12 May 2008 17:19:32 -0400 (EDT)")
Daniel Barkalow <barkalow@iabervon.org> writes:
> On Mon, 12 May 2008, bill lam wrote:
>
>> Johannes Schindelin wrote:
>> > > I'd rsync just the .git directory.
>>
>> Thanks to all responders for quick reply. I still have a related question. svn
>> has a hotcopy command to ensure integrity so that it is possible to backup
>> without shutting down the svn server. If someone update the .git while I am
>> performing backup using tar or rsync? Will the atomicity of that commit still
>> preserve in my backup copy?
>
> There's the risk that the backup will start, it will copy all of the
> objects, then a git commit happens, which adds more objects (after rsync
> has passed) and updates a "refs" entry to refer to one of them, and then
> rsync copies the "refs" directory.
>
> It's likewise possible to have part of the information for a commit copied
> and part of it not. This commit will be clearly broken, however (one or
> more objects not found).
>
> So, essentially, every commit goes through the stages of not at all
> written, partially written but invalid, and valid and correct.
> Independantly, which commit is the latest is updated atomically. It's
> possible for an ill-timed backup to get a branch updated to a commit
> that's not yet valid in the backup. In you restored from this, you'd need
> to use one of several methods (mainly reflogs) to get back to the last
> valid commit that got backed up.
>
> On the other hand, git will never, even in this sort of backup, end up
> with a commit that's valid but not completely correct.
I think suggestions from old timers on this thread to first "git fetch" is
to handle that concern. It may not get the commit that is being created
simultaneously when such a fetch to backup repository is running (but that
will be backed up during the next round), but at least the contents of the
backup repository would be self contained and correct. So a nightly fetch
(perhaps with --mirror) into a backup repository, and then after the fetch
finishes, copying the backup repository to tape, would give you one copy a
night. Copying out from the central repository to backup repository would
be incremental, and until you repack the backup repository, the tape
backup of that backup repository could also be made incremental, as fetch
will be append-only into its objects/ part with updates to refs/ part.
next prev parent reply other threads:[~2008-05-12 22:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 6:08 how to backup git bill lam
2008-05-12 6:36 ` Tobias Sarnowski
2008-05-12 6:40 ` Sverre Hvammen Johansen
2008-05-12 13:11 ` Eric Hanchrow
2008-05-12 13:28 ` Johannes Schindelin
2008-05-12 14:13 ` bill lam
2008-05-12 14:54 ` Miklos Vajna
2008-05-12 15:08 ` Johannes Schindelin
2008-05-12 15:27 ` Heikki Orsila
2008-05-12 17:07 ` Johannes Schindelin
2008-05-12 18:07 ` Heikki Orsila
2008-05-12 18:21 ` Johannes Schindelin
2008-05-12 18:36 ` Heikki Orsila
2008-05-12 18:38 ` Heikki Orsila
2008-05-12 18:58 ` Tim Harper
2008-05-12 19:10 ` Heikki Orsila
2008-05-12 19:49 ` Sverre Rabbelier
2008-05-12 18:54 ` Jakub Narebski
2008-05-12 21:19 ` Daniel Barkalow
2008-05-12 22:26 ` Junio C Hamano [this message]
2008-05-12 23:43 ` Daniel Barkalow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vej87xioc.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=barkalow@iabervon.org \
--cc=cbill.lam@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).