Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 2014 14:07:45 +0100
From:      Matthew Seaman <matthew@freebsd.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: huge difference between du and df  - no open file descriptors
Message-ID:  <53D8EE21.8020109@freebsd.org>
In-Reply-To: <20140730142609.1ac2bdc9@azubix.tec.work>
References:  <20140730142609.1ac2bdc9@azubix.tec.work>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--JQSonEARSFqKmJcDblCs0M72nGUCLa7GU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 07/30/14 13:26, Nils Effenberger wrote:
> du and df are showing signifcantly different values on our storage
> system:
>=20
> [root@zhoernchen ~]# df -h /
> Filesystem          Size    Used   Avail Capacity Mounted on =20
> /dev/mirror/root    4.8G    4.1G   336M  93%    /=20
> [root@zhoernchen ~]# du -shx /=20
> 2.3G    /
>=20
> root@zhoernchen:~ # gpart show=20
> =3D>      34  97696301  ada0  GPT  (47G)
>         34       128     1  freebsd-boot  (64K)
>        162  10485760     2  freebsd-ufs  (5.0G)
>   10485922  10485760     3  freebsd-zfs  (5.0G)
>   20971682  76724653     4  freebsd-zfs  (37G)
>=20
> =3D>      34  97696301  ada1  GPT  (47G)
>         34       128     1  freebsd-boot  (64K)
>        162  10485760     2  freebsd-ufs  (5.0G)
>   10485922  10485760     3  freebsd-zfs  (5.0G)
>   20971682  76724653     4  freebsd-zfs  (37G)
>=20
> (The zfs partitions are zil and l2arc of the zpool on HDDs)
>=20
> My first thought was that this was due to open file descriptors but I
> could'nt find anything relevant with fstat.
> To be absolutely shure I rebooted (fortunately the system isn't
> productive yet) but that didn't help either.
>=20
> To enshure that I was using fstat correctly (I'm not that familiar with=

> FreeBSD) I created a file of ~350MB, opened it with less, deleted it
> while opened, was able to find it with fstat, closed less and found the=

> system in following state:
>=20
> root@zhoernchen:~ # du -shx /
> 2.2G    /
> root@zhoernchen:~ # df -h /
> Filesystem          Size    Used   Avail Capacity  Mounted on
> /dev/mirror/root    4.8G    4.5G    -13M   100%    /
>=20
> Could someone explain this and how I get that fixed?

One other way of using up space in a partition without it showing up in
du(1) is to have files hidden underneath the mount points for other
filesystems.  So you've got a 5GB UFS partition and a ZFS pool somewhere
-- if you have (say) a file /mnt/big-file on the root and then you mount
another filesystem (eg. ZFS) on top of /mnt you'll hide that file from
du(1), but it will still be using space on the root partition and show
up in df(1) output.

The only way to find this sort of thing is to unmount those other
filesystems and look at what exists under the mount point.

You can also use up space invisibly by creating snapshots -- see
mksnap_ffs(8) and snapinfo(8).

	Cheers,

	Matthew



--JQSonEARSFqKmJcDblCs0M72nGUCLa7GU
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJ8BAEBCgBmBQJT2O4oXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxOUYxNTRFQ0JGMTEyRTUwNTQ0RTNGMzAw
MDUxM0YxMEUwQTlFNEU3AAoJEABRPxDgqeTn1L0P/AgQWdrThTQJt+Go/vjUqizf
1bFdbiRjnSYvs0Zje/nlOSSCg8jljMH67comY09iD+uopuAENpx5bD7PtYe1bfEa
hEJ1aqAlf0ceYHSMA5SEjKHAeDlqBGQEieGDCVD1zV6nhSLEe3xoxyJDxg5AX9l3
258lsOjt3liaWJl+Z1SsjxbWhe/6H7aCYRBMh4pwxSm0d4R1jpzB2uk86n08Dtef
AJXvd9Z1LLqNsrOQ31NTkWbIpmQAuA9fXuZ7XCA7Sg5IxuQbCk2OXEYTHyj9zRDn
991xc6tPjRp6UiEkimhWXtiroOANj8D5sIQve5MWHED7kpOh858GpvBH5E+Gf6c5
a5++Zfdlo3urz392n4nufSSwz7WZ9WNMtYOovk3hYj9JdcMABbDnukmoU3bnwlrp
I8Wl0ENgyVt55oFbhrjJnaj1Kucf8HeMX47358HU6dHT1ZZhHMLf0fGLm2C60OQH
RvGuLPWsBkdnYlzcnylovAD34eqIU1F2VGKzNeN1RoGLBd35pZX3IcMJH95hgjNc
Y1rVave5T2uAu+KoB0Xg7XhUAc95pyjJBk0RhZRF6IcZ4JFjvkqOnSPC2ZLW0sFA
9QNXskDPwKSJSYTvkSkyP66Y2cCNDgjt8GpSBDHn9E6QnUZgacdypzLk6YzySJfL
WF0nZ6EjySM7FR481lOX
=aBcp
-----END PGP SIGNATURE-----

--JQSonEARSFqKmJcDblCs0M72nGUCLa7GU--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53D8EE21.8020109>