guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guix gc: smarter collection & guix.el manual deletion


From: Chris Marusich
Subject: Re: guix gc: smarter collection & guix.el manual deletion
Date: Sun, 29 Jul 2018 05:06:34 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Pierre Neidhardt <address@hidden> writes:

>> Perhaps you simply don't have enough garbage available for the collector
>> to collect?  If you ask for 5 GiB, your system has 3 GiB free, and there
>> is only 1 GiB of garbage, the best the collector can do is collect all
>> the garbage (1 GiB) and leave you with just 4 GiB of free space.
>
> Sorry for the sparse details, I forgot to mention that if I run `guix gc 
> -F8GB`,
> then I get 5-6GB back, so it _can_ remove that much garbage indeed! ;)

The "guix gc" command appears to be working correctly for me:

--8<---------------cut here---------------start------------->8---
[0] address@hidden:~
$ df -h /gnu/store
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/encrypted-root  211G  194G  5.8G  98% /gnu/store
[0] address@hidden:~
$ guix gc -F8G
guix gc: freeing 2,336.80469 MiBs
finding garbage collector roots...
deleting garbage...
[...]
deleted or invalidated more than 2450317312 bytes; stopping
[...]
[0] address@hidden:~
$ df -h /gnu/store
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/encrypted-root  211G  187G   13G  94% /gnu/store
--8<---------------cut here---------------end--------------->8---

Above, I began with 5.8 GiB of free space in the store's file system.  I
asked Guix to increase that value to 8 GiB.  Guix correctly determined
that it would need to free approximately 8 - 5.8 = 2.2 GiB or more to
fulfill my request.  It then started collecting garbage and stopped once
it found that it had freed slightly more space than required.  I ended
with 13 GiB of free space.  Since I asked Guix to collect enough garbage
to end up with at least 8 GiB of free space, Guix behaved correctly.

Before you run "guix gc" next time, first see how much garbage you have:

--8<---------------cut here---------------start------------->8---
[0] address@hidden:~
$ guix gc --list-dead | tr '\n' '\0' | du -hsc --files0-from - | tail -n 1
finding garbage collector roots...
determining live/dead paths...
70G     total
--8<---------------cut here---------------end--------------->8---

Above, dead paths take up 70 GiB of space in my store.  However, even if
Guix collects all of those dead paths, it might not actually free up 70
GiB of space.  This is because of deduplication.  If a dead path and a
live path have been deduplicated, it means they had the same content and
Guix saved space by converting them to hard links pointing to the same
inode.  In that case, the amount of space Guix can free is strictly less
than 70 GiB, since Guix has to keep the deduplicated storage around for
the sake of the live path.

In any case, if the current free space plus the space taken up by the
dead paths is less than the amount of free space you requested via the
-F option, then Guix will collect all the garbage, but you'll definitely
end up with less free space than you asked for.

Hopefully this will help to explain the behavior you're seeing.

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]