lkml.org 
[lkml]   [2000]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
  Hi!

On Sat, 2 Dec 2000, Adam wrote:
> It seems you are right. If I remove the file first, then it will show
> correct amount.

(For the list: In private mail it was discovered that this behaviour was
caused by the file 'holed.file' not being empty before the dd command.)

dd behaves here correctly. It does not append to file, but it just
opens the file for writing. It does not remove or truncate it first.

If you have executed this command:

dd if=/dev/zero of=holed.file bs=1000 count=1000

You have a simple file with zeroes, like this:

'000000000'

Then with this command dd opens the file for write but does not destroy
its contents - it is not supposed to do that. (You can alter files with
dd, you can overwrite single bytes if you like.)

dd if=/dev/zero of=holed.file bs=1000 seek=5000 count=1000

After opening the file dd seeks to what you specify, and at the same time
extends the file by seeking and Linux converts this to holes:

'000000000-----------------------------------------'

And after seeking it writes the new block of zeroes:

'000000000-----------------------------------------000000000'

..and you have 2MB of stuff there instead of 1M!

Yours,
Jaakko

--
Weather Service Finland Ltd Jaakko.Hyvatti@weather.fi
Pursimiehenkatu 29-31 B, FIN-00150 Helsinki, Finland http://www.weather.fi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:51    [W:0.024 / U:3.284 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site