mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
guix gc: Add '--verify'.
* guix/scripts/gc.scm (show-help, %options): Add --verify. (guix-gc): Handle it. * doc/guix.texi (Invoking guix gc): Document --verify, and move --optimize description right below it.
This commit is contained in:
parent
c63d94035f
commit
7770aafc75
2 changed files with 66 additions and 13 deletions
|
@ -1541,8 +1541,9 @@ is achieved by running @code{guix package --delete-generations}
|
||||||
|
|
||||||
The @command{guix gc} command has three modes of operation: it can be
|
The @command{guix gc} command has three modes of operation: it can be
|
||||||
used to garbage-collect any dead files (the default), to delete specific
|
used to garbage-collect any dead files (the default), to delete specific
|
||||||
files (the @code{--delete} option), or to print garbage-collector
|
files (the @code{--delete} option), to print garbage-collector
|
||||||
information. The available options are listed below:
|
information, or for more advanced queries. The garbage collection
|
||||||
|
options are as follows:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item --collect-garbage[=@var{min}]
|
@item --collect-garbage[=@var{min}]
|
||||||
|
@ -1564,17 +1565,6 @@ Attempt to delete all the store files and directories specified as
|
||||||
arguments. This fails if some of the files are not in the store, or if
|
arguments. This fails if some of the files are not in the store, or if
|
||||||
they are still live.
|
they are still live.
|
||||||
|
|
||||||
@item --optimize
|
|
||||||
@cindex deduplication
|
|
||||||
Optimize the store by hard-linking identical files---this is
|
|
||||||
@dfn{deduplication}.
|
|
||||||
|
|
||||||
The daemon performs deduplication after each successful build or archive
|
|
||||||
import, unless it was started with @code{--disable-deduplication}
|
|
||||||
(@pxref{Invoking guix-daemon, @code{--disable-deduplication}}). Thus,
|
|
||||||
this option is primarily useful when the daemon was running with
|
|
||||||
@code{--disable-deduplication}.
|
|
||||||
|
|
||||||
@item --list-dead
|
@item --list-dead
|
||||||
Show the list of dead files and directories still present in the
|
Show the list of dead files and directories still present in the
|
||||||
store---i.e., files and directories no longer reachable from any root.
|
store---i.e., files and directories no longer reachable from any root.
|
||||||
|
@ -1602,6 +1592,47 @@ of these, recursively. In other words, the returned list is the
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
Lastly, the following options allow you to check the integrity of the
|
||||||
|
store and to control disk usage.
|
||||||
|
|
||||||
|
@table @option
|
||||||
|
|
||||||
|
@item --verify[=@var{options}]
|
||||||
|
@cindex integrity, of the store
|
||||||
|
@cindex integrity checking
|
||||||
|
Verify the integrity of the store.
|
||||||
|
|
||||||
|
By default, make sure that all the store items marked as valid in the
|
||||||
|
daemon's database actually exist in @file{/gnu/store}.
|
||||||
|
|
||||||
|
When provided, @var{options} must a comma-separated list containing one
|
||||||
|
or more of @code{contents} and @code{repair}.
|
||||||
|
|
||||||
|
When passing @option{--verify=contents}, the daemon will compute the
|
||||||
|
content hash of each store item and compare it against its hash in the
|
||||||
|
database. Hash mismatches are reported as data corruptions. Because it
|
||||||
|
traverses @emph{all the files in the store}, this command can take a
|
||||||
|
long time, especially on systems with a slow disk drive.
|
||||||
|
|
||||||
|
@cindex repairing the store
|
||||||
|
Using @option{--verify=repair} or @option{--verify=contents,repair}
|
||||||
|
causes the daemon to try to repair corrupt store items by fetching
|
||||||
|
substitutes for them (@pxref{Substitutes}). Because repairing is not
|
||||||
|
atomic, and thus potentially dangerous, it is available only to the
|
||||||
|
system administrator.
|
||||||
|
|
||||||
|
@item --optimize
|
||||||
|
@cindex deduplication
|
||||||
|
Optimize the store by hard-linking identical files---this is
|
||||||
|
@dfn{deduplication}.
|
||||||
|
|
||||||
|
The daemon performs deduplication after each successful build or archive
|
||||||
|
import, unless it was started with @code{--disable-deduplication}
|
||||||
|
(@pxref{Invoking guix-daemon, @code{--disable-deduplication}}). Thus,
|
||||||
|
this option is primarily useful when the daemon was running with
|
||||||
|
@code{--disable-deduplication}.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
@node Invoking guix pull
|
@node Invoking guix pull
|
||||||
@section Invoking @command{guix pull}
|
@section Invoking @command{guix pull}
|
||||||
|
|
|
@ -57,6 +57,11 @@ (define (show-help)
|
||||||
(display (_ "
|
(display (_ "
|
||||||
--referrers list the referrers of PATHS"))
|
--referrers list the referrers of PATHS"))
|
||||||
(newline)
|
(newline)
|
||||||
|
(display (_ "
|
||||||
|
--verify[=OPTS] verify the integrity of the store; OPTS is a
|
||||||
|
comma-separated combination of 'repair' and
|
||||||
|
'contents'"))
|
||||||
|
(newline)
|
||||||
(display (_ "
|
(display (_ "
|
||||||
-h, --help display this help and exit"))
|
-h, --help display this help and exit"))
|
||||||
(display (_ "
|
(display (_ "
|
||||||
|
@ -94,6 +99,17 @@ (define %options
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'action 'optimize
|
(alist-cons 'action 'optimize
|
||||||
(alist-delete 'action result))))
|
(alist-delete 'action result))))
|
||||||
|
(option '("verify") #f #t
|
||||||
|
(let ((not-comma (char-set-complement (char-set #\,))))
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(let ((options (if arg
|
||||||
|
(map string->symbol
|
||||||
|
(string-tokenize arg not-comma))
|
||||||
|
'())))
|
||||||
|
(alist-cons 'action 'verify
|
||||||
|
(alist-cons 'verify-options options
|
||||||
|
(alist-delete 'action
|
||||||
|
result)))))))
|
||||||
(option '("list-dead") #f #f
|
(option '("list-dead") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'action 'list-dead
|
(alist-cons 'action 'list-dead
|
||||||
|
@ -177,6 +193,12 @@ (define (list-relatives relatives)
|
||||||
(list-relatives referrers))
|
(list-relatives referrers))
|
||||||
((optimize)
|
((optimize)
|
||||||
(optimize-store store))
|
(optimize-store store))
|
||||||
|
((verify)
|
||||||
|
(let ((options (assoc-ref opts 'verify-options)))
|
||||||
|
(exit
|
||||||
|
(verify-store store
|
||||||
|
#:check-contents? (memq 'contents options)
|
||||||
|
#:repair? (memq 'repair options)))))
|
||||||
((list-dead)
|
((list-dead)
|
||||||
(for-each (cut simple-format #t "~a~%" <>)
|
(for-each (cut simple-format #t "~a~%" <>)
|
||||||
(dead-paths store)))
|
(dead-paths store)))
|
||||||
|
|
Loading…
Reference in a new issue