Subject: Re: Zeroing unused FFS blocks
To: Martti Kuparinen <martti.kuparinen@iki.fi>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: port-xen
Date: 01/25/2008 13:08:19
On Fri, 25 Jan 2008 13:29:37 +0200
Martti Kuparinen <martti.kuparinen@iki.fi> wrote:

> Hi,
> 
> I created a large file (say 10 GB with "dd if=/dev/zero of=filename
> bs=1m count=10k") on my Xen dom0. Then I used this file as a virtual
> hard drive for my NetBSD domU. When the domU is running, it sometimes
> uses almost all the disk space for some temporary files and then
> later removes those files.
> 
> Now, after halting the domU it would be very nice to compress this
> virtual hard drive before storing it on a DVD or moving it to another
> server.
> 
> Is there any way to zero all unused FFS blocks in order to make the
> compressed image smaller?
> 
The easiest thing is to mount the file and copy /dev/zero to some
filename.  When the disk fills up, delete the file... 



		--Steve Bellovin, http://www.cs.columbia.edu/~smb