[linux-elitists] Fun with Git repository copying

Greg KH greg at kroah.com
Sat Apr 13 20:04:12 PDT 2013


On Sat, Apr 13, 2013 at 10:26:11AM -0700, Don Marti wrote:
> begin Greg KH quotation of Sat, Apr 13, 2013 at 08:07:32AM -0700:
> 
> > Again, don't just use rsync or cp on a live git repo, you wouldn't do
> > that on a database, would you?
> 
> No, for a database I'd shut down the server, then
> copy, then start up the server again (unless it was
> critical to minimize downtime, in which case I'd put
> the database files on a separate filesystem and do
> a snapshot, then copy that.)
> 
> For git, though, there's no server process to shut
> down (unless I want to bring down sshd).  What's the
> best way to make git not modify a repository while
> I'm copying it or backing it up?

You already said it, stop all processes that could access the repo (i.e.
sshd), back it up / snapshot it, and start it up.  Just like any other
database.

Or use a snapshot-like filesystem (trigger a btrfs snapshot on every
commit finishing), or have a git trigger that pushes the data somewhere
else at the same time (or start a pull from somewhere else), which is
git.kernel.org is moving toward.

greg k-h


More information about the linux-elitists mailing list