[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du -h and df -h disagree on /



On Wed, 08 Dec 2004, Otto Moerbeek wrote:

> 
> 
> On Wed, 8 Dec 2004, Oliver Fuchs wrote:
> 
> > Hi,
> > 
> > I have a question regarding the output of df -h and du -h on my root
> > directory /
> > I am running OpenBSD 3.6 on a shared hardrive with WindowsXP and a second
> > harddrive with FreeBSD.
> > This is my /etc/fstab:
> >  /dev/wd0a / ffs rw,softdep 1 1
> >  /dev/wd0h /home ffs rw,nodev,nosuid,softdep 1 2
> >  /dev/wd0d /tmp ffs rw,nodev,nosuid,softdep 1 2
> >  /dev/wd0g /usr ffs rw,nodev,softdep 1 2
> >  /dev/wd0e /var ffs rw,nodev,nosuid,softdep 1 2
> > 
> > Now running df -h shows me this:
> >  Filesystem    Size   Used  Avail Capacity  Mounted on
> >  /dev/wd0a     194M   142M  42.2M    77%    /
> >  /dev/wd0h     6.3G   196M   5.8G     3%    /home
> >  /dev/wd0d     489M   8.0K   465M     0%    /tmp
> >  /dev/wd0g     9.8G   1.9G   7.4G    21%    /usr
> >  /dev/wd0e     194M  12.3M   172M     7%    /var
> > 
> > So the root directory / on /dev/wd0a is used with 142M of 194M.
> > But I think that this value is incorrect because du -h / shows me this:
> > 196M	./home
> > 10.0K	./tmp
> > 1.9G	./usr
> > 12.3M	./var
> > and for /dev/wd0a:
> > 5.8M	./root
> > 2.0K	./altroot
> > 4.4M	./bin
> > 11.3M	./sbin
> > 34.0K	./dev
> > 5.2M	./etc
> > 4.0K	./mnt
> > 2.0K	./stand
> > 2.0K	./cdrom
> > plus the output of ls -axlh /
> > -rw-r--r--   2 root  wheel   770B Sep 17 19:59 .cshrc
> > -rw-r--r--   2 root  wheel   283B Sep 17 19:59 .profile
> > -rw-r--r--   1 root  wheel   5.1M Nov 28 17:41 bsd
> > -rw-r--r--   1 root  wheel   5.2M Nov 28 17:41 bsd.mp
> > -rw-r--r--   1 root  wheel   4.5M Nov 28 17:41 bsd.rd
> > 
> > So this is round about 50M and not as shown in df 142M
> > for /dev/wd0a.
> > I cannot find the answer to this disagreement but I have to points to made:
> > 1) maybe it is depending on the fstab mount option softdep?
> 
> No.
> 
> > 2) or is it because I copied some files from my FreeBSD harddrive over to
> > OpenBSD and this leeds to the wrong amount of df -h?
> 
> No.
> 
> Two probable causes:
> 
> - some programs have created files that are still open, but removed from 
> the directory. Open files cannot be removed from the filesystem until 
> they are closed, but du(1) will not show them. Use fstat(1) to find which 
> files are open by programs.
> 
> - there are files allocated in directories that are mounted over, like 
> /tmp, /home, /usr and /var. To find these files, boot into single user 
> mode 9with just / mounted) and check the contents of these dirs.
> 
> 	-Otto

Hi Otto,
here is what happened. While trying to find the error I did a mistake and
umounted /var directory with the -f option. So I ended up in powering off my
PC - did not know what to do else. Anyway, the system rebooted and running
fsck on the not clean umounted /dev/wd0a.
The result was this:
 df -h:
  Filesystem    Size   Used  Avail Capacity  Mounted on
  /dev/wd0a     194M  41.6M   143M    23%    /
  /dev/wd0h     6.3G   160M   5.8G     3%    /home
  /dev/wd0d     489M   6.0K   465M     0%    /tmp
  /dev/wd0g     9.8G   1.6G   7.7G    17%    /usr
  /dev/wd0e     194M  12.8M   172M     7%    /var
It seemed that the Used and the Avail values have changed their positions. 
But I am still not sure what caused this behaviour.

Oliver
-- 
... don't touch the bang bang fruit



Visit your host, monkey.org