Linux, it just does not add up!

Today I noticed something very strange on a few Linux machines.

I needed a 10 Mb file to do some bandwidth tests, I would just put it on a web server and download it often. I used dd to create a file that I thought was 10Mb and checked it with du -h:

# dd if=/dev/urandom of=10megfile.dat bs=1024 count=10240
# ls -l 10megfile.dat
-rw-r--r--    1 root     root     10485760 nov  4 16:38 10megfile.dat
# du -h 10megfile.dat
11M     10megfile.dat

So I thought I am going mad since surely du cannot be wrong, I checked with the Google Calculator and it agrees, 10 485 760 bytes does make 10 Mb.

I then checked the same on FreeBSD and it finds it as 10Mb, RedHat 6.2 agrees it is 10Mb but RedHat 7.2 and a number of Mandrake machines thinks it is 11Mb.

I guess I need to have a chat with bug-fileutils@gnu.org

Leave a comment

Recent Entries

  • flashpolicyd 2.0

    I wrote a multi threaded server for Adobe Flash Policy requests, some background from Adobe:Since policy files were first introduced, Flash Player has recognized /crossdomain.xml...

  • Adventures with Ruby

    Some more about my continuing experiences with ruby, in my last post I saidthe language does what you'd expect and as you'll see in my...

  • New programming language of choice - Ruby

    I have fallen out of love with Perl some time ago, I cannot point to one specific thing about it that put me off, I...

  • On working from home

    I've not been posting much here, work has been incredibly manic the last while, especially I need to still finish off my SSO posts with...

  • Rework of puppet facts for /etc/facts.txt

    Previously I blogged a custom fact that reads /etc/facts.txt to build up some custom facts for use in Puppet manifests, well I've since learned a...

Close