git gc: no space left on device, even though 3GB available and tmp_pack only 16MB
I had an instance of this problem. I was able to free up a considerable amount of disk space, but of course, that didn't solve the problem of what to do about the .tmp-* files. I ran git fsck
and the Git repository wasn't damaged in that way.
I did the conventional pack-and-garbage-collect operations
git repack -Ad
git prune
but that didn't remove the .tmp-* files, though it would have ensured that all of the necessary objects were in the standard pack-* files if they needed to be copied from transient files left over from the crashed Git processes in the past.
Eventually I realized that I could safely move the .tmp-* files to a scratch directory, then run git fsck
to see if what remained in the .git directory was complete. It turned out that it was, so I deleted the scratch directory and the files it contained. If git fsck
had reported problems, I could have moved the .tmp-* files back into the .git directory and researched another solution.
Git Garbage collection doesnt seem to fully work
C:\Users\VonC\prog\git\git>git log -Ssize-garbage|more
This show the size-garbage
output has been introduced in commit 1a20dd4 by Nguyễn Thái Ngọc Duy (pclouds
) for git 1.8.3 (May 2013)
size-garbage
: disk space consumed by garbage files, in KiB
count-objects
: report how much disk space taken by garbage files
Also issue warnings on loose garbages instead of errors as a result of
usingreport_garbage()
function incount_objects()
This garbage cleaning tip section mentions:
To bring the repo size down the bare minimum, you need both the following commands (neither command by itself does the whole job).
Also Note the lowercase "a
" on the "repack
", which says you want to blindly discard unreachable objects instead of keeping them as loose objects.
git repack -adf # kills in-pack garbage
git prune # kills loose garbage
So try again the git count-objects -v -H
after applying both commands.
Looking at the git repack
man page, jthill adds in the comments:
I prefer the big-
A
option:
"Same as
-a
, unless-d
is used.
Then any unreachable objects in a previous pack become loose, unpacked objects, instead of being left in the old pack."
Linus Torvalds argues that
-f
likegc
's--aggressive
is much overused -- so much so he suggested yanking the documentation for it.
(in 2007)
(-f
is for--no-reuse-delta
)
That means a more efficient combination might be:
git repack -Ad # kills in-pack garbage
git prune # kills loose garbage
Related Topics
How to Copy Multiple Files from a Different Directory Using Cp
Svn Error: Can't Convert String from Native Encoding to 'Utf-8'
Examining C/C++ Heap Memory Statistics in Gdb
Why Do I Have to Use Bash -L -C Inside My Container
Linux-Based Firmware, How to Implement a Good Way to Update
What's the Best Way to Distribute a Binary Application for Linux
Using 'Find -Perm' to Find When a Permission Is Not Set
Expression After Last Specific Character
Is There a Limit on Number of Tcp/Ip Connections Between MAChines on Linux
How to Remove All White Spaces from a Given Text File
How to Read Websocket Response in Linux Shell
Is There Any Modern Review of Solutions to the 10000 Client/Sec Problem
Linux Configure/Make, --Prefix
"When" Condition on Ansible Playbook Doesn't Work as Expected Using Operators
What's the Meaning of a ! Before a Command in the Shell
How to Find Words from One File in Another File
Chmod - Protect Users' File Being Accessed So Only Owner Can Access