Re: free space wiper...
From: Kasper Dupont (kasperd@daimi.au.dk)Date: 01/05/02
- Next message: John Thompson: "Re: can i convert from ext3 to ext2 file system ?"
- Previous message: Kasper Dupont: "Re: HACKED ??"
- In reply to: Michael Erskine: "Re: free space wiper..."
- Next in thread: David Malone: "Re: free space wiper..."
- Reply: David Malone: "Re: free space wiper..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: Kasper Dupont <kasperd@daimi.au.dk> Date: Sat, 05 Jan 2002 22:38:08 +0100
Michael Erskine wrote:
>
> dtk@berlin.com (donald) wrote in message news:<e43f4ba.0112220500.579d3cd7@posting.google.com>...
> > I'm looking for some utility that will wipe (overwrite with random
> > data)unused disk space. I tried making a big file that fills my fs but
> > it doesn't seem to work, i can still find old erased data in some
> > blocks. I have standard ext2fs.
> >
> > Thanks for all answers...
>
> This snippet will clear swap by allocating swap one int at a time and
> writing a random value to it until swap is full. The kernel will then
> kill it and swap will be full of randmo values (except that which was
> already allocated at the beginning of the run).
>
> #include <stdio.h>
> #include <stdlib.h>
> int main() {
> int *p;
> while (1) {
> p = calloc(1, sizeof(int));
> *p = rand();
> }
> return 0;
> }
>
> -m-
Probably not the best way to do it.
- You can expect some memory management overhead, so not all of
the memory is overwritten with random data. Most of it is
actually overwritten with management data and possibly also
some zero padding. It would be better to mmap large chunks of
memory and fill them with random bytes.
- The quality of the random bytes produced by rand is not very
good. If you want good quality random bytes /dev/urandom would
be an option.
- You are going to use all free physical memory before you start
swapping. That is probably not desired. I don't know a good
solution to that problem. And when the swap is full you should
not start using physical memory.
- If you have large amounts of swapspace you might run out of
virtual addressspace before you run out of swapspace. That
problem can be solved by having multiple processes filling
buffers at the same time.
And actually sensitive data on swap partitions should be avoided
in the first place. The ml*** syscall could help a little bit
here.
-- Kasper DupontNotice: By sending SPAM (UCE/BCE) to this address, you are accepting and agreeing to our charging a $1000 fee, per email, for handling and processing, and you agree to pay any and all costs for collecting this fee.
- Next message: John Thompson: "Re: can i convert from ext3 to ext2 file system ?"
- Previous message: Kasper Dupont: "Re: HACKED ??"
- In reply to: Michael Erskine: "Re: free space wiper..."
- Next in thread: David Malone: "Re: free space wiper..."
- Reply: David Malone: "Re: free space wiper..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]