virt-format(1) | Virtualization Support | virt-format(1) |
virt-format - Erase and make a blank disk
virt-format [--options] -a disk.img [-a disk.img ...]
Using "virt-format" on live virtual machines, or concurrently with other disk editing tools, can be dangerous, potentially causing disk corruption. The virtual machine must be shut down before you use this command, and disk images must not be edited concurrently.
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 partition covering the whole disk, with no filesystem inside it.
Additional parameters can be used to control the creation of partitions, filesystems, etc. The most commonly used options are:
For more information about these and other options, see "OPTIONS" below.
The format of the disk is normally auto-detected, but you can also force it by using the --format option (q.v.). In situations where you do not trust the existing content of the disk, then it is advisable to use this option to avoid possible exploits.
The format of the disk image is auto-detected. To override this and force a particular format use the --format=.. option.
Any existing data on the disk is erased.
For example:
virt-format --format=raw -a disk.img
forces raw format (no auto-detection) for disk.img.
virt-format --format=raw -a disk.img --format -a another.img
forces raw format (no auto-detection) for disk.img and reverts to auto-detection for another.img.
If you have untrusted raw-format guest disk images, you should use this option to specify the disk format. This avoids a possible security problem with malicious guests (CVE-2010-3851).
This is the default.
If you use this option, virt-format writes zeroes over the whole disk so that previous data is not recoverable.
This program returns 0 on success, or 1 on failure.
guestfs(3), guestfish(1), virt-filesystems(1), virt-make-fs(1), virt-rescue(1), virt-resize(1), http://libguestfs.org/.
Richard W.M. Jones http://people.redhat.com/~rjones/
Copyright (C) 2012 Red Hat Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
When reporting a bug, please supply:
2023-05-23 | guestfs-tools-1.48.2 |