[X-Unix] re: quotas - My math stinks!

Eric F Crist ecrist at secure-computing.net
Thu Jan 8 19:35:46 PST 2009


Now that I'm off my blackberry... ;)

According to DU(1):
      BLOCKSIZE  If the environment variable BLOCKSIZE is set, and the  
-k option is not specified, the block
                 counts will be displayed in units of that size  
block.  If BLOCKSIZE is not set, and the -k
                 option is not specified, the block counts will be  
displayed in 512-byte blocks.

This woudl explain why you're number is so far off between repquota  
and du.  KeS is right on the money, but I couldn't elaborate on this  
while I was out and about earlier.  In addition to this, as has been  
said already, there is the math aspect in terms of what a K really is,  
vs Megabyte or Gigabyte.  The typical standard has been that sizes are  
defined as:
1 bit = a 1 or 0
1 byte = 8 bits
1 kilobyte = 1024 bytes
1 kilobit = 1024 bits
1 Megabyte = 1024 kilobytes
1 Megabit = 1024 kilobits
1 Gigabyte = 1024 Megabytes
1 Gigabit = 1024 Megabits
etc...

The odd number for kilobyte has to do with block sizes on drives and  
their relation to binary.  Modern drive manufacturers have further  
confused things by selling drives with a capacity derived multiples of  
1000.  There are class-action lawsuits against some for this practice.  
For example, one that was settled by seagate early last year:

http://apcmag.com/seagate_settles_class_action_cash_back_over_misleading_hard_drive_capacities.htm

Couple this with the misnomer of size output by du, and you've got a  
whole box of crazy.  I generally avoid the confusion with du by  
appending the -h option, or the -k.

On Jan 8, 2009, at 9:03 PM, Kevin Stevens wrote:

> I've deleted the original posts, but my initial take was that the OP  
> may have been wrong in assuming that du is reporting 1K blocks.   
> Unless you feed it a -k parameter, it reports in 512 byte blocks (OS  
> X 10.5), making his comparison off by a factor of two, which seems  
> like the major problem.  Combining that with the 1000/1024  
> conversion difference should make everything even out.
>
> KeS
>
> On Jan 8, 2009, at 18:23, Charles Howse wrote:
>
>> I understand what you're saying, but SHOW ME THE MATH that proves  
>> it, cause I can't make it work.
>> du says 2341624 1k blocks.  2341624 / 1024 / 1000 = 2.2867421875.   
>> Close enough to 2.2G for me.
>> quota says 1040588 / 1024 / 1000 = 1.01619921875.  Not even close!
>> If we use 1000 instead of 1024, then it comes to 1.040588 vs  
>> 2.341624.
>> THEY CAN'T BOTH BE RIGHT, REGARDLESS OF WHETHER THEY'RE USING 1024  
>> OR 1000.
>>
>> Pardon my shouting, emphasis only.  :)
>>
>> On Jan 8, 2009, at 6:31 PM, Eric F Crist wrote:
>>
>>> 1024 is how data is figured. Sometimes, gigs are 1000 megs, which  
>>> are almost always 1024 K
>>> ------Original Message------
>>> From: Charles Howse
>>> Sender: x-unix-bounces at listserver.themacintoshguy.com
>>> To: Eric Crist
>>> To: A place to discuss Mac OS X from the perspective of the  
>>> command line.
>>> ReplyTo: A place to discuss Mac OS X from the perspective of the  
>>> command  line.
>>> Sent: Jan 8, 2009 18:05
>>> Subject: Re: [X-Unix] re: quotas - My math stinks!
>>>
>>>
>>> On Jan 8, 2009, at 3:57 PM, Eric F Crist wrote:
>>>
>>>> Math error. 1024k in a Meg, 1024M in a Gig....
>>>
>>> I'm wondering...
>>> 2000000k / 1024 = 1953.125 M, 1.953125 G which is not equal to  
>>> 2.2GB.
>>>
>>> Doesn't work out.  How did you figure it?
>>>
>>> --
>>> How I make Great Barbecue -
>>> http://bubbabbq.homeunix.net/bbq.html
>>>
>>>
>>>
>>> _______________________________________________
>>> X-Unix mailing list
>>> X-Unix at listserver.themacintoshguy.com
>>> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>>>
>>>
>>> ---
>>> Eric F Crist
>>> Secure Computing Networks
>>> _______________________________________________
>>> X-Unix mailing list
>>> X-Unix at listserver.themacintoshguy.com
>>> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>>
>> --
>> Bubba's Funny Stuff -
>> http://bubbabbq.homeunix.net/humor.html
>>
>>
>>
>> _______________________________________________
>> X-Unix mailing list
>> X-Unix at listserver.themacintoshguy.com
>> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>
> _______________________________________________
> X-Unix mailing list
> X-Unix at listserver.themacintoshguy.com
> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix

---
Eric Crist






More information about the X-Unix mailing list