|
NAMEmkimg —
utility to make disk images
SYNOPSIS
DESCRIPTIONThemkimg utility creates a disk image from the raw
partition contents specified with the partition
argument(s) and using the partitioning scheme specified with the
scheme argument. The disk image is written to
stdout by default or the file specified with the
outfile argument. The image file is a raw disk image by
default, but the format of the image file can be specified with the
format argument.
The disk image can be made bootable by specifying the
scheme-specific boot block contents with the bootcode
argument and, depending on the scheme, with a boot partition. The contents
of such a boot partition is provided like any other partition and the
Some partitioning schemes need a disk geometry and for those the
Both the logical and physical sector size can be specified and for
that the The The The The The The active option marks a partition as
active, if the partitioning scheme supports it. Currently, only the
mbr scheme supports this concept. By default,
A set of long options exist to query about the
For a more descriptive list of supported partitioning schemes or
supported output format, or for a detailed description of how to specify
partitions, run the DISK FORMATSThemkimg utility supports a number of output file
formats. A short description of these is given below.
QCOW and QCOW2QCOW stands for "QEMU Copy On Write". It's a sparse file format akin to VHD and VMDK and QCOW represents the first version. QCOW2 represents version 2 of the file format. Version 2 is not backward compatible with version 1 and adds support for snapshots among other things. The QCOW file formats are natively supported by QEMU and Xen. To write QCOW, specify-f qcow on the command line. To
write version 2 QCOW, specify -f
qcow2 on the command line. The preferred file extension
is ".qcow" and ".qcow2" for QCOW and QCOW2 (resp.), but
".qcow" is sometimes used for version 2 files as well.
RAW file formatThis file format is a sector by sector representation of an actual disk. There is no extra information that describes or relates to the format itself. The size of the file is the size of the (virtual) disk. This file format is suitable for being copyied onto a disk with utilities likedd . To write a raw disk file, either omit the
-f option, or specify -f
raw on the command line. The preferred file extension is
one of ".img" or ".raw", but there's no real convention
for it.
Dynamic VHD and Fixed VHDMicrosoft's "Virtual Hard Disk" file formats. The dynamic format is a sparse format akin to QCOW and VMDK. The fixed format is effectively a raw format with a footer appended to the file and as such it's often indistinguishable from the raw format. The fixed file format has been added to support Microsoft's Azure platform and due to inconsistencies in interpretation of the footer is not compatible with utilities likeqemu when it is specifically instructed to interpreted
the file as a VHD file. By default qemu will treat the
file as a raw disk file, which mostly works fine. To have
mkimg create a dynamic VHD file, specify
-f vhd on the command line. To
create a fixed VHD file for use by Azure, specify -f
vhdf on the command line. The preferred file extension
is ".vhd".
Dynamic VHDXMicrosoft's "Virtual Hard Disk v2" file formats, the successor to VHD. VHDX is the required format for the 2nd generation Hyper-V VMs. To havemkimg create a dynamic VHDX file, specify
-f vhdx on the command line. The
preferred file extension is ".vhdx".
VMDKVMware's "Virtual Machine Disk" file format. It's a sparse file format akin to QCOW and VHD and supported by many virtualization solutions. To create a VMDK file, specify-f vmdk on
the command line. The preferred file extension is ".vmdk".
Not all virtualization solutions support all file formats, but often those virtualization environments have utilities to convert from one format to another. Note however that conversion may require that the virtual disk size is changed to match the constraints of the output format and this may invalidate the contents of the disk image. For example, the GUID Partition Table (GPT) scheme has a header in the last sector on the disk. When changing the disk size, the GPT must be changed so that the last header is moved accordingly. This is typically not part of the conversion process. If possible, use an output format specifically for the environment in which the file is intended to be used. ENVIRONMENT
EXAMPLESTo create a bootable disk image that is partitioned using the GPT scheme and containing a root file system that was previously created using makefs(8) and also containing a swap partition, run themkimg
utility as follows:
% mkimg -s gpt -b /boot/pmbr -p
freebsd-boot:=/boot/gptboot -p freebsd-ufs:=root-file-system.ufs -p
freebsd-swap::1G -o gpt.img The command line given above results in a raw image file. This is
because no output format was given. To create a VMDK image for example, add
the A nested partitioning scheme is created by running the
% mkimg -s bsd -b /boot/boot -p
freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G -o
/tmp/bsd.img % mkimg -s mbr -b /boot/mbr -p
freebsd:=/tmp/bsd.img -o mbr-bsd.img Alternatively, the % mkimg -s mbr -b /boot/mbr -p
freebsd:-'mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs -p
freebsd-swap::1G' -o mbr-bsd.img To accommodate the need to have partitions named or numbered in a
certain way, the % mkimg -s bsd -b /boot/boot -p
freebsd-ufs:=root-file-system.ufs -p freebsd-swap::20M -p- -p- -p- -p- -p
freebsd-ufs:=usr-file-system.ufs -o bsd.img For partitioning schemes that feature partition labels, the
% mkimg -s gpt -p
freebsd-ufs/backup:=file-system.ufs -o gpt.img SEE ALSOdd(1), gpart(8), makefs(8), mdconfig(8), newfs(8)HISTORYThemkimg utility first appeared in
FreeBSD 10.1.
AUTHORSThemkimg utility and manpage were written by
Marcel Moolenaar
<marcel@FreeBSD.org>.
Visit the GSP FreeBSD Man Page Interface. |