On 01/17/2012 07:48 PM, Richard W.M. Jones wrote:
Rather than me explaining over again what it does, I've included the man page below.
Rich.
----------------------------------------------------------------------
virt-format(1) Virtualization Support virt-format(1)
NAME virt-format - Erase and make a blank disk
SYNOPSIS virt-format [--options] -a disk.img [-a disk.img ...]
DESCRIPTION Virt-format takes an existing disk file (or it can be a host partition, LV etc), erases all data on it, and formats it as a blank disk. It can optionally create partition tables, empty filesystems, logical volumes and more.
To create a disk containing data, you may be better to use virt-make-fs(1). If you are creating a blank disk to use in guestfish(1), you should instead use the guestfish -N option.
Normal usage would be something like this:
virt-format -a disk.qcow
or this:
virt-format -a /dev/VG/LV
"disk.qcow" or "/dev/VG/LV" must exist already. Any data on these disks will be erased by these commands. These commands will create a single empty MBR partition covering the whole disk, with no filesystem inside it.
Some thoughts: - does it autodetect when disk is too large for MBR and GPT would be needed? - does it align partitions to SSD erase block size? (LVM is particularly tricky to get right manually) - can I specify a backing-file for qemu disks? (qcow, and qed I think) - can --wipe use TRIM on SSDs instead of writing zeroes? - can I setup LVM striping and mirror with it? If the answer is yes to all these then this tool could even be used as a general purpose format tool, not just for virt environments :) Best regards, --Edwin