From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oFnlOT7SXWA6zwAAgWs5BA (envelope-from ) for ; Fri, 26 Mar 2021 13:23:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ECbXMz7SXWAvJwAA1q6Kng (envelope-from ) for ; Fri, 26 Mar 2021 12:23:26 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0DC2F37169 for ; Fri, 26 Mar 2021 13:23:26 +0100 (CET) Received: from localhost ([::1]:47034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPlUq-0003Ts-TI for larch@yhetil.org; Fri, 26 Mar 2021 08:23:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPlUU-0003T0-Qe for bug-guix@gnu.org; Fri, 26 Mar 2021 08:23:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPlUU-0004Vt-IL for bug-guix@gnu.org; Fri, 26 Mar 2021 08:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lPlUU-0002Gw-EK for bug-guix@gnu.org; Fri, 26 Mar 2021 08:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#47379: "statfs" test in tests/syscall.scm fails with BTRFS file systems. References: In-Reply-To: Resent-From: raid5atemyhomework Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 26 Mar 2021 12:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47379 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: "47379@debbugs.gnu.org" <47379@debbugs.gnu.org>, Efraim Flashner , Maxime Devos Received: via spool by 47379-submit@debbugs.gnu.org id=B47379.16167613518675 (code B ref 47379); Fri, 26 Mar 2021 12:23:02 +0000 Received: (at 47379) by debbugs.gnu.org; 26 Mar 2021 12:22:31 +0000 Received: from localhost ([127.0.0.1]:40603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPlTz-0002Fq-9A for submit@debbugs.gnu.org; Fri, 26 Mar 2021 08:22:31 -0400 Received: from mail-40137.protonmail.ch ([185.70.40.137]:27997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPlTw-0002FY-HW for 47379@debbugs.gnu.org; Fri, 26 Mar 2021 08:22:29 -0400 Date: Fri, 26 Mar 2021 12:22:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1616761341; bh=ygw74iDn6yzjQhqi9qzbGKLdCiyGHr226S33RUWL96c=; h=Date:To:From:Reply-To:Subject:From; b=JCNA/ZcWS567HOJoAczJ/MkdmbPhrn7LR+rjiUktC9eI/IYu27OWXb329pGATxawH iiAXQl4KnTEVcDpiD603FbN/BdkWtGo5Agq+VoDJibrZXVT/uAmYekgjyRY5YZgxX3 IMufsFzClpQn9qFhYlC9mmn25sK7lXCK3QNuDNew= Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" Reply-to: raid5atemyhomework X-ACL-Warn: , raid5atemyhomework From: raid5atemyhomework via Bug reports for GNU Guix X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616761406; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ygw74iDn6yzjQhqi9qzbGKLdCiyGHr226S33RUWL96c=; b=uewSARYIerVxMhd5y0OukI5Osx9MYd/DQ4Y4o1mDlGb+TSit64YnMHRz51R1Jgj+H8QjNS gnZe/nCteZn1Lacn5/C1XIAo8qinpAKIfWkB1fLb3VnDil5QVaZsCTAC8ZVuULLf16rotm Mw3cbk6L518Zhfk0ZqVmF5LPWgj21QbqqzeZrGtkwl1UApebUs5Iz4BAPovOBrFUTOrDne p73SBw6zHXfMZo8kPssl+P2yxzW+KiEvNU03JvTb+WtPpcjxBcGukNtUtx3mKFNabsFYIv wBoIdqM4k1NGxFmf8F6PB7IL7oRLV7hzTLxrYBPvWDVQ2gdkeuC3UStP1KYmeg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616761406; a=rsa-sha256; cv=none; b=p08vfTjSSsrMlxg7wQow9cdGKtFmcT1abjnY5c/jqt+KvGzSB6x1qA9XstOAmNkGO8D/ej JYKTvfYNb1UG/8HUCpvY7DC5BRSumdel/q+O+e+Zd6ESauKCLIrenOwEKqQ9BaFGK4aHWd qa4S8IlVMdjDMfhLu/qdFmhtrTnJtLt0ZB38eGRQp0No7KLCkDP17v8VJl0cUW/9mK+JRS ePkgU4EMztPEaca2xMbhMeVb4ylGcR+Hif4oABFEpbFD0vCp1i48OtuP17qpi8Qlla18XX geEVCZKSCCj0b6/CxjMtjSG09kBM2kGFwpYyeFLEN7AAJdeZSNnd2vpqYmPmpA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail header.b="JCNA/ZcW"; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -3.47 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail header.b="JCNA/ZcW"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 0DC2F37169 X-Spam-Score: -3.47 X-Migadu-Scanner: scn0.migadu.com X-TUID: dkICN+8V2oL7 > btrfs balance moves the free space around so that you have fewer blocks > with extra freed space. I normally run 'btrfs balance start -dusage=3D70 > -musage=3D80 $mountpoint'. (unless I have it backwards) I think you do? Usually the numbers for `musage` are smaller I think. There is some old advice that you should only balance data and never balanc= e metadata, i.e. `btrfs balance start -dusage=3D70 $mountpoint`. This is b= ecause 1Gb blocks are assigned to either data or metadata, and it's possibl= e for excessive balances to result in a situation where the metadata gets o= nly a single 1Gb block and the rest of storage is assigned to data. Then t= he single metadata 1Gb block gets filled, and when new metadata is needed -= -- such as to rebalance the large number of data blocks so they take up few= er 1Gb blocks and more blocks can be assigned to metadata --- the filesyste= m is unable to continue operating due to the lack of metadata space and you= are stuck in a condition where you cannot delete data, delete snapshots, a= nd rebalance data. This is old advice since the new "GlobalReserve" (not so new I think, it wa= s added way back in 4.x? 3.x?) should provide space for temporary metadata = operations in such a case. Personally I'd rather just let metadata be "loo= se" and unbalanced to avoid the situation altogether; metadata is fairly ti= ny so it taking up more than one 1Gb block usually means it has two 1Gb blo= cks, maybe three at a stretch if you've been doing a lot of file creation a= nd deletion events. Another piece of old advice is to regularly balance. For example, have a d= aily `btrfs balance start -dusage=3D50 -dlimit=3D2 $mountpoint` --- the `dl= imit` makes it so that balancing stops when two 1Gb blocks of data have bee= n merged into some other half-filled 1Gb blocks of data. If you have never= balanced your BTRFS system, you might want to wait for some low-utilizatio= n time period, do a full `btrfs balance start -dusage=3D90 $mountpoint` wit= hout a `dlimit`, then schedule a daily balance of `-dusage=3D50 -dlimit=3D2= ` afterwards. On the other hand, if you're using SSDs, be aware that balan= cing leads to writing, which lowers your drive's longevity (but the point o= f `dlimit` is to prevent excessive amounts of daily work, and if you're reg= ularly writing to your disk (almost) everyday anyway, a small `dusage` and = `dlimit` would be within the noise of your daily-work-activity writes). You also want to do regular `btrfs scrub start $mountpoint`. Once a week f= or consumer-quality drives, once a month for enterprise-quality drives, if = you're not sure which one you have, go weekly. This is advice typical from= ZFS but should still apply to BTRFS. On SSD (or other storage with TRIM commands) you might want to do scheduled= trim regularly once a week or once every two weeks, in order to take alloc= ation pressure off the SSD and let it get better wear-levelling. This is g= enerally done via `fstrim` without any BTRFS-specific commands. Old advice= is to avoid the `discard` mount option (in some cases it can trim so often= that the SSD lifetime is significantly reduced) but that's supposed to be = fixed so maybe with a recent version you can mount `-o discard`, maybe. P= ersonally I'd use explicit scheduled trim still. Do try to schedule this a= t low-activity times, though; unless you've got SATA 3.1 (hard to check, mo= st drives/controllers just say "SATA 3" or "SATA III" which may or may not = mean including SATA 3.1 support), or SAS, or real SCSI, trim commands are s= low. Finally you might also want to do explicit defragmentation (which is a sepa= rate issue from balancing --- balancing ensures you don't have lots of half= -used blocks, defragging means files try to have as much of their data in t= he same 1Gb block) periodically, like once a week or two weeks. See also https://github.com/kdave/btrfsmaintenance for a package that does = btrfs maintenance for you, including balance, scrubbing, trimming, and defr= agging, and schedules those in "recommended" times as well. I think it mig= ht also have auto-snapshotting, though that is a bit more fraught as snapsh= ots are fairly heavyweight on BTRFS. Do note that it's crontab/SystemD-bas= ed though, so needs a good amount of glue code if you want to use it in Gui= x. It's available on Debian as `btrfsmaintenance` package. It's also got = a lot of settings, so you'd be up for a fairly comprehensive configuration = system to adapt it for Guix. Going back on topic... It looks like the test assumes "free" should equal "= available", but that is something that is likely not to work on ***all*** c= opy-on-write filesystems --- including ZFS and bcachefs, not just BTRFS. I= n particular, most copy-on-write filesystems (BTRFS, ZFS, and bcachefs) sup= port transparent compression, meaning "available" is often an estimated mul= tiple of "free". Probably the test should either explicitly use a specific= filesystem (maybe `tmpfs` would work? Or create a 1Gb "dd if=3D/dev/zero` = file in `/tmp` and bind-mount `ext4` onto it) that is simple enough that "f= ree" =3D=3D "available" most of the time, or it should just remove that par= ticular test. Thanks raid5atemyhomework