Hi Tanguy,

"Tanguy Le Carrour" <tan...@bioneland.org> writes:

> Hi Maxim, Hi Guix,
>
>
> On Sun Mar 9, 2025 at 5:57 AM CET, Maxim Cournoyer wrote:
>> "Tanguy Le Carrour" <tan...@bioneland.org> writes:
>>
>> [...]
>>
>>>> I'd migrate your system to the Btrfs file system, which dynamically
>>>> allocates inodes and never runs out of them.  It has a few peculiarities
>>>> that must be taken into account, such as the requirement to run 'btrfs
>>>> balance' periodically to reclaim unallocated blocks, but otherwise it's
>>>> stable and has interesting features.  Make sure to use it with Zstd
>>>> compression to magically double (about) your storage capacity :-).
>>>
>>> Sounds like an **excellent** plan! I’ll give it a try at the week-end!
>>> Can I actually do it from the installer? 🤔… well I guess I’ll figure it out
>>> soon enough! 😅
>>
>> I think the installer supports creating and installing to Btrfs.  The
>> compression options can always be added or changed at a later time.
>
> Long story short: I now have a brand new Guix System with a Btrfs root and
> everything seems to be working quite well! 😁

Excellent!  Just don't forget to run the 'btrfs balance /' command
regularly, otherwise over time the allocated storage chunks of Btrfs
gets all used up, despite what 'df' and other tools might say, and this
is an annoying situation to recover from.

Here are some btrfs-related jobs I use:

--8<---------------cut here---------------start------------->8---
(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 12 PM every 3 days.
  #~(job '(next-hour-from (next-day (range 1 31 3)) '(12))
         (lambda ()
           (system* #$(file-append btrfs-progs "/bin/btrfs")
                    "balance" "start" "-dusage=5" "/"))
         "btrfs-balance"))

(define btrfs-scrub-job
  ;; Scans the whole disk data to detect and repair errors.  Runs at 12
  ;; AM monthly.
  #~(job '(next-hour-from (next-month) '(12))
         (lambda ()
           (system* #$(file-append btrfs-progs "/bin/btrfs")
                    "scrub" "start" "-c3" "/"))
         "btrfs-scrub"))

(define btrbk-job
  #~(job '(next-hour)
         (lambda ()
           (system* #$(file-append btrbk "/bin/btrbk")
                    "-q" "-c" #$(local-file "btrbk.conf") "run"))
         "btrbk"))
--8<---------------cut here---------------end--------------->8---

I'd also advise using just compress=zstd and not compress-force=zstd, as
the later limits the size of Btrfs extents (if I recall the terminology
right) created to 512 KiB or similar, leading to a huge number of
extents over time, which can slow some things down such as mounting the
file system at boot.

In case you have any question, knowledgeable Btrfs folks are usually
responsive in #btrfs on Libera.chat.

Cheers!

-- 
Thanks,
Maxim

Reply via email to