Date: Thu, 9 Jun 2022 10:23:00 +0200 From: Stefan Esser <se@FreeBSD.org> To: Mark Millard <marklmi@yahoo.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: Any clue why "df -m" vs. "du -xsAm" get such different results for the tmpfs in question (403 MiBytes vs. 101 MiBytes)? Message-ID: <24c79e23-a715-6222-452f-24a9186dce89@FreeBSD.org> In-Reply-To: <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325@yahoo.com> References: <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325.ref@yahoo.com> <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------zwlWQj06LewrfD4iZ0BQH2h4 Content-Type: multipart/mixed; boundary="------------YGsBCTzS0SSPbzwlEvB9UgVy"; protected-headers="v1" From: Stefan Esser <se@FreeBSD.org> To: Mark Millard <marklmi@yahoo.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Message-ID: <24c79e23-a715-6222-452f-24a9186dce89@FreeBSD.org> Subject: Re: Any clue why "df -m" vs. "du -xsAm" get such different results for the tmpfs in question (403 MiBytes vs. 101 MiBytes)? References: <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325.ref@yahoo.com> <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325@yahoo.com> In-Reply-To: <4997AB05-8CD4-4A2C-AAB3-34F6DB2CE325@yahoo.com> --------------YGsBCTzS0SSPbzwlEvB9UgVy Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 08.06.22 um 21:54 schrieb Mark Millard: > # df -m | egrep "(^Filesystem|^tmpfs)" > Filesystem 1M-blocks Used Avail Capacity Mounted on=20 > tmpfs 1024 403 620 39% /usr/local/poudriere/dat= a/.m/main-CA7-bulk_a-default > So the comparison is with the line that lists Used as 403 (MiBytes): > # du -xsAm /usr/local/poudriere/data/.m/main-CA7-bulk_a-default/ref/.p > 101 /usr/local/poudriere/data/.m/main-CA7-bulk_a-default/ref/.p > # du -xsm /usr/local/poudriere/data/.m/main-CA7-bulk_a-default/ref/.p > 68 /usr/local/poudriere/data/.m/main-CA7-bulk_a-default/ref/.p > Why 403 vs. 101 ? Hi Mark, have you checked for unlinked but still open files on that tmpfs? My quick test with /tmp on tmpfs did not show any anomalies: # du -xsm /tmp 730 /tmp # df -m /tmp Filesystem 1M-blocks Used Avail Capacity Mounted on tmpfs 16384 733 15650 4% /tmp I do not know of a simple way to check for blocks allocated by files that are open but have been unlinked, though. (I did not get any usable results from lsof, fstat, and pstat - may be I have missed a tool that grabs that information from the kernel.) The best I could get is this pstat output: se sleep 89643 text / 25349 -r-xr-xr-x 8592 r se sleep 89643 ctty /dev 157 crw--w---- pts/0 rw se sleep 89643 wd /tmp 2 drwxrwxrwt 51584 r se sleep 89643 root / 4 drwxr-xr-x 47 r se sleep 89643 0 /dev 67 crw-rw-rw- null r se sleep 89643 1 - 137245 -rw-r--r-- 5 w se sleep 89643 2 /dev 157 crw--w---- pts/0 rw This is for a sleep with stdout redirected to a file on tmpfs and the file then deleted while the sleep command has it open. As long as it had not been deleted, pstat showed that it resided in /tmp: se sleep 89643 1 /tmp 137245 -rw-r--r-- 5 w But you can compare the number of inodes reported by "df -i ." and the number of files found by "find . | wc". Run these commands as root in order to not miss files that are not accessible to a non-privileged user ... Regards, STefan --------------YGsBCTzS0SSPbzwlEvB9UgVy-- --------------zwlWQj06LewrfD4iZ0BQH2h4 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmKhreQFAwAAAAAACgkQR+u171r99UTQ 3gf+OXnslrRsBkxAngHlTZ89OUNcyWEkvC+fCFvZgq2k8rgOaFbpOkCaohtsgrzB9yWAt0Mgy3IE VhLe5ASIcWAVNKSCuwcY21dKwrmKrcMP2E8Gt795wQmzYSxMwdxfBdWawMea8JI56xbx0ZzIS97a 6EGOQkwH22TqdQx2OfY6Xpr3lhoKEHGrKLJoO7nwqF7OZkBisWN4x1bZKFyBbLHuHINSYyFuR0bm j7xRO8Zsa539yw4Sex/NcODI+pw/aMlQJhnCkUAvDfEhZHo8XH/2p4umG2EASVlKNBzG9UjyRPWB 6KBy4mXpzWCyu6gTgOS10q49c+bCz+2zE/eGJruTFw== =MoN8 -----END PGP SIGNATURE----- --------------zwlWQj06LewrfD4iZ0BQH2h4--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?24c79e23-a715-6222-452f-24a9186dce89>