From nobody Mon Mar 06 05:41:50 2023 X-Original-To: freebsd-fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PVSBr0CFnz3wSMX for ; Mon, 6 Mar 2023 05:42:12 +0000 (UTC) (envelope-from woodsb02@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PVSBq5NGDz3kLh for ; Mon, 6 Mar 2023 05:42:11 +0000 (UTC) (envelope-from woodsb02@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678081331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Gh99rlALqAJFsKYzXk/h7nhxCGDruqT2wYmkM+wfbHU=; b=h7WE/uN9a4uzhxpLlzW8IY4S4pG89cUl9VRY7S8I/emr4CTSCwbkpj2qJfv8Jm7QDrUDle ETma7W7KBBO+GYo2bBGpnbF7Z21/5qZjmVbw7rsgaFPQHq9L1mB9n7Pl9/eW6xExrao5tJ cWQr6xzXyzVIZOUmTFzbYi5JTVrB4zyNICEjpPnCrtMDkd2tazg3Qp7/Cz9onAvYPJyrWU 0yJ8SMm2ZZMpPgonHLAaaWSbQFeSYfeZhybIN6Ko7cy5qj/UWuo2EmbLsgmyFEtGyV9klA nTYMh1pALChVv84pv433T/bOj+aoX8xNKtvMDSus8l3jqiQfQgDBOh7AO4hSrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678081331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Gh99rlALqAJFsKYzXk/h7nhxCGDruqT2wYmkM+wfbHU=; b=jzvC2ao3B0/JDBTYgxUxTPolfhDcff3S0pnqs2/22BJCXCNT/tZhZ2MzuAxYCYsMhdnIbH AfUeaQAvgq89xT8SN7kf5YfHgICpwvjJ8XI+KGgmf/F8kqMxvcJL36WNmbEhpBrWYCSKUT C/THU5jgTDzhHaJQR+TRmlHjNjdiFd2CvAudCE93p1mJ7kU86UnfVHaTqPAH24McDP4T/U peGL+hL5wn8ZPOtTTcosbkhREaD8uH0+2RRfV1upbz4yDKGWlV2CsnX06AgMhPsaVRZvwI nOXmovNJJY6LZ0Atdl/RI4UEej3JuxMGsjjKlixwCRIwztmTI+x1DZtY3rkNLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678081331; a=rsa-sha256; cv=none; b=byLB7lF+/pSoCzt5qX4EZAjtORpaWmsP1Zayx9cm1/8uaWX9sSpazF2tYbSs/0sSR71d+6 puitXF4R/udsNpMDwiTe79FV3RmCTJIlDjYqomG/VgxoEkp+OKnqRARBMJ+5EurlneeR7T 9JOHbXrx2UjrvMFBxaLyQ4fiBwWwgZgOKH2bFzreyywO9hWXtKm2gRkyZ9BYu2Et6+UVHv A65nIuoojbBL1zptGQiDJAPtL2qRq252ZQHNiaS1QuBeEqVLZKswv8azquOOGt4rnZ30hk 4BkXBSfj3MRgNrGE+0UUYtrQg/RpJYCggP+BsKR84y3DI6Koelwh4PyT9o6A9A== Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: woodsb02) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PVSBq4QRPzwr4 for ; Mon, 6 Mar 2023 05:42:11 +0000 (UTC) (envelope-from woodsb02@freebsd.org) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id E88ED27C0054 for ; Mon, 6 Mar 2023 00:42:10 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute1.internal (MEProxy); Mon, 06 Mar 2023 00:42:10 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddthedgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsehttdertd erredtnecuhfhrohhmpedfuegvnhcuhghoohgushdfuceofihoohgushgstddvsehfrhgv vggsshgurdhorhhgqeenucggtffrrghtthgvrhhnpeeiffeuhfeukeejvddttdfhkeehie dthedtleegveetfffhueeutdfgledvteejteenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegsvghnodhmvghsmhhtphgruhhthhhpvghrshhonh grlhhithihqddutdelfeeiiedvkeekqddvgeejkedvvdektddqfihoohgushgstddvpeep fhhrvggvsghsugdrohhrghesfihoohgushdrrghm X-ME-Proxy: Feedback-ID: if9c9472a:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id ABBB62A20080; Mon, 6 Mar 2023 00:42:10 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5 List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org Mime-Version: 1.0 Message-Id: <504ffe37-524a-4218-82e6-93459ef4b528@app.fastmail.com> Date: Mon, 06 Mar 2023 05:41:50 +0000 From: "Ben Woods" To: freebsd-fs@freebsd.org Subject: FAT32 statfs(2) inode usage Content-Type: text/plain X-ThisMailContainsUnwantedMimeParts: N Hi Everyone, I'm using Netdata to monitor my FreeBSD systems, and it is reporting critical alerts that my UEFI system partition has run out of available inodes. Investigating a bit further, I realised that the FreeBSD df(1) utility is reporting the same, meaning this is a FreeBSD bug rather than a Netdata bug. $ df -i /boot/efi Filesystem 512-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/nvd0p1 532352 3680 528672 1% 512 0 100% /boot/efi It looks like this stems from the following section of the msdosfs(5) driver code sys/fs/msdosfs/msdosfs_vfsops.c: ---------------------------- static int msdosfs_statfs(struct mount *mp, struct statfs *sbp) { struct msdosfsmount *pmp; pmp = VFSTOMSDOSFS(mp); sbp->f_bsize = pmp->pm_bpcluster; sbp->f_iosize = pmp->pm_bpcluster; sbp->f_blocks = pmp->pm_maxcluster + 1; sbp->f_bfree = pmp->pm_freeclustercount; sbp->f_bavail = pmp->pm_freeclustercount; sbp->f_files = pmp->pm_RootDirEnts; /* XXX */ sbp->f_ffree = 0; /* what to put in here? */ return (0); } ---------------------------- I think it might be more correct for msdosfs_vfsops.c to set the f_files variable to 0. Thoughts on this change? This would then cause the following df(1) code to report iused% as "-" rather than "100%": ---------------------------- inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; ... if (inodes == 0) xo_emit(" {:inodes-used-percent/ -}{U:} "); else { xo_emit(" {:inodes-used-percent/%4.0f}{U:%%} ", (double)used / (double)inodes * 100.0); } ---------------------------- This would then give an df(1) output which is consistent with GNU/Linux - see below test results from Debian 11: # df -i /mnt/fat32 Filesystem Inodes IUsed IFree IUse% Mounted on /dev/vdb1 0 0 0 - /mnt/fat32 Regards, Ben -- From: Ben Woods woodsb02@freebsd.org