Re: how to overwrite the content of a file

2010-11-12 Thread Matthias Apitz
El día Thursday, November 11, 2010 a las 02:16:33PM -0600, Adam Vande More 
escribió:

  What is the best method to overwrite the blocks of a given file with
  bytes of 0x00, i.e. not to O_TRUNC away the blocks to the freelist of the
  file system, but overwrite the old blocks?
 
...
 
 Well there is rm -P although I'm not sure that accomplished exactly what
 you are looking for.

Yes, thanks. This is exactly what I need.

matthias
 
 -- 
 Adam Vande More

-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how to overwrite the content of a file

2010-11-12 Thread Wojciech Puchar

dd if=/dev/zero of=file seek=x count=y bs=z conv=notrunc

will overwrite y blocks of z size beginning from block x

On Thu, 11 Nov 2010, Matthias Apitz wrote:



Hello,

What is the best method to overwrite the blocks of a given file with
bytes of 0x00, i.e. not to O_TRUNC away the blocks to the freelist of the
file system, but overwrite the old blocks?

I've checked

$ dd if=/dev/zero of=file count=4

but dd(1) opens the file with O_RDWR|O_CREAT|O_TRUNC which for sure will
give away the old blocks and adquire new blocks. Any idea?

The background of the question is that I want to make sure, that certain
content is not placed into a dump of the file system before give away
the output of the dump(8).

Thanks

matthias
--
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


how to overwrite the content of a file

2010-11-11 Thread Matthias Apitz

Hello,

What is the best method to overwrite the blocks of a given file with
bytes of 0x00, i.e. not to O_TRUNC away the blocks to the freelist of the
file system, but overwrite the old blocks?

I've checked

$ dd if=/dev/zero of=file count=4

but dd(1) opens the file with O_RDWR|O_CREAT|O_TRUNC which for sure will
give away the old blocks and adquire new blocks. Any idea?

The background of the question is that I want to make sure, that certain
content is not placed into a dump of the file system before give away
the output of the dump(8).

Thanks

matthias
-- 
Matthias Apitz
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e g...@unixarea.de - w http://www.unixarea.de/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how to overwrite the content of a file

2010-11-11 Thread Dan Nelson
In the last episode (Nov 11), Matthias Apitz said:
 What is the best method to overwrite the blocks of a given file with bytes
 of 0x00, i.e.  not to O_TRUNC away the blocks to the freelist of the file
 system, but overwrite the old blocks?
 
 I've checked
 
 $ dd if=/dev/zero of=file count=4
 
 but dd(1) opens the file with O_RDWR|O_CREAT|O_TRUNC which for sure will
 give away the old blocks and adquire new blocks.  Any idea?

conv=notrunc

(note that this will only help with ufs; zfs is always copy-on-write, so
newly-written data never overwrites the old blocks)

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: how to overwrite the content of a file

2010-11-11 Thread Adam Vande More
On Thu, Nov 11, 2010 at 2:02 PM, Matthias Apitz g...@unixarea.de wrote:

 What is the best method to overwrite the blocks of a given file with
 bytes of 0x00, i.e. not to O_TRUNC away the blocks to the freelist of the
 file system, but overwrite the old blocks?

 I've checked

 $ dd if=/dev/zero of=file count=4

 but dd(1) opens the file with O_RDWR|O_CREAT|O_TRUNC which for sure will
 give away the old blocks and adquire new blocks. Any idea?


Well there is rm -P although I'm not sure that accomplished exactly what
you are looking for.

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org