1 .\" Copyright (c) 2013, 2014 Juniper Networks, Inc.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 .Nd "utility to make disk images"
45 .Op Fl s Ar scheme Op Fl p Ar partition ...
47 .Ar --formats | --schemes | --version
51 utility creates a disk image from the raw partition contents specified with
54 argument(s) and using the partitioning scheme specified with the
57 The disk image is written to
59 by default or the file specified with the
62 The image file is a raw disk image by default, but the format of the
63 image file can be specified with the
67 The disk image can be made bootable by specifying the scheme-specific boot
68 block contents with the
71 depending on the scheme,
72 with a boot partition.
73 The contents of such a boot partition is provided like any other partition
76 utility does not treat it any differently from other partitions.
78 Some partitioning schemes need a disk geometry and for those the
84 arguments, specifying the number of sectors per track and the number of
85 heads per cylinder (resp.)
87 Both the logical and physical sector size can be specified and for that the
97 argument is used to specify the logical sector size.
98 This is the sector size reported by a disk when queried for its capacity.
99 Modern disks use a larger sector size internally,
100 referred to as block size by the
102 utility and this can be specified by the
107 utility will use the (physical) block size to determine the start of
108 partitions and to round the size of the disk image.
112 option can be used to specify a minimal capacity for the disk image.
113 Use this option without the
117 options to create an empty disk image with the given (virtual) size.
118 An empty partition table can be written to the disk when specifying a
119 partitioning scheme with the
121 option, but without specifying any partitions.
122 When the size required to for all the partitions is larger than the
123 given capacity, then the disk image will be larger than the capacity
128 option increases the level of output that the
134 option is used for testing purposes only and is not to be used in production.
137 utility will generate predictable values for Universally Unique Identifiers
138 (UUIDs) and time stamps so that consecutive runs of the
140 utility will create images that are identical.
142 A set of long options exist to query about the
145 Options in this set should be given by themselves because the
147 utility exits immediately after providing the requested information.
150 utility is printed when the
153 The list of supported output formats is printed when the
155 option is given and the list of supported partitioning schemes is printed
159 Both the format and scheme lists a space-separated lists for easy handling
162 For a more descriptive list of supported partitioning schemes or supported
163 output format, or for a detailed description of how to specify partitions,
166 utility without any arguments.
167 This will print a usage message with all the necessary details.
171 utility supports a number of output file formats.
172 A short description of these is given below.
174 QCOW stands for "QEMU Copy On Write".
175 It's a sparse file format akin to VHD and VMDK and QCOW represents the
177 QCOW2 represents version 2 of the file format.
178 Version 2 is not backward compatible with version 1 and adds support for
179 snapshots among other things.
180 The QCOW file formats are natively supported by QEMU and Xen.
181 To write QCOW, specify
184 To write version 2 QCOW, specify
187 The preferred file extension is ".qcow" and ".qcow2" for QCOW and QCOW2
188 (resp.), but ".qcow" is sometimes used for version 2 files as well.
190 This file format is a sector by sector representation of an actual disk.
191 There is no extra information that describes or relates to the format
192 itself. The size of the file is the size of the (virtual) disk.
193 This file format is suitable for being copyied onto a disk with utilities
196 To write a raw disk file, either omit the
201 The preferred file extension is one of ".img" or ".raw", but there's no
202 real convention for it.
203 .Ss Dynamic VHD and Fixed VHD
204 Microsoft's "Virtual Hard Disk" file formats.
205 The dynamic format is a sparse format akin to QCOW and VMDK.
206 The fixed format is effectively a raw format with a footer appended to the
207 file and as such it's often indistinguishable from the raw format.
208 The fixed file format has been added to support Microsoft's Azure platform
209 and due to inconsistencies in interpretation of the footer is not compatible
212 when it is specifically instructed to interpreted the file as a VHD file.
215 will treat the file as a raw disk file, which mostly works fine.
218 create a dynamic VHD file, specify
221 To create a fixed VHD file for use by Azure, specify
224 The preferred file extension is ".vhd".
226 VMware's "Virtual Machine Disk" file format.
227 It's a sparse file format akin to QCOW and VHD and supported by many
228 virtualization solutions.
229 To create a VMDK file, specify
232 The preferred file extension is ".vmdk".
234 Not all virtualization solutions support all file formats, but often those
235 virtualization environments have utilities to convert from one format to
237 Note however that conversion may require that the virtual disk size is
238 changed to match the constraints of the output format and this may invalidate
239 the contents of the disk image.
240 For example, the GUID Partition Table (GPT) scheme has a header in the last
242 When changing the disk size, the GPT must be changed so that the last header
243 is moved accordingly.
244 This is typically not part of the conversion process.
245 If possible, use an output format specifically for the environment in which
246 the file is intended to be used.
248 .Bl -tag -width "TMPDIR" -compact
250 Directory to put temporary files in; default is
254 To create a bootable disk image that is partitioned using the GPT scheme and
255 containing a root file system that was previously created using
257 and also containing a swap partition, run the
260 .Dl % mkimg -s gpt -b /boot/pmbr -p freebsd-boot:=/boot/gptboot \
261 -p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G \
264 The command line given above results in a raw image file.
265 This is because no output format was given.
266 To create a VMDK image for example, add the
270 utility and name the output file accordingly.
272 A nested partitioning scheme is created by running the
275 The output of the first will be fed as the contents of a partition to the
277 This can be done using a temporary file, like so:
278 .Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
279 -p freebsd-swap::1G -o /tmp/bsd.img
280 .Dl % mkimg -s mbr -b /boot/mbr -p freebsd:=/tmp/bsd.img -o mbr-bsd.img
284 utility can be run in a cascaded fashion, whereby the output of the
285 first is fed directly into the second.
289 .Dl % mkimg -s mbr -b /boot/mbr -p freebsd:-'mkimg -s bsd -b /boot/boot \
290 -p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G' -o mbr-bsd.img
292 To accommodate the need to have partitions named or numbered in a certain
295 utility allows for the specification of empty partitions.
296 For example, to create an image that is compatible with partition layouts
299 the 'd' partition often needs to be skipped.
300 This is accomplished by inserting an unused partition after the first 2
301 partition specifications.
302 It is worth noting at this time that the BSD scheme will automatically
303 skip the 'c' partition by virtue of it referring to the entire disk.
304 To create an image that is compatible with the qp120at disk, use the
307 .Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
308 -p freebsd-swap::20M -p- -p- -p- -p- -p freebsd-ufs:=usr-file-system.ufs \
311 For partitioning schemes that feature partition labels, the
313 utility supports assigning labels to the partitions specified.
314 In the following example the file system partition is labeled as 'backup':
315 .Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img
325 utility first appeared in
330 utility and manpage were written by
331 .An Marcel Moolenaar Aq Mt marcel@FreeBSD.org .