[lkml]   [2000]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread

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:


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:


And after seeking it writes the new block of zeroes:


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


Weather Service Finland Ltd
Pursimiehenkatu 29-31 B, FIN-00150 Helsinki, Finland

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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