diff options
| author | Joan V. C. <codeberg-hn80@joanvc.cat> | 2026-03-20 09:42:50 +0100 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2026-05-20 11:37:30 +0300 |
| commit | 3b7fd1e76698559f8575ffeeed116673bd00ade1 (patch) | |
| tree | e49b166727766800ed1005bd4baf792f667c1ec5 /doc | |
| parent | 5912f01e976480b50c18c65f8236a998fc7db7f9 (diff) | |
gnu: services: Add btrfs-scrub-service-type.
* gnu/services/linux.scm (btrfs-scrub-configuration): New configuration
record.
(btrfs-scrub-service-type): New service type with custom actions.
(fstrim-/shepherd-calendar-event?): Refactor to avoid name collisions.
* doc/guix.texi: Add service documentation.
Change-Id: I04747914591a80cd535d2f79d35e08f68081b2fc
Signed-off-by: Joan Vilardaga Castro <codeberg-hn80@joanvc.cat>
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guix.texi | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 8d45ed1f43b..debe9b48a77 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -151,6 +151,7 @@ Copyright @copyright{} 2025 Noé Lopez@* | |||
| 151 | Copyright @copyright{} 2026 David Elsing@* | 151 | Copyright @copyright{} 2026 David Elsing@* |
| 152 | Copyright @copyright{} 2026 Nguyễn Gia Phong@* | 152 | Copyright @copyright{} 2026 Nguyễn Gia Phong@* |
| 153 | Copyright @copyright{} 2026 Yarl Baudig@* | 153 | Copyright @copyright{} 2026 Yarl Baudig@* |
| 154 | Copyright @copyright{} 2026 Joan Vilardaga Castro@* | ||
| 154 | 155 | ||
| 155 | Permission is granted to copy, distribute and/or modify this document | 156 | Permission is granted to copy, distribute and/or modify this document |
| 156 | under the terms of the GNU Free Documentation License, Version 1.3 or | 157 | under the terms of the GNU Free Documentation License, Version 1.3 or |
| @@ -45888,6 +45889,81 @@ mount. | |||
| 45888 | @end table | 45889 | @end table |
| 45889 | @end deftp | 45890 | @end deftp |
| 45890 | 45891 | ||
| 45892 | @subsubheading btrfs-scrub Service | ||
| 45893 | @cindex btrfs-scrub service | ||
| 45894 | @cindex solid state drives, periodic trim | ||
| 45895 | @cindex solid state drives, trim | ||
| 45896 | |||
| 45897 | @c This was copied from the btrfs-scrub manpage, with some Texinfo touch-ups. | ||
| 45898 | @quotation Information | ||
| 45899 | Scrub is a validation pass over all filesystem data and metadata that | ||
| 45900 | detects data checksum errors, basic super block errors, basic metadata | ||
| 45901 | block header errors, and disk read errors. | ||
| 45902 | |||
| 45903 | Scrub is done on a per-device base, if a device is specified to | ||
| 45904 | @command{btrfs scrub start}, then only that device will be | ||
| 45905 | scrubbed. Although btrfs will also try to read other device to find a | ||
| 45906 | good copy, if the mirror on that specified device failed to be read or | ||
| 45907 | pass verification. | ||
| 45908 | |||
| 45909 | If a path of btrfs is specified to @command{btrfs scrub start}, btrfs | ||
| 45910 | will scrub all devices in parallel. | ||
| 45911 | |||
| 45912 | On filesystems that use replicated block group profiles (e.g. RAID1), | ||
| 45913 | read-write scrub will also automatically repair any damage by copying | ||
| 45914 | verified good data from one of the other replicas. | ||
| 45915 | |||
| 45916 | Such automatic repair is also carried out when reading metadata or data | ||
| 45917 | from a read-write mounted filesystem. | ||
| 45918 | @end quotation | ||
| 45919 | |||
| 45920 | @defvar btrfs-scrub-service-type | ||
| 45921 | Type for a service that periodically runs @command{btrfs-scrub} on a | ||
| 45922 | certain device, whose value must be an | ||
| 45923 | @code{<btrfs-scrub-configuration>} object. The service can be | ||
| 45924 | instantiated in its default configuration with: | ||
| 45925 | |||
| 45926 | @lisp | ||
| 45927 | ;; This will scrub the root (@file{/}) filesystem. | ||
| 45928 | (service btrfs-scrub-service-type) | ||
| 45929 | |||
| 45930 | ;; This will scrub the @file{/gnu/store} filesystem (assuming it's a | ||
| 45931 | ;; different filesystem from @file{/}). | ||
| 45932 | |||
| 45933 | (service btrfs-scrub-service-type | ||
| 45934 | (btrfs-scrub-configuration | ||
| 45935 | (to-scrub "/gnu/store"))) | ||
| 45936 | @end lisp | ||
| 45937 | @end defvar | ||
| 45938 | |||
| 45939 | @c %start of fragment | ||
| 45940 | |||
| 45941 | @deftp {Data Type} btrfs-scrub-configuration | ||
| 45942 | Available @code{btrfs-scrub-configuration} fields are: | ||
| 45943 | |||
| 45944 | @table @asis | ||
| 45945 | @item @code{package} (default: @code{btrfs-progs}) (type: file-like) | ||
| 45946 | The package providing the @command{btrfs} command. | ||
| 45947 | |||
| 45948 | @item @code{schedule} (default: @code{"0 0 1-7 * 0"}) (type: Shepherd calendar event) | ||
| 45949 | Schedule for launching @command{btrfs-scrub}, expressed as a string in | ||
| 45950 | traditional cron syntax or as a gexp evaluating to a Shepherd calendar | ||
| 45951 | event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). By default | ||
| 45952 | this is set to run the 1st Sunday of the month, at 00:00. | ||
| 45953 | |||
| 45954 | @item @code{to-scrub} (default: @code{"/"}) (type: maybe-string) | ||
| 45955 | Device to scrub. It will scrub the root (@file{/}) if not given. | ||
| 45956 | |||
| 45957 | @item @code{extra-arguments} (type: maybe-list-of-strings) | ||
| 45958 | Extra options to append to @command{btrfs scrub start} (run @samp{man | ||
| 45959 | btrfs-scrub.8} for more information). Keep in mind that, by definition, | ||
| 45960 | this service uses the @option{-B} flag (do not background and print | ||
| 45961 | scrub statistics when finished). | ||
| 45962 | |||
| 45963 | @end table | ||
| 45964 | |||
| 45965 | @end deftp | ||
| 45966 | |||
| 45891 | @cindex oom | 45967 | @cindex oom |
| 45892 | @cindex out of memory killer | 45968 | @cindex out of memory killer |
| 45893 | @cindex earlyoom | 45969 | @cindex earlyoom |
