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

Wanlong Gao wanlong.gao at gmail.com
Thu Feb 9 15:34:43 UTC 2012


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.

Then, I also considered about just using libblkid's api to implement this api,
guestfs_wipefs or guestfs_zero, but I looked into util-linux and found
that the blkid_do_wipe() was introduced recently, not for long, and it may
not be in RHEL5, so, I just used the wipefs(8) to do this thing.

Here, if you like to change guestfs_zero's internal to use wipefs, I'd like
to do it, too. ;-P

Thanks
-Wanlong Gao

> 
> Rich.
> 





More information about the Libguestfs mailing list