Re: Blocks verses Bytes,Mbytes etc

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

 



Hi Harry

On Wed, 2003-04-30 at 10:13, Harry Putnam wrote:
> Is there an even handed way to convert BLOCKS into Bytes?

SHORT ANSWER
On a GNU/Linux system, a block is 1024 bytes.  Multiply the number of
blocks by 1024 to find the number of bytes.

LONG ANSWER
On most Unix systems, a block in 512 bytes.  On GNU-style systems, a
block is 1024 bytes.  The output you provide suggests your system uses
1024 byte blocks.  The other person who replied to this message seems to
have incorrectly assumed 512 byte blocks.

1024 bytes is a "binary kilobyte".  The IEEE calls these "kibibytes",
and uses the symbol "KiB".  A lot of other people who are not concerned
about the difference between 1000 bytes and 1024 bytes call these
"kilobytes", and use the symbol "KB".

To find the number of bytes, multiply the number of blocks by 1024. 
What you probably wanted, however, is to find the number of binary
megabytes or binary gigabytes.  To find the number of binary megabytes,
simply divide the number of blocks by 1024.  To find the number of
binary gigabytes, simply divide the number of blocks by 1024^2 =
1024*1024 = 1048576.

If we take hda5 as an example, it is 1542208 blocks in size.  To find
the size in binary gigabutes, we divide by 1024^2, to get 1.47 GiB. 
Your "df -h" output suggests hda5 is 1.4 GiB.  The rounding performed by
df as well as the small amount of disk space reserved for system use
will probably account for this difference.

I hope this answers your question.

-- 
Michael Wardle <michael.wardle@xxxxxxxxxx>
Adacel Technologies





[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux