[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH v3 1/2] NEW API: add a new api wipefs

On Thu, Feb 09, 2012 at 11:34:43PM +0800, Wanlong Gao wrote:
> On 02/09/2012 10:12 PM, Richard W.M. Jones wrote:
> > On Wed, Feb 08, 2012 at 01:32:47PM +0800, Wanlong Gao wrote:
> >> Add the new api wipefs to erase the filesystem signatures
> >> on a device but now erase any data.
> > 
> > Having had a bit of time to think about this, I think this comment is
> > right:
> > 
> >> -guestfs_zero should use wipefs.  See wipefs(8).
> > 
> > wipefs is generally better (than "zero") in that it knows about what's
> > on the disk (via blkid) and only overwrites the minimum necessary to
> > remove partition tables, RAID signatures etc.  This is good.
> > 
> > What's bad is that: (1) It probably doesn't work for formats that
> > blkid doesn't understand.  (2) It doesn't preserve sparseness,
> > although arguably that doesn't matter because it's only overwriting
> > stuff that should be non-zero already.
> > 
> > Cf: libblkid/src/probe.c:blkid_do_wipe
> >     daemon/zero.c:do_zero
> > 
> > On balance, I think that changing guestfs_zero to use wipefs is a
> > better way to approach this, but I'm open to opinions on this ...
> Yeah, I also considered about this, since wipefs can't erase the partition
> table, but guestfs_zero does, so, I'm afraid that if I use wipefs(8) to
> change the internal of guestfs_zero, the function also changed.

Right, I see.

It sounds like a new wipefs API is the way to go in that case.

However, it needs to be in an optional group.  Just add [Optional "wipefs"]
to the flags field in generator/generator_actions.ml, and add a
function called optgroup_wipefs_available(), and everything else
should be generated automatically.  See existing optgroup_*_available
functions for examples.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]