[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: hydra: berlin: Add mcron btrfs balance job.
From: |
Maxim Cournoyer |
Subject: |
02/02: hydra: berlin: Add mcron btrfs balance job. |
Date: |
Mon, 3 Oct 2022 12:17:44 -0400 (EDT) |
apteryx pushed a commit to branch master
in repository maintenance.
commit 36d610130e5d2354039bcdf678fe34afdc2dfaba
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Oct 3 11:32:22 2022 -0400
hydra: berlin: Add mcron btrfs balance job.
* hydra/berlin.scm (btrfs-balance-job): New variable.
[services]: Register the job in the mcron-configuration inherited from
the frontend-services.
---
hydra/berlin.scm | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/hydra/berlin.scm b/hydra/berlin.scm
index 07f8771..dc30fe1 100644
--- a/hydra/berlin.scm
+++ b/hydra/berlin.scm
@@ -16,7 +16,7 @@
((guix build utils) #:select (find-files))
(srfi srfi-1)
(ice-9 match))
-(use-service-modules avahi base databases dns monitoring networking admin
+(use-service-modules avahi base databases dns mcron monitoring networking admin
rsync shepherd ssh vpn web)
(use-package-modules admin base certs databases disk emacs linux mail
monitoring
screen ssh tls tor vim package-management
@@ -211,6 +211,16 @@ at MOUNT-POINT."
(cons (cons "subvol" name)
%common-btrfs-options)))))
+(define btrfs-balance-job
+ ;; Re-allocate chunks which are using less than 5% of their chunk
+ ;; space, to regain Btrfs 'unallocated' space. The usage is kept
+ ;; low (5%) to minimize wear on the SSD. Runs at 5 AM every 3 days.
+ #~(job '(next-hour-from (next-day (range 1 31 3)) '(5))
+ (lambda ()
+ (execl #$(file-append btrfs-progs "/bin/btrfs") "btrfs"
+ "balance" "start" "-dusage=5" "/"))
+ "btrfs-balance"))
+
(define (anonip-service file)
(service anonip-service-type
(anonip-configuration
@@ -486,14 +496,21 @@ at MOUNT-POINT."
(append
(map anonip-service %anonip-log-files)
(website-services)
- (frontend-services %sysadmins
- ;; Make sure we get enough build users.
- #:authorized-keys %build-node-keys
- #:build-accounts-to-max-jobs-ratio 5
- #:gc-threshold (* 15 TiB)
- #:systems '("x86_64-linux" "i686-linux"
- "aarch64-linux"
- "powerpc64le-linux")
- #:motd %motd
- #:publish-workers 8
- #:max-jobs 20)))))
+ (modify-services
+ (frontend-services %sysadmins
+ ;; Make sure we get enough build users.
+ #:authorized-keys %build-node-keys
+ #:build-accounts-to-max-jobs-ratio 5
+ #:gc-threshold (* 15 TiB)
+ #:systems '("x86_64-linux" "i686-linux"
+ "aarch64-linux"
+ "powerpc64le-linux")
+ #:motd %motd
+ #:publish-workers 8
+ #:max-jobs 20)
+ (mcron-service-type
+ config => (mcron-configuration
+ (inherit config)
+ (jobs (cons btrfs-balance-job
+ (mcron-configuration-jobs
+ config))))))))))