-2

I am running rsync version 3.0.8 and cp 8.32 on a Windows 10 host via git-bash. I have a git server running in a container that uses a hard drive attached to the host. Now I try to backup that server files and keep failing no matter if I use rsync or cp.

I could narrow it down to a file that does exist on the hard drive but when transferring it is created as an empty file on the backup drive.

Here is what I try:

$ cd /backup_drive && \
>     rsync \
>     --verbose \
>     --checksum \
>     --archive \
>     --delete \
>     --progress \
>     "../server_drive/git-server/repo/objects/pack" \
>     "../backup_drive/server_drive/git-server/repo/objects"
sending incremental file list
pack/
pack/pack-558bb0397370ee5026dd0ce32579908064ed9e72.pack
   -24729119 100%    0.00kB/s    0:00:00 (xfer#1, to-check=2/5)

sent 319 bytes  received 41 bytes  48.00 bytes/sec
total size is 5794386858  speedup is 16095519.05

(cd is used as there are issues with colons that git-bash will automatically add).

or

cp \
    --force \
    --recursive \
    --verbose \
    --update \
    "/server_drive/git-server/repo/objects/pack" \
    "/backup_drive/server_drive/git-server/repo/objects"

Both commands exit with 0 indicating that there were no errors. But when I compare the SHA-256 hashes they are obviously different because of the missing bytes in that file.

Interestingly, if I copy the file on Windows by hand it works just fine.

What could that be caused of and how can I backup that file via rsync or cp?

TimFinnegan
  • 583
  • 5
  • 17
  • Questions about operating systems, their utilities, networking and hardware, are off topic here. [What topics can I ask about here?](https://stackoverflow.com/help/on-topic). Please delete this and ask, instead, https://superuser.com/ – Rob Oct 29 '22 at 08:08

1 Answers1

0

An alternative would be to:

  • trigger in your "git server" container a program which would do a git bundle:

    cd /path/to/bare/repository.git
    git bundle create reponame.bundle --all
    
  • copy that one bundle file as a backup.

Copying one file is much easier than a lot of small files, some of them might be kept by a process handle which would prevent them to be accessed/read by rsync.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250