OnWorks favicon

virt-format - Online in the Cloud

Run virt-format in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command virt-format that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



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

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:

Create an empty filesystem ("ext3", "ntfs" etc) inside the partition.

Create a Linux LVM2 logical volume on the disk. When used with --filesystem, the
filesystem is created inside the LV.

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.


Display brief help.

-a file
--add file
Add file, a disk image, host partition, LV, external USB disk, etc.

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.

-a URI
--add URI
Add a remote disk. See "ADDING REMOTE STORAGE" in guestfish(1).

Create an empty filesystem of the specified type. Many filesystem types are supported
by libguestfs.

Create no filesystem. This is the default.

The default for the -a option is to auto-detect the format of the disk image. Using
this forces the disk format for -a options which follow on the command line. Using
--format with no argument switches back to auto-detection for subsequent -a options.

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

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).

Set the filesystem label.

Create a Linux LVM2 logical volume called /dev/VG/LV. You can change the name of the
volume group and logical volume.

Create a Linux LVM2 logical volume with the default name (/dev/VG/LV).

Create no logical volume. This is the default.

Create either an MBR or GPT partition covering the whole disk. MBR is chosen if the
disk size is < 2 TB, GPT if ≥ 2 TB.

This is the default.

Create a GPT partition.

Create an MBR partition.

Create no partition table. Note that Windows may not be able to see these disks.

Enable verbose messages for debugging.

Display version number and exit.

Normally virt-format does not wipe data from the disk (because that takes a long
time). Thus if there is data on the disk, it is only hidden and partially overwritten
by virt-format, and it might be recovered by disk editing tools.

If you use this option, virt-format writes zeroes over the whole disk so that previous
data is not recoverable.

-x Enable tracing of libguestfs API calls.


This program returns 0 on success, or 1 on failure.

Use virt-format online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    itop - ITSM  CMDB OpenSource
    itop - ITSM CMDB OpenSource
    IT Operations Portal: a complete open
    source, ITIL, web based service
    management tool including a fully
    customizable CMDB, a helpdesk system and
    a document man...
    Download itop - ITSM CMDB OpenSource
  • 2
    Clementine is a multi-platform music
    player and library organizer inspired by
    Amarok 1.4. It has a fast and
    easy-to-use interface, and allows you to
    search and ...
    Download Clementine
  • 3
    ATTENTION: Cumulative update 2.4.3 has
    been released!! The update works for any
    previous 2.x.x version. If upgrading
    from version v1.x.x, please download and
    Download XISMuS
  • 4
    Modular headtracking program that
    supports multiple face-trackers, filters
    and game-protocols. Among the trackers
    are the SM FaceAPI, AIC Inertial Head
    Tracker ...
    Download facetracknoir
  • 5
    PHP QR Code
    PHP QR Code
    PHP QR Code is open source (LGPL)
    library for generating QR Code,
    2-dimensional barcode. Based on
    libqrencode C library, provides API for
    creating QR Code barc...
    Download PHP QR Code
  • 6
    Freeciv is a free turn-based
    multiplayer strategy game, in which each
    player becomes the leader of a
    civilization, fighting to obtain the
    ultimate goal: to bec...
    Download Freeciv
  • 7
    Cuckoo Sandbox
    Cuckoo Sandbox
    Cuckoo Sandbox uses components to
    monitor the behavior of malware in a
    Sandbox environment; isolated from the
    rest of the system. It offers automated
    analysis o...
    Download Cuckoo Sandbox
  • More »

Linux commands