create-image
Create a virtual machine image
TLDR
Create a CPIO archive from the current directory
Display help
SYNOPSIS
create-image [OPTIONS] <output-path>
create-image [OPTIONS] <image-type> <output-path>
A conceptual command. Real-world image creation involves specific tools.
PARAMETERS
--size
Specifies the size of the image, e.g., "10G", "500M".
--format
Defines the image format, such as "raw", "qcow2", "vmdk", "iso".
--type
Categorizes the image, e.g., "vm", "container", "bootable".
--template
Uses a predefined OS or application template for the image content.
--os
Specifies the operating system when using a template, e.g., "centos-stream-8", "ubuntu-22.04".
--filesystem
Formats the image with a specific filesystem, e.g., "ext4", "xfs", "fat32".
--source
Specifies a directory or existing image to use as source content.
--bootable
Configures the image to be bootable.
--sparse
Creates a sparse image file, which only consumes space as data is written.
--compress
Compresses the image file to reduce its size.
DESCRIPTION
The term "create-image" on Linux typically refers to the conceptual process of generating disk images or virtual machine images, rather than a single, universally recognized command. This process involves creating a file that represents a storage device, often including a filesystem and operating system, for purposes like virtualization, containerization, or creating bootable media. While no single command named "create-image" exists, various specialized tools are used to achieve this, such as dd for raw disk cloning, qemu-img for virtual machine disk formats, mkfs for filesystem creation, and image builders like virt-builder for complete OS images. The complexity varies from simple empty image files to fully provisioned virtual machines.
CAVEATS
The command "create-image" is not a standard, standalone utility found in most Linux distributions. The functionality described typically involves a suite of specialized tools. Users must identify the specific tool suitable for their image creation needs (e.g., qemu-img for VM disks, dd for raw copies, virt-builder for complex VM images, mkisofs/genisoimage for ISOs). Incorrect usage of these tools can lead to data loss or system instability.
VIRTUAL MACHINE DISK IMAGES
These images (.qcow2, .vmdk, .vdi, .raw) are used by hypervisors to store the virtual disk of a VM. They can be created empty and formatted later, or built from a template with an OS pre-installed.
CONTAINER IMAGES
While not traditional "disk images," container images (Docker, OCI format) bundle applications and their dependencies. They are built layer by layer using tools like Buildah or Docker build and are designed for portability and isolation.
BOOTABLE MEDIA IMAGES
These include ISO images for optical media or raw images for USB drives. They contain a bootloader and an operating system, allowing systems to boot directly from them for installation or live environments.
HISTORY
The concept of creating system or disk images on Linux has evolved significantly with the rise of virtualization (like KVM, VirtualBox), containerization (Docker, Podman, LXC), and cloud computing. Initially, simple raw disk images could be created with tools like dd. As needs grew, more sophisticated tools emerged to handle complex virtual disk formats (qcow2, vmdk), automate OS provisioning (virt-builder, packer), and manage container images (buildah, docker build). There has never been a single, unified "create-image" command; instead, the ecosystem developed domain-specific tools, each optimized for a particular type of image creation.