Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 1998 16:03:25 -0700 (PDT)
From:      David Wolfskill <dhw@whistle.com>
To:        beaupran@JSP.UMontreal.CA
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Misc (was: Re: Creating the filesystem )
Message-ID:  <199807232303.QAA07883@pau-amma.whistle.com>
In-Reply-To: <Pine.BSF.3.96.980723175711.9911A-100000@outpost.nada.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>Date: Thu, 23 Jul 1998 18:06:00 -0400 (EDT)
>From: Spidey <beaupran@JSP.UMontreal.CA>

>I'm now backing up /usr. By curiosity, when I tried to backup my /usr
>using only tar cvf /mnt/usr.tar /usr/. , my df's were showing me the
>progression... At one point the filesystem got full, but the tarring kept
>on going until it was -32Mb of storage left!!! I guess that was my swap
>space that was being swallowed. Is it right? Also, why did it stopped at
>32Mb, and not at 70Mb, the size of my swap?

No; different issue.

"df" shows the amount of space that a "normal" (non-root) user is
allowed to write toe the filesystem.  There is (in the Berkeley FFS, or
"ufs") a percentage of space reserved, that only root is allowed to
write to (because to the extent that space gets used, performance gets
trashed -- not unlike an Ethernet where collisions get excessively
high).

If more space is used than a "normal" user is allowed to allocate, the
"available" column shows a negative number.

>I was wondering if there was an easy way to make a "monitor" that would
>do:

>while true
>	clear
>	df

>I tried, but never got a correct syntax.

Well, this is dependent on which shell you're using.  For csh & tcsh,
for example, this works:

while (1)
clear && df && sleep 5
end

[You'll note that I put a "sleep 5" in there; this provides an
opportunity to read the display before it changes.]

For Bourne shell (sh), the following works:

while true
do
  clear && df && sleep 5
done

I don't recommend csh for scripts, generally.

Of course, you could also use Perl, but that would be a fairly clear
case of "overkill."

>Is there good resource (on the 
>net if possible) for shell-script programming?

I expect so; I don't recall one, but an AltaVista search is likely to
turn up several pages -- probably of varying quality.  :-}

Cheers,
david
-- 
David Wolfskill		UNIX System Administrator
dhw@whistle.com		voice: (650) 577-7158	pager: (650) 371-4621

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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