{"thread":{"id":"23848","subject":"ok to delete tmp_pack file(s)? also, backing up a git repository","startedAt":"2010-05-19T23:05:12Z","lastAt":"2010-05-20T02:55:56Z","messageCount":3,"participants":["Adam Monsen","Nicolas Pitre"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"141931","messageId":"loom.20100520T010426-277@post.gmane.org","threadId":"23848","inReplyTo":null,"subject":"ok to delete tmp_pack file(s)? also, backing up a git repository","fromName":"Adam Monsen","fromEmail":"haircut@gmail.com","sentAt":"2010-05-19T23:05:12Z","receivedAt":"2010-05-19T23:05:12Z","isPatch":false,"sender":{"key":"haircut@gmail.com","avatar":"https://avatars.githubusercontent.com/u/50639?v=4"},"body":"I backup my remote git repositories on sf.net using \"rsync -a REMOTE\nLOCAL\". I chose rsync instead of clone --mirror/fetch because I wanted\nhook scripts, \"description\", and \"config\" backed up.\n\nI got the following error from my backup cron job:\n\n        rsync: send_files failed to open\n        \"/mifos/head/objects/pack/tmp_pack_IcK2CZ\" (in gitroot):\n        Permission denied (13)\n\nSo, fine, I can't reach that file. Looks like a temp file--I think I did\na CTRL-C during a push, so maybe that's what caused it to be left\naround. A few questions:\n\n     1. Should I just ignore \"objects/pack/tmp_pack_*\" file in my rsync\n        backup?\n     2. Should I shell into sf.net and run \"git gc\" on the repository?\n        or \"git repack\"? or something else?\n     3. Is rsync a bad idea? For instance, is the backup useful even if\n        rsync was running while someone was doing a \"git push\" into the\n        repository being backed up?\n     4. Anyone have different rsync options to recommend for optimal\n        backup of a git repository?\n\nThank you!\n-Adam\n\nPS - git rocks... our benefits since migrating from svn are numerous:\n* remote folks (UK, India, Africa, etc.) are quite happy with the speed\nincrease\n* branching and merging just works\n* examining logs/forensics is much easier and faster\n* lots more, but I gotta grab me some lunch\n"},{"id":"141932","messageId":"alpine.LFD.2.00.1005191935400.12758@xanadu.home","threadId":"23848","inReplyTo":"loom.20100520T010426-277@post.gmane.org","subject":"Re: ok to delete tmp_pack file(s)? also, backing up a git repository","fromName":"Nicolas Pitre","fromEmail":"nico@fluxnic.net","sentAt":"2010-05-19T23:56:43Z","receivedAt":"2010-05-19T23:56:43Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 19 May 2010, Adam Monsen wrote:\n\n> I backup my remote git repositories on sf.net using \"rsync -a REMOTE\n> LOCAL\". I chose rsync instead of clone --mirror/fetch because I wanted\n> hook scripts, \"description\", and \"config\" backed up.\n> \n> I got the following error from my backup cron job:\n> \n>         rsync: send_files failed to open\n>         \"/mifos/head/objects/pack/tmp_pack_IcK2CZ\" (in gitroot):\n>         Permission denied (13)\n> \n> So, fine, I can't reach that file. Looks like a temp file--I think I did\n> a CTRL-C during a push, so maybe that's what caused it to be left\n> around. A few questions:\n> \n>      1. Should I just ignore \"objects/pack/tmp_pack_*\" file in my rsync\n>         backup?\n\nYes.\n\n>      2. Should I shell into sf.net and run \"git gc\" on the repository?\n>         or \"git repack\"? or something else?\n\nThe command which removes stall tmp files after a grace period is 'git \nprune'.  This is normally run amongst other things by 'git gc'.\n\n>      3. Is rsync a bad idea? For instance, is the backup useful even if\n>         rsync was running while someone was doing a \"git push\" into the\n>         repository being backed up?\n\nIf you want your rsync backup to be fine, you need to follow some \nordering.  You need to copy the refs first (.git/packed-refs and \n.git/refs/), then the loose objects (.git/objects/??/*), and then all \nthe rest.  If files are copied in a different order while some write \noperations are performed on the source repository then you may end up \nwith an incoherent repository.\n\n>      4. Anyone have different rsync options to recommend for optimal\n>         backup of a git repository?\n\nThe optimal backup of a git repo is performed by git itself.  Due to \nrepacking, the pack files are likely to change over time which will \ncompletely defeat rsync's ability to transfer only differences to a file \nwhen updating your backup.  Git will always transfer the minimum of \ninformation to replicate a repository's _content_ even if the actual \nrepository files aren't identical on both ends, plus you get some SHA1 \nvalidation of the transferred data for free.  But if your repository is \nquiet and you don't mind the extra transfer size then rsync should work \njust fine.\n\n> Thank you!\n> -Adam\n> \n> PS - git rocks... our benefits since migrating from svn are numerous:\n> * remote folks (UK, India, Africa, etc.) are quite happy with the speed\n> increase\n> * branching and merging just works\n> * examining logs/forensics is much easier and faster\n> * lots more, but I gotta grab me some lunch\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"141934","messageId":"loom.20100520T044929-726@post.gmane.org","threadId":"23848","inReplyTo":"alpine.LFD.2.00.1005191935400.12758@xanadu.home","subject":"Re: ok to delete tmp_pack file(s)? also, backing up a git repository","fromName":"Adam Monsen","fromEmail":"haircut@gmail.com","sentAt":"2010-05-20T02:55:56Z","receivedAt":"2010-05-20T02:55:56Z","isPatch":false,"sender":{"key":"haircut@gmail.com","avatar":"https://avatars.githubusercontent.com/u/50639?v=4"},"body":"Nicolas Pitre writes:\n> If you want your rsync backup to be fine, you need to follow some \n> ordering.\n\nAh, good to know! I don't want to complicate my backup job too much, so\nI'll probably switch to a job that does the following for each repository,\ndaily (or so):\n\n1) \"git fetch\": update bare clone\n2) rsync backup \"hooks/\", \"config\", and \"description\".\nI think that's all I've customized that I'd miss in a catastrophic failure.\n\nThanks for the tips.\n"}]}