1virt-format(1) Virtualization Support virt-format(1)
2
3
4
6 virt-format - Erase and make a blank disk
7
9 virt-format [--options] -a disk.img [-a disk.img ...]
10
12 Using "virt-format" on live virtual machines, or concurrently with
13 other disk editing tools, can be dangerous, potentially causing disk
14 corruption. The virtual machine must be shut down before you use this
15 command, and disk images must not be edited concurrently.
16
18 Virt-format takes an existing disk file (or it can be a host partition,
19 LV etc), erases all data on it, and formats it as a blank disk. It can
20 optionally create partition tables, empty filesystems, logical volumes
21 and more.
22
23 To create a disk containing data, you may be better to use
24 virt-make-fs(1). If you are creating a blank disk to use in
25 guestfish(1), you should instead use the guestfish -N option.
26
27 Normal usage would be something like this:
28
29 virt-format -a disk.qcow
30
31 or this:
32
33 virt-format -a /dev/VG/LV
34
35 disk.qcow or /dev/VG/LV must exist already. Any data on these disks
36 will be erased by these commands. These commands will create a single
37 empty partition covering the whole disk, with no filesystem inside it.
38
39 Additional parameters can be used to control the creation of
40 partitions, filesystems, etc. The most commonly used options are:
41
42 --filesystem=[ext3|ntfs|vfat|...]
43 Create an empty filesystem ("ext3", "ntfs" etc) inside the
44 partition.
45
46 --lvm[=/dev/VG/LV]
47 Create a Linux LVM2 logical volume on the disk. When used with
48 --filesystem, the filesystem is created inside the LV.
49
50 For more information about these and other options, see "OPTIONS"
51 below.
52
53 The format of the disk is normally auto-detected, but you can also
54 force it by using the --format option (q.v.). In situations where you
55 do not trust the existing content of the disk, then it is advisable to
56 use this option to avoid possible exploits.
57
59 --help
60 Display brief help.
61
62 -a file
63 --add file
64 Add file, a disk image, host partition, LV, external USB disk, etc.
65
66 The format of the disk image is auto-detected. To override this
67 and force a particular format use the --format=.. option.
68
69 Any existing data on the disk is erased.
70
71 -a URI
72 --add URI
73 Add a remote disk. See "ADDING REMOTE STORAGE" in guestfish(1).
74
75 --filesystem=ext3|ntfs|vfat|...
76 Create an empty filesystem of the specified type. Many filesystem
77 types are supported by libguestfs.
78
79 --filesystem=none
80 Create no filesystem. This is the default.
81
82 --format=raw|qcow2|..
83 --format
84 The default for the -a option is to auto-detect the format of the
85 disk image. Using this forces the disk format for -a options which
86 follow on the command line. Using --format with no argument
87 switches back to auto-detection for subsequent -a options.
88
89 For example:
90
91 virt-format --format=raw -a disk.img
92
93 forces raw format (no auto-detection) for disk.img.
94
95 virt-format --format=raw -a disk.img --format -a another.img
96
97 forces raw format (no auto-detection) for disk.img and reverts to
98 auto-detection for another.img.
99
100 If you have untrusted raw-format guest disk images, you should use
101 this option to specify the disk format. This avoids a possible
102 security problem with malicious guests (CVE-2010-3851).
103
104 --label=LABEL
105 Set the filesystem label.
106
107 --lvm=/dev/VG/LV
108 Create a Linux LVM2 logical volume called /dev/VG/LV. You can
109 change the name of the volume group and logical volume.
110
111 --lvm
112 Create a Linux LVM2 logical volume with the default name
113 (/dev/VG/LV).
114
115 --lvm=none
116 Create no logical volume. This is the default.
117
118 --partition
119 Create either an MBR or GPT partition covering the whole disk. MBR
120 is chosen if the disk size is < 2 TB, GPT if ≥ 2 TB.
121
122 This is the default.
123
124 --partition=gpt
125 Create a GPT partition.
126
127 --partition=mbr
128 Create an MBR partition.
129
130 --partition=none
131 Create no partition table. Note that Windows may not be able to
132 see these disks.
133
134 -v
135 --verbose
136 Enable verbose messages for debugging.
137
138 -V
139 --version
140 Display version number and exit.
141
142 --wipe
143 Normally virt-format does not wipe data from the disk (because that
144 takes a long time). Thus if there is data on the disk, it is only
145 hidden and partially overwritten by virt-format, and it might be
146 recovered by disk editing tools.
147
148 If you use this option, virt-format writes zeroes over the whole
149 disk so that previous data is not recoverable.
150
151 -x Enable tracing of libguestfs API calls.
152
154 This program returns 0 on success, or 1 on failure.
155
157 guestfs(3), guestfish(1), virt-filesystems(1), virt-make-fs(1),
158 virt-rescue(1), virt-resize(1), http://libguestfs.org/.
159
161 Richard W.M. Jones http://people.redhat.com/~rjones/
162
164 Copyright (C) 2012 Red Hat Inc.
165
167 This program is free software; you can redistribute it and/or modify it
168 under the terms of the GNU General Public License as published by the
169 Free Software Foundation; either version 2 of the License, or (at your
170 option) any later version.
171
172 This program is distributed in the hope that it will be useful, but
173 WITHOUT ANY WARRANTY; without even the implied warranty of
174 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
175 General Public License for more details.
176
177 You should have received a copy of the GNU General Public License along
178 with this program; if not, write to the Free Software Foundation, Inc.,
179 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
180
182 To get a list of bugs against libguestfs, use this link:
183 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
184
185 To report a new bug against libguestfs, use this link:
186 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
187
188 When reporting a bug, please supply:
189
190 · The version of libguestfs.
191
192 · Where you got libguestfs (eg. which Linux distro, compiled from
193 source, etc)
194
195 · Describe the bug accurately and give a way to reproduce it.
196
197 · Run libguestfs-test-tool(1) and paste the complete, unedited output
198 into the bug report.
199
200
201
202libguestfs-1.40.1 2019-01-17 virt-format(1)