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"
46 .Op Fl s Ar scheme Op Fl p Ar partition ...
48 .Ar --formats | --schemes | --version
52 utility creates a disk image from the raw partition contents specified with
55 argument(s) and using the partitioning scheme specified with the
58 The disk image is written to
60 by default or the file specified with the
63 The image file is a raw disk image by default, but the format of the
64 image file can be specified with the
68 The disk image can be made bootable by specifying the scheme-specific boot
69 block contents with the
72 depending on the scheme,
73 with a boot partition.
74 The contents of such a boot partition is provided like any other partition
77 utility does not treat it any differently from other partitions.
79 Some partitioning schemes need a disk geometry and for those the
85 arguments, specifying the number of sectors per track and the number of
86 heads per cylinder (resp.)
88 Both the logical and physical sector size can be specified and for that the
98 argument is used to specify the logical sector size.
99 This is the sector size reported by a disk when queried for its capacity.
100 Modern disks use a larger sector size internally,
101 referred to as block size by the
103 utility and this can be specified by the
108 utility will use the (physical) block size to determine the start of
109 partitions and to round the size of the disk image.
113 option can be used to specify a minimal capacity for the disk image.
114 Use this option without the
118 options to create an empty disk image with the given (virtual) size.
119 An empty partition table can be written to the disk when specifying a
120 partitioning scheme with the
122 option, but without specifying any partitions.
123 When the size required for all the partitions is larger than the
124 given capacity, then the disk image will be larger than the capacity
129 option increases the level of output that the
135 option is used for testing purposes only and is not to be used in production.
138 utility will generate predictable values for Universally Unique Identifiers
139 (UUIDs) and time stamps so that consecutive runs of the
141 utility will create images that are identical.
145 option marks a partition as active, if the partitioning
149 scheme supports this concept.
152 will only mark the first partition as active when boot code is
156 option to override the active partition.
157 The number specified corresponds to the number after the 's' in the
161 No partitions are marked active when the value is 0.
163 A set of long options exist to query about the
166 Options in this set should be given by themselves because the
168 utility exits immediately after providing the requested information.
171 utility is printed when the
174 The list of supported output formats is printed when the
176 option is given and the list of supported partitioning schemes is printed
180 Both the format and scheme lists a space-separated lists for easy handling
183 For a more descriptive list of supported partitioning schemes or supported
184 output format, or for a detailed description of how to specify partitions,
187 utility without any arguments.
188 This will print a usage message with all the necessary details.
192 utility supports a number of output file formats.
193 A short description of these is given below.
195 QCOW stands for "QEMU Copy On Write".
196 It's a sparse file format akin to VHD and VMDK and QCOW represents the
198 QCOW2 represents version 2 of the file format.
199 Version 2 is not backward compatible with version 1 and adds support for
200 snapshots among other things.
201 The QCOW file formats are natively supported by QEMU and Xen.
202 To write QCOW, specify
205 To write version 2 QCOW, specify
208 The preferred file extension is ".qcow" and ".qcow2" for QCOW and QCOW2
209 (resp.), but ".qcow" is sometimes used for version 2 files as well.
211 This file format is a sector by sector representation of an actual disk.
212 There is no extra information that describes or relates to the format
213 itself. The size of the file is the size of the (virtual) disk.
214 This file format is suitable for being copyied onto a disk with utilities
217 To write a raw disk file, either omit the
222 The preferred file extension is one of ".img" or ".raw", but there's no
223 real convention for it.
224 .Ss Dynamic VHD and Fixed VHD
225 Microsoft's "Virtual Hard Disk" file formats.
226 The dynamic format is a sparse format akin to QCOW and VMDK.
227 The fixed format is effectively a raw format with a footer appended to the
228 file and as such it's often indistinguishable from the raw format.
229 The fixed file format has been added to support Microsoft's Azure platform
230 and due to inconsistencies in interpretation of the footer is not compatible
233 when it is specifically instructed to interpreted the file as a VHD file.
236 will treat the file as a raw disk file, which mostly works fine.
239 create a dynamic VHD file, specify
242 To create a fixed VHD file for use by Azure, specify
245 The preferred file extension is ".vhd".
247 VMware's "Virtual Machine Disk" file format.
248 It's a sparse file format akin to QCOW and VHD and supported by many
249 virtualization solutions.
250 To create a VMDK file, specify
253 The preferred file extension is ".vmdk".
255 Not all virtualization solutions support all file formats, but often those
256 virtualization environments have utilities to convert from one format to
258 Note however that conversion may require that the virtual disk size is
259 changed to match the constraints of the output format and this may invalidate
260 the contents of the disk image.
261 For example, the GUID Partition Table (GPT) scheme has a header in the last
263 When changing the disk size, the GPT must be changed so that the last header
264 is moved accordingly.
265 This is typically not part of the conversion process.
266 If possible, use an output format specifically for the environment in which
267 the file is intended to be used.
269 .Bl -tag -width "TMPDIR" -compact
271 Directory to put temporary files in; default is
275 To create a bootable disk image that is partitioned using the GPT scheme and
276 containing a root file system that was previously created using
278 and also containing a swap partition, run the
281 .Dl % mkimg -s gpt -b /boot/pmbr -p freebsd-boot:=/boot/gptboot \
282 -p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G \
285 The command line given above results in a raw image file.
286 This is because no output format was given.
287 To create a VMDK image for example, add the
291 utility and name the output file accordingly.
293 A nested partitioning scheme is created by running the
296 The output of the first will be fed as the contents of a partition to the
298 This can be done using a temporary file, like so:
299 .Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
300 -p freebsd-swap::1G -o /tmp/bsd.img
301 .Dl % mkimg -s mbr -b /boot/mbr -p freebsd:=/tmp/bsd.img -o mbr-bsd.img
305 utility can be run in a cascaded fashion, whereby the output of the
306 first is fed directly into the second.
310 .Dl % mkimg -s mbr -b /boot/mbr -p freebsd:-'mkimg -s bsd -b /boot/boot \
311 -p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G' -o mbr-bsd.img
313 To accommodate the need to have partitions named or numbered in a certain
316 utility allows for the specification of empty partitions.
317 For example, to create an image that is compatible with partition layouts
320 the 'd' partition often needs to be skipped.
321 This is accomplished by inserting an unused partition after the first 2
322 partition specifications.
323 It is worth noting at this time that the BSD scheme will automatically
324 skip the 'c' partition by virtue of it referring to the entire disk.
325 To create an image that is compatible with the qp120at disk, use the
328 .Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
329 -p freebsd-swap::20M -p- -p- -p- -p- -p freebsd-ufs:=usr-file-system.ufs \
332 For partitioning schemes that feature partition labels, the
334 utility supports assigning labels to the partitions specified.
335 In the following example the file system partition is labeled as 'backup':
336 .Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img
346 utility first appeared in
351 utility and manpage were written by
352 .An Marcel Moolenaar Aq Mt marcel@FreeBSD.org .