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 --blocksize=512
76 --blocksize=4096
77 --blocksize
78 This parameter sets the sector size of the disk image. It affects
79 all explicitly added subsequent disks after this parameter. Using
80 --blocksize with no argument switches the disk sector size to the
81 default value which is usually 512 bytes. See also
82 "guestfs_add_drive_opts" in guestfs(3).
83
84 --filesystem=ext3|ntfs|vfat|...
85 Create an empty filesystem of the specified type. Many filesystem
86 types are supported by libguestfs.
87
88 --filesystem=none
89 Create no filesystem. This is the default.
90
91 --format=raw|qcow2|..
92 --format
93 The default for the -a option is to auto-detect the format of the
94 disk image. Using this forces the disk format for -a options which
95 follow on the command line. Using --format with no argument
96 switches back to auto-detection for subsequent -a options.
97
98 For example:
99
100 virt-format --format=raw -a disk.img
101
102 forces raw format (no auto-detection) for disk.img.
103
104 virt-format --format=raw -a disk.img --format -a another.img
105
106 forces raw format (no auto-detection) for disk.img and reverts to
107 auto-detection for another.img.
108
109 If you have untrusted raw-format guest disk images, you should use
110 this option to specify the disk format. This avoids a possible
111 security problem with malicious guests (CVE-2010-3851).
112
113 --label=LABEL
114 Set the filesystem label.
115
116 --lvm=/dev/VG/LV
117 Create a Linux LVM2 logical volume called /dev/VG/LV. You can
118 change the name of the volume group and logical volume.
119
120 --lvm
121 Create a Linux LVM2 logical volume with the default name
122 (/dev/VG/LV).
123
124 --lvm=none
125 Create no logical volume. This is the default.
126
127 --partition
128 Create either an MBR or GPT partition covering the whole disk. MBR
129 is chosen if the disk size is < 2 TB, GPT if ≥ 2 TB.
130
131 This is the default.
132
133 --partition=gpt
134 Create a GPT partition.
135
136 --partition=mbr
137 Create an MBR partition.
138
139 --partition=none
140 Create no partition table. Note that Windows may not be able to
141 see these disks.
142
143 -v
144 --verbose
145 Enable verbose messages for debugging.
146
147 -V
148 --version
149 Display version number and exit.
150
151 --wipe
152 Normally virt-format does not wipe data from the disk (because that
153 takes a long time). Thus if there is data on the disk, it is only
154 hidden and partially overwritten by virt-format, and it might be
155 recovered by disk editing tools.
156
157 If you use this option, virt-format writes zeroes over the whole
158 disk so that previous data is not recoverable.
159
160 -x Enable tracing of libguestfs API calls.
161
163 This program returns 0 on success, or 1 on failure.
164
166 guestfs(3), guestfish(1), virt-filesystems(1), virt-make-fs(1),
167 virt-rescue(1), virt-resize(1), http://libguestfs.org/.
168
170 Richard W.M. Jones http://people.redhat.com/~rjones/
171
173 Copyright (C) 2012 Red Hat Inc.
174
176 This program is free software; you can redistribute it and/or modify it
177 under the terms of the GNU General Public License as published by the
178 Free Software Foundation; either version 2 of the License, or (at your
179 option) any later version.
180
181 This program is distributed in the hope that it will be useful, but
182 WITHOUT ANY WARRANTY; without even the implied warranty of
183 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
184 General Public License for more details.
185
186 You should have received a copy of the GNU General Public License along
187 with this program; if not, write to the Free Software Foundation, Inc.,
188 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
189
191 To get a list of bugs against libguestfs, use this link:
192 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
193
194 To report a new bug against libguestfs, use this link:
195 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
196
197 When reporting a bug, please supply:
198
199 · The version of libguestfs.
200
201 · Where you got libguestfs (eg. which Linux distro, compiled from
202 source, etc)
203
204 · Describe the bug accurately and give a way to reproduce it.
205
206 · Run libguestfs-test-tool(1) and paste the complete, unedited output
207 into the bug report.
208
209
210
211libguestfs-1.44.0 2021-01-05 virt-format(1)