* rsync a *bunch* of git repos
@ 2012-01-10 21:15 Jason
2012-01-10 21:24 ` Seth Robertson
2012-01-11 8:01 ` Andreas T.Auer
0 siblings, 2 replies; 8+ messages in thread
From: Jason @ 2012-01-10 21:15 UTC (permalink / raw)
To: git
All,
I have a home directory with a lot of git repos in it. Possibly over a
hundred. This is a good thing. :-) However, I'm in the process of
changing OS's and need to move my home directory out of my root
partition into its own partition.
The nuts and bolts of this aren't difficult, the problem is I don't have
a complete understanding of how git stores data. I've heard in the
past that it uses a lot of hardlinks and softlinks. I need to make
sure, that once I transfer the data, and reboot the machine with the new
partition mounted under /home, that all my git repos will be okay.
Going through the git repos one by one would be long and prone to
errors, so I'm looking at alternatives. Does this look ok?
## From single user mode, or live cd
$ su -
# mkfs.ext4 /dev/sda3
# mount /dev/sda3 /mnt/home
# rsync --progress -avu /home/ /mnt/home/
# umount /mnt/home
# mv /home /home.orig
# mkdir /home
### Sanity check?
# mount /dev/sda3 /home
# rsync -avun /home.orig/ /home/
That'll check that rsync thinks things are ok, but what about git? Is
there a git sanity check I could run to detect that three hardlinks
still point to the same inode?
One alternative may be to boot to a live CD, delete everything from the
root partition except /home, then mv /home/* -> / . Basically, use my
current root partition as the new /home partition.
thx,
Jason.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 21:15 rsync a *bunch* of git repos Jason
@ 2012-01-10 21:24 ` Seth Robertson
2012-01-10 22:00 ` Philip Oakley
2012-01-24 14:11 ` Jason
2012-01-11 8:01 ` Andreas T.Auer
1 sibling, 2 replies; 8+ messages in thread
From: Seth Robertson @ 2012-01-10 21:24 UTC (permalink / raw)
To: Jason; +Cc: git
In message <20120110211548.GD10255@titan.lakedaemon.net>, Jason writes:
The nuts and bolts of this aren't difficult, the problem is I don't have
a complete understanding of how git stores data. I've heard in the
past that it uses a lot of hardlinks and softlinks. I need to make
sure, that once I transfer the data, and reboot the machine with the new
partition mounted under /home, that all my git repos will be okay.
Under most circumstances, git will do the right thing. Only if you
use specific flags on clone (like --shared or --reference) might
something go wrong, and as the manual page explains, you can use
git-repack to undo these.
The real solution is, after you rsync, to:
for f in */.git; do (cd $f; git fsck >&/dev/null || echo "$f is BAD!!"); done
If you get no output, you should be golden. If you get output, check
to make sure the repo you are copying from is good as well.
-Seth Robertson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 21:24 ` Seth Robertson
@ 2012-01-10 22:00 ` Philip Oakley
2012-01-10 22:30 ` Junio C Hamano
2012-01-24 14:11 ` Jason
1 sibling, 1 reply; 8+ messages in thread
From: Philip Oakley @ 2012-01-10 22:00 UTC (permalink / raw)
To: Jason, Seth Robertson; +Cc: git
From: "Seth Robertson" <in-gitvger@baka.org> Sent: Tuesday, January 10, 2012
9:24 PM
> In message <20120110211548.GD10255@titan.lakedaemon.net>, Jason writes:
>
> The nuts and bolts of this aren't difficult, the problem is I don't
> have
> a complete understanding of how git stores data. I've heard in the
> past that it uses a lot of hardlinks and softlinks. I need to make
> sure, that once I transfer the data, and reboot the machine with the
> new
> partition mounted under /home, that all my git repos will be okay.
>
> Under most circumstances, git will do the right thing. Only if you
> use specific flags on clone (like --shared or --reference) might
> something go wrong, and as the manual page explains, you can use
> git-repack to undo these.
I think there is an exception for certain git submodule setups with local
repos, where the gitdir link is hard coded to the absolute machine path.
There has been some discussion on the list recently about trying to cover
this case.
>
> The real solution is, after you rsync, to:
>
> for f in */.git; do (cd $f; git fsck >&/dev/null || echo "$f is BAD!!");
> done
>
> If you get no output, you should be golden. If you get output, check
> to make sure the repo you are copying from is good as well.
>
> -Seth Robertson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 22:00 ` Philip Oakley
@ 2012-01-10 22:30 ` Junio C Hamano
2012-01-11 13:22 ` Sergio
0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2012-01-10 22:30 UTC (permalink / raw)
To: Philip Oakley; +Cc: Jason, Seth Robertson, git
"Philip Oakley" <philipoakley@iee.org> writes:
> I think there is an exception for certain git submodule setups with
> local repos, where the gitdir link is hard coded to the absolute
> machine path. There has been some discussion on the list recently
> about trying to cover this case.
But if you read the original post carefully, all repositories involved are
under /home before the transition, and they will move to the exact same
place under /home anyway, so I do not think the discussion you have in
mind would apply to this case.
The only thing that is needed after the move would be to run
git update-index --refresh
in all of the repositories, I think.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 21:15 rsync a *bunch* of git repos Jason
2012-01-10 21:24 ` Seth Robertson
@ 2012-01-11 8:01 ` Andreas T.Auer
1 sibling, 0 replies; 8+ messages in thread
From: Andreas T.Auer @ 2012-01-11 8:01 UTC (permalink / raw)
To: Jason; +Cc: git
On 10.01.2012 22:15 Jason wrote:
> The nuts and bolts of this aren't difficult, the problem is I don't have
> a complete understanding of how git stores data. I've heard in the
> past that it uses a lot of hardlinks and softlinks. I need to make
> sure, that once I transfer the data, and reboot the machine with the new
> partition mounted under /home, that all my git repos will be okay.
>
>
As far as I know git uses hardlinks to save diskspace, but it doesn't
rely on hardlinks to work. It also works with filesystems that don't
support hardlinks.
But without hardlinks you will probably waste disk space so I recommend
the -H parameter to rsync, which preserve hardlinks, if possible. If you
have hundreds of git repos that are cloned from each other, than this
should make a difference.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 22:30 ` Junio C Hamano
@ 2012-01-11 13:22 ` Sergio
2012-01-11 16:52 ` Neal Kreitzinger
0 siblings, 1 reply; 8+ messages in thread
From: Sergio @ 2012-01-11 13:22 UTC (permalink / raw)
To: git
Junio C Hamano <gitster <at> pobox.com> writes:
>
> "Philip Oakley" <philipoakley <at> iee.org> writes:
>
> > I think there is an exception for certain git submodule setups with
> > local repos, where the gitdir link is hard coded to the absolute
> > machine path. There has been some discussion on the list recently
> > about trying to cover this case.
>
> But if you read the original post carefully, all repositories involved are
> under /home before the transition, and they will move to the exact same
> place under /home anyway, so I do not think the discussion you have in
> mind would apply to this case.
>
> The only thing that is needed after the move would be to run
>
> git update-index --refresh
>
> in all of the repositories, I think.
>
>
I keep a desktop and a laptop in sync with unison (which uses rsync) and I
confirm that git is entirely happy about that.
the git update-index --refresh is necessary, otherwise git status will
incorrectly report dirty trees.
I wonder if it would not make sense to incorporate the update-index --refresh in
the git status command.
As an aside: git works fine when repos are transferred with rsync, but git packs
are not rsync friendly nor friendly with backup strategies using binary deltas.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-11 13:22 ` Sergio
@ 2012-01-11 16:52 ` Neal Kreitzinger
0 siblings, 0 replies; 8+ messages in thread
From: Neal Kreitzinger @ 2012-01-11 16:52 UTC (permalink / raw)
To: Sergio; +Cc: git
On 1/11/2012 7:22 AM, Sergio wrote:
>
> As an aside: git works fine when repos are transferred with rsync, but git packs
> are not rsync friendly nor friendly with backup strategies using binary deltas.
>
All these answers are assuming that your source git repos are quiet
during the rsync. If they are not quiet during the rsync then you are
going to need a more tailored rsync to do things in a certain order.
See this thread for details:
http://thread.gmane.org/gmane.comp.version-control.git/168699
v/r,
neal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: rsync a *bunch* of git repos
2012-01-10 21:24 ` Seth Robertson
2012-01-10 22:00 ` Philip Oakley
@ 2012-01-24 14:11 ` Jason
1 sibling, 0 replies; 8+ messages in thread
From: Jason @ 2012-01-24 14:11 UTC (permalink / raw)
To: Seth Robertson; +Cc: git
Hi Seth,
On Tue, Jan 10, 2012 at 04:24:50PM -0500, Seth Robertson wrote:
>
> In message <20120110211548.GD10255@titan.lakedaemon.net>, Jason writes:
>
> The nuts and bolts of this aren't difficult, the problem is I don't have
> a complete understanding of how git stores data. I've heard in the
> past that it uses a lot of hardlinks and softlinks. I need to make
> sure, that once I transfer the data, and reboot the machine with the new
> partition mounted under /home, that all my git repos will be okay.
>
> Under most circumstances, git will do the right thing. Only if you
> use specific flags on clone (like --shared or --reference) might
> something go wrong, and as the manual page explains, you can use
> git-repack to undo these.
>
> The real solution is, after you rsync, to:
>
> for f in */.git; do (cd $f; git fsck >&/dev/null || echo "$f is BAD!!"); done
Okay, I've been using the new system for a week or so now, and
everything looks good. Thanks!
Before the transfer, I went ahead and did the above to make sure the
repos were good to begin with. All 279 of them were fine, both before
and after.
thx,
Jason.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-24 14:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10 21:15 rsync a *bunch* of git repos Jason
2012-01-10 21:24 ` Seth Robertson
2012-01-10 22:00 ` Philip Oakley
2012-01-10 22:30 ` Junio C Hamano
2012-01-11 13:22 ` Sergio
2012-01-11 16:52 ` Neal Kreitzinger
2012-01-24 14:11 ` Jason
2012-01-11 8:01 ` Andreas T.Auer
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).