
There is a new tool in libguestfs ≥ 1.15.17: virt-format lets you erase disks and make blank disks.
Usage is quite simple:
$ virt-format -a disk.img
(Note that erases any data on disk.img
!)
This works for any format of disk, eg. qcow2, or you can run it on host partitions, LVs, USB storage etc. By default it just creates a partition, but using other options you can make empty filesystems and logical volumes.
This is a simple tool that doesn’t cover everything you might want to do. For more complex requirements, see virt-make-fs or guestfish.
