jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) (08/07/90)
I noticed some strange behavior with "df" depending on whether it is run
by root or a regular user.
When run by root, df prints out the WRONG amount of free blocks... when run
by a regular-dude, then the free block count os correct. When root runs, df
adds back in the 10% that is used by the BSD file-system. This gives erroneous
information, since (as far as I know) this space is NOT available for file
storage...
--
=======================================================================
#include <std/disclaimer.h>
=:^)
Jim Jagielski NASA/GSFC, Code 711.1
jim@jagmac2.gsfc.nasa.gov Greenbelt, MD 20771
"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
the very, very top, and then it tends to slope away rather sharply."jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) (08/07/90)
Maybe I should make myself a wee-bit clearer. The behavior IS to be expected
if you know how BSD file-systems work. There is 10% disk space that is not
available for USER storage (in other words, for users, 10% of the disk is
already claimed and can't be used). This does not hold for the system in
general.
Just remember to use "User-df" to see what the user would have available
when monitoring disk usage...
There... hope that's better!
--
=======================================================================
#include <std/disclaimer.h>
=:^)
Jim Jagielski NASA/GSFC, Code 711.1
jim@jagmac2.gsfc.nasa.gov Greenbelt, MD 20771
"Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach
the very, very top, and then it tends to slope away rather sharply."thad@cup.portal.com (Thad P Floryan) (08/07/90)
All this banter about ``df'' is interesting. You're probably better off,
though, writing your own (for A/UX) or retrieving a freely-redistributable
or PD one from one of the comp.sources.* archive sites.
Conspicuous by its absence is a reply to my question last week whether A/UX
has passed any version of SVVS (System V Validation Suite).
In light of how "simple" programs I've just ported over break, it would seem
to me that A/UX has NOT passed any SVVS. Let's just take as a for-instance
the ``df'' program and a shell script I wrote aeons ago that has worked on
EVERY, repeat, every, UNIX box except for A/UX. The systems I've tested
include my own 3B1's (SysV), HP-UX (various versions), UTS (Amdahl), Sequent,
Motorola, Convergent, etc etc etc
First the shell script:
ksh 203/206> cat /usr/local/bin/diskfree
#
set `df`
while [ "$1" != "" ]
do
echo "\"$2 MBytes free = \"; scale=5; ($3 * 512)/1000000" | bc
shift;shift;shift;shift;shift;shift
done
exit 0
#
ksh 203/206>
Now let's see it run on various systems:
****************
AT&T 3B1 Systems
================
ksh 203/206> date
Mon Aug 6 22:08:41 PDT 1990
ksh 203/206> df
/ (/dev/fp002): 8080 blocks 10683 i-nodes
ksh 203/206> diskfree
(/dev/fp002): MBytes free = 4.13696
ksh 203/206> slogin thadlabs
Establishing connection to thadlabs ... Connected.
Welcome to ThadLABS System #2, AT&T UNIX System V, Release 3.51a
Please login: thad
Password:
Please type the terminal name and press RETURN: dt80
2% of the storage space is available.
Last login Mon 6-Aug-90 21:27:33
ksh 7123/7124> df
/ (/dev/fp002): 3372 blocks 9426 i-nodes
ksh 7123/7124> diskfree
(/dev/fp002): MBytes free = 1.72646
ksh 7123/7124> exit
Node thadlabs: StarLAN Disconnected.
ksh 203/206>
**********************
a big HP-UX HP9000-855
======================
ksh 1/14123> date
Mon Aug 6 21:27:30 PDT 1990
ksh 1/14123> df
/logs (/dev/dsk/c5d0s2): 198002 blocks 184281 i-nodes
/usr/spool/notes (/dev/dsk/c2000d0s8): 214510 blocks 112845 i-nodes
/usr/spool (/dev/dsk/c2d0s10): 49700 blocks 51822 i-nodes
/usr/local (/dev/dsk/c3d0s9): 32144 blocks 64016 i-nodes
/usr (/dev/dsk/c0d0s11): 21406 blocks 124662 i-nodes
/users (/dev/dsk/c1d0s2): 47194 blocks 156327 i-nodes
/users2 (/dev/dsk/c2d0s9): 40758 blocks 63996 i-nodes
/scratch (/dev/dsk/c2d0s7): 40972 blocks 31918 i-nodes
/users3 (/dev/dsk/c3d0s10): 78260 blocks 49930 i-nodes
/libraries (/dev/dsk/c3d0s7): 59338 blocks 29939 i-nodes
/users4 (/dev/dsk/c2000d0s10): 43994 blocks 37030 i-nodes
/tmp (/dev/dsk/c2d0s3): 48876 blocks 13872 i-nodes
/ (/dev/dsk/c0d0s0): 1386 blocks 8301 i-nodes
ksh 1/14123> diskfree
(/dev/dsk/c5d0s2): Mbytes free = 101.37702
(/dev/dsk/c2000d0s8): Mbytes free = 109.82912
(/dev/dsk/c2d0s10): Mbytes free = 25.44640
(/dev/dsk/c3d0s9): Mbytes free = 16.45772
(/dev/dsk/c0d0s11): Mbytes free = 10.95987
(/dev/dsk/c1d0s2): Mbytes free = 24.16332
(/dev/dsk/c2d0s9): Mbytes free = 20.86809
(/dev/dsk/c2d0s7): Mbytes free = 20.97766
(/dev/dsk/c3d0s10): Mbytes free = 40.06912
(/dev/dsk/c3d0s7): Mbytes free = 30.38105
(/dev/dsk/c2000d0s10): Mbytes free = 22.52492
(/dev/dsk/c2d0s3): Mbytes free = 25.02451
(/dev/dsk/c0d0s0): Mbytes free = 0.70963
ksh 1/14123>
********************
a smaller HP9000-355
====================
ksh 15216/15217> date
Mon Aug 06 21:32:34 PDT 1990
ksh 15216/15217> df
/users (/dev/dsk/1s0): 2810 blocks 13919 i-nodes
/ (/dev/dsk/0s0): 10942 blocks 42969 i-nodes
ksh 15216/15217> diskfree
(/dev/dsk/1s0): Mbytes free = 1.43872
(/dev/dsk/0s0): Mbytes free = 5.60230
ksh 15216/15217>
**********************
and now one of my A/UX
======================
ksh 1/260> date
Mon Aug 6 22:10:33 PDT 1990
ksh 1/260> df
/ /dev/dsk/c0d0s0 27252 blocks 9704 i-nodes
/users/accent/dev/dsk/c4d0s0 150852 blocks 23608 i-nodes
ksh 1/260> diskfree
/dev/dsk/c0d0s0 MBytes free = 13.95302
150852 MBytes free = syntax error on line 1, teletype
diskfree[5]: shift: bad number
ksh 1/260>
WHY isn't there some white-space between "/users/accent" and "/dev/dsk/c4d0s0"?
Sheesh.
BTW, my A/UX 2.0 stuff arrived today; not bad, one week from date of order.
Also BTW, my Apple Developer's Handbook arrived today, too. Hmmm, who in their
right mind is gonna pay $25/hour for AppleLink? That same $25 buys me 2.5
months on PORTAL, NetCom or brt.com (any time of day, any session duration,
any baud up to 19.2K) with full access to the world Usenet community.
Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]justin@Apple.COM (Justin Walker) (08/07/90)
In article <3022@dftsrv.gsfc.nasa.gov> jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) writes: > ... >When run by root, df prints out the WRONG amount of free blocks... when run >by a regular-dude, then the free block count os correct. When root runs, df >adds back in the 10% that is used by the BSD file-system. This gives erroneous >information, since (as far as I know) this space is NOT available for file >storage... I believe that for BSD file systems, the kernel reserves 10% of the total block count for "root usage", so that regular-dudes cannot snarf up all the file system for their own nefarious uses (e.g., cat * > foo) and fowl up the system. The space is available for file storage, but only for root's use. This is not the case for SVFS types, where you regular-dudes can gobble to your hearts' content. > Jim Jagielski NASA/GSFC, Code 711.1 > jim@jagmac2.gsfc.nasa.gov Greenbelt, MD 20771 Regards, Justin Justin C. Walker, Curmudgeon-At-Large (justin@apple.com) * A/UX Group *------------------| Apple Computer, Inc. | When meetings are outlawed, 10440 Bubb Rd, | Only outlaws will have meetings Cupertino, CA 95014 * -- Justin C. Walker, Curmudgeon-At-Large (justin@apple.com) * A/UX Group *------------------| Apple Computer, Inc. | When meetings are outlawed, 10440 Bubb Rd, | Only outlaws will have meetings Cupertino, CA 95014 *