Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp42823lfv; Tue, 12 Apr 2022 16:31:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKVPs0iBrdx7ZbnNB8lg3fb/mhe+/UnfpjlwO0a7uPNCe1fgoKHzdUqauRBDj4UTSutmM1 X-Received: by 2002:a63:3150:0:b0:39d:a2d7:77c5 with SMTP id x77-20020a633150000000b0039da2d777c5mr3043329pgx.353.1649806263173; Tue, 12 Apr 2022 16:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649806263; cv=none; d=google.com; s=arc-20160816; b=yJNU9DVrXMTYe5+yZbIyvgyuYhh2B+gN6vFPAqrrL/+nDFB8h12kP84+C89S78Hnx7 HPC3p5wDHq4cfn6Y5nBQk+rYBUWy1qJhTBwS3jWexQz0kvv6BXUNXs/DKk+P1acw7bj3 bsxTcUBmbslkwA6tOcoe5XrTUbJ8i6VCQWVd3YJva1nxPS4Lib6K8NH1ASSyoxDBKZWg ZoaMuiCvhZo5wyN25WoCXyaxJWmJSoUrq+cKhfPIGjC1QK1uJW9gxyOLq5Eco3wB44vL hLkuUT8UZmtUmp+sfcO81KZZspdRI+/6s23f0sMM5ksQFv38jCCLcu3YENCXZolmBvSp j+Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yKIabKy8Ujh0kQ/uW3RVLX3p2wSYQC+7wg5wsnfok+w=; b=sotuXJ2fJVbGtHpBKGYhSySAH4W2QqtVGN2V19AV1aoRW8ILJvPXFgDeCi4wA+YoXL OEqIhliddp0FR0xeBXp7Tv6VIeah3OMpqEW2pdTAaDSsvLvQMt6zSZrEGa/8SnLXfdti b/sLZkinejHWJB4qVscofyKUCL6ptqmllJni/ikcCOg5yQeW7yORfGZly6VCHjdmqTNJ j8lZG+vOfaeuiq2oksX1yj/fvV2youZgbrIIDLy30OVYlECrk+cSy76S1jk2WCP6atbN w10t2lAVXCxQ/lHR+kXWtCkk3hdiAQZIqOlUQBpWOyLOl6CWDF0nGWprq5TGDUjztY8m bH0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OoL77DEm; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 10-20020a170902e9ca00b001568e8ab80dsi12494355plk.369.2022.04.12.16.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:31:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OoL77DEm; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8995C10DA4D; Tue, 12 Apr 2022 14:22:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352844AbiDLKOn (ORCPT + 99 others); Tue, 12 Apr 2022 06:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357541AbiDLJtT (ORCPT ); Tue, 12 Apr 2022 05:49:19 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E66964BEA for ; Tue, 12 Apr 2022 01:56:14 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id l7so30505067ejn.2 for ; Tue, 12 Apr 2022 01:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yKIabKy8Ujh0kQ/uW3RVLX3p2wSYQC+7wg5wsnfok+w=; b=OoL77DEmQr5cDKpU0Ushyj5+A9aB1avdCEgr7FG4BfCtN/+1ogs1oY+Cz6flx1dMXN 0/YvzjMtoNUj94PgQfHf2FSz8921HLW7Iqz+hy1Ge5bp3xywhFTMMjA0awrD2Afh4I+P 1BA741Xl1FuQq/UnDwoY0sbPPhyn1rNX8K1IrottMecGHZjrDQrhDrAaRiUe5jLs/Xmz 5OdY3byib7Y/OnGmgK3Fcx+tvZnttVN47bM9MM++6HJlh+VsWheZLhu9oEn0jpSYeriv vMXVbM9X4RMG14RZDw2damHPrUAOwT5UyGH8sDPjzpBGXF0pmsnDXPlUCLxP2Xaq16jC Ef4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yKIabKy8Ujh0kQ/uW3RVLX3p2wSYQC+7wg5wsnfok+w=; b=CUN1Zwmh+mPzq3Fz9TMoLqzkEXU5XB5KG83QsuHf+H9VDhuzLRA17zus4mcmKIswCY BNqGP7j7M1IncGS+px9j9mBrhY7tyLOv8piPYd6krEHYykRLL4rFQeademCfDi+kNKF9 0pPfjyLrnOeC4mlK0X4jElWlpdgZohBw0s3oaUJeCXyM/g52LSdC240kHi9tanOFpr+T hdG4tgOrPeqZ1wZewCAWv82Ott0bWvnSVO4tbWg0SDtk/rI9z5WA1pwZAtT/V3hbp8GA zYDZCkCUmVlMXU8VhqGnoyjGukrULknWkXFs0Qz9JvpPT5Z4AnwWf2WM6pYupRPg7OoE LMbg== X-Gm-Message-State: AOAM5306l9ee8o9B/noLaLu5u/UUP8H/kzFA0+kFDsGaP5A4JLmIooEe wPBs5slFT5l1JRcd8qbLBdtGX0cf6OtXh49My6749sUG X-Received: by 2002:a17:906:6bcd:b0:6e8:93e4:b37f with SMTP id t13-20020a1709066bcd00b006e893e4b37fmr7570825ejs.529.1649753772531; Tue, 12 Apr 2022 01:56:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fariya F Date: Tue, 12 Apr 2022 14:26:01 +0530 Message-ID: Subject: Re: df returns incorrect size of partition due to huge overhead block count in ext4 partition To: "Theodore Ts'o" Cc: linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The e2fsprogs version is 1.42.99. The exact version of df utility when I query is 8.25. The Linux kernel is 4.9.31. Please note the e2fsprogs ipk file was available as part of Arago distribution for the ARM processor I use. From your email I understand that below are the options as of now: a) Fix in the fsck tool and kernel fix: This is something I am looking forward to. Could you please help prioritize it? b) Recalculating overhead at mount time: Is it possible to do it with some specific options at mount time. I still think option #a is what works best for us. c) Enabling metadata checksum: May not be possible for us at the moment. Thanks a lot for all your help, Ted. Appreciate if you could prioritize the fix. On Tue, Mar 29, 2022 at 6:38 PM Theodore Ts'o wrote: > > (Removing linux-fsdevel from the cc list since this is an ext4 > specific issue.) > > On Mon, Mar 28, 2022 at 09:38:18PM +0530, Fariya F wrote: > > Hi Ted, > > > > Thanks for the response. Really appreciate it. Some questions: > > > > a) This issue is observed on one of the customer board and hence a fix > > is a must for us or at least I will need to do a work-around so other > > customer boards do not face this issue. As I mentioned my script > > relies on df -h output of used percentage. In the case of the board > > reporting 16Z of used space and size, the available space is somehow > > reported correctly. Should my script rely on available space and not > > on the used space% output of df. Will that be a reliable work-around? > > Do you see any issue in using the partition from then or some where > > down the line the overhead blocks number would create a problem and my > > partition would end up misbehaving or any sort of data loss could > > occur? Data loss would be a concern for us. Please guide. > > I'm guessing that the problem was caused by a bit-flip in the > superblock, so it was just a matter of hardware error. What version > of e2fsprogs are using, and did you have metadata checksum (meta_csum) > feature enabled? Depending on where the bit-flip happened --- e.g., > whether it was in memory and then superblock was written out, or on > the eMMC or other storage device --- if the metadata checksum feature > caught the superblock error, it would have detected the issue, and > while it would have required a manual fsck to fix it, at that point it > would have fallen back to use the backup superblock version. > > > b) Any other suggestions of a work-around so even if the overhead > > blocks reports more blocks than actual blocks on the partition, i am > > able to use the partition reliably or do you think it would be a > > better suggestion to wait for the fix in e2fsprogs? > > > > I think apart from the fix in e2fsprogs tool, a kernel fix is also > > required, wherein it performs check that the overhead blocks should > > not be greater than the actual blocks on the partition. > > Yes, we can certainly have the kernel check to see if the overhead > value is completely insane, and if so, recalculate it (even though it > would slow down the mount). > > Another thing we could do is to always recaluclate the overhead amount > if the file system is smaller than some arbitrary size, on the theory > that (a) for small file systems, the increased time to mount the file > system will not be noticeable, and (b) embedded and mobile devices are > often where "cost optimized" (my polite way of saying crappy quality > to save a pentty or two in Bill of Materials costs) are most likely, > and so those are where bit flips are more likely. > > Cheers, > > - Ted