Subject: Re: Disk wipe out utility for NetBSD
To: Bang Jun-Young <junyoung@mogua.com>
From: Ross Patterson <Ross.Patterson@CatchFS.Com>
List: netbsd-users
Date: 08/02/2004 09:28:57
On Sunday 01 August 2004 11:06 pm, Steven M. Bellovin wrote:
> In message <200408021146.14474.junyoung@mogua.com>, Bang Jun-Young writes:
> >Is there a disk wipe out utility for NetBSD, a program that fills
> >unused blocks of the file system with 0 without destroying data?
>
> I haven't seen one, but it would be very easy to write a simple one --
> create a file, and go into a loop writing a zero byte every 512 bytes.
> In fact, if you want to go through the file system instead of writing
> to the raw disk it's hard to see how to make it any better.

We run NetBSD under VMware, and VMware's virtual disks don't store all-zero 
blocks.  So we often do exactly this, and often just before a backup of the 
VMware system to reduce its size (because there's more than just block-data 
in a "disk block" in this environment).  It's as simple as:

	su
	dd if=/dev/zero of=x
	rm x
-- 
Ross A. Patterson
Chief Technology Officer
CatchFIRE Systems, Inc.
(703) 582-9817