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