From: "Michal Suchánek" <msuchanek@suse.de>
To: Akash S <akashs@commvault.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Adithya Urugudige <aurugudige@commvault.com>,
Abhishek Dalmia <adalmia@commvault.com>
Subject: Re: Incremental Backup of repositories using Git
Date: Fri, 9 May 2025 13:13:36 +0200 [thread overview]
Message-ID: <aB3jYNAJAbKjSWAS@kitsune.suse.cz> (raw)
In-Reply-To: <PH7PR19MB70252D42F5D04FFC0331AB63C08E2@PH7PR19MB7025.namprd19.prod.outlook.com>
On Mon, May 05, 2025 at 02:35:43PM +0000, Akash S wrote:
> Hi,
>
> Currently we are backing up repositories using the "git clone -bare" command and save it to disk. If we want to restore, we just run git push -mirror from the repo that was saved during the backup.
>
> Currently we are running full backups (run git clone -bare) everyday, which is taking a lot of disk space and time.
>
> Are there any possible ways to backup only the incremental changes of a repository? And somehow construct the whole repository when we want to do a restore from the incremental backups?
Hello,
first, to make it easier to update the backup the clone should be done
with --bare --mirror.
If your clone ends up having multiple packs and loose objects you
can reduce its size with
git --git-dir=/path/to/clone repack -adk
This should give you a repository with a single pack and no loose
objects.
The -k (or --cruft) option is required, using only -ad seems to corrupt
repositories quite reliably.
To speed up the clone next time around you can make a copy of the
previous backup and fetch from the remote repository but because
there is no safe way I am aware of to eliminate no longer referenced
objects you will accumulate cruft this way.
This is now a complete backup, and should be made readonly to not get
corrupted with further operations.
The inrementeal backups are somewhat speculative, I have not tested this
at all.
You can create a shared clone of the full backup, update the origin URL
of the shared clone to the remote repository to backup, and do a fetch
-p (which now should do the right thing because the initial clone was
set up as mirror).
To repack you need to use the --local option in addition.
With this you should have a valid repository for each backup with the
incremental backups sharing most objects with the full backup.
These can be inspected with git commands, exported over gitweb, or
whatever.
Thanks
Michal
next prev parent reply other threads:[~2025-05-09 11:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 14:35 Incremental Backup of repositories using Git Akash S
2025-05-05 16:18 ` Justin Tobler
2025-05-06 12:44 ` Abhishek Dalmia
2025-05-06 20:46 ` Justin Tobler
2025-05-08 10:24 ` Abhishek Dalmia
2025-05-08 18:39 ` Jeff King
2025-05-27 22:21 ` Abhishek Dalmia
2025-05-08 18:47 ` Michal Suchánek
2025-05-08 19:47 ` Jeff King
2025-05-08 20:06 ` rsbecker
2025-05-08 20:20 ` Jeff King
2025-05-09 9:08 ` Michal Suchánek
2025-05-09 11:13 ` Michal Suchánek [this message]
2025-05-09 11:22 ` Michal Suchánek
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=aB3jYNAJAbKjSWAS@kitsune.suse.cz \
--to=msuchanek@suse.de \
--cc=adalmia@commvault.com \
--cc=akashs@commvault.com \
--cc=aurugudige@commvault.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.