how to overwrite the content of a file
Dan Nelson
dnelson at allantgroup.com
Thu Nov 11 20:09:05 UTC 2010
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
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list