chdman
Create and verify CHD files
TLDR
Create a CHD from a BIN/CUE pair (CD-ROM image)
Create a CHD from a raw hard drive image
Extract (decompress) a CHD back to BIN/CUE
Verify integrity of CHD file
View CHD metadata information
Update a CHD file to the latest format version
Convert a compressed hard drive image to uncompressed (for editing)
SYNOPSIS
chdman <command> [<options>] [<arguments>]
Example Usage:
chdman createhd -i input.raw -o output.chd -c zlib
chdman info -i game.chd
chdman verify -i game.chd
PARAMETERS
createhd
Creates a new hard disk image in the CHD format from a raw disk image file. Supports various compression methods.
createcd
Creates a new CD-ROM image in the CHD format from a CUE/BIN or similar CD image set, or directly from an optical drive.
createld
Creates a new LaserDisc image in the CHD format from raw video and audio streams, typically for specific LaserDisc formats.
extractraw
Extracts the raw uncompressed data from an existing CHD file back into a raw disk image, CUE/BIN, or other raw format.
verify
Checks the integrity of an existing CHD file, ensuring all hunks are correct and not corrupted by comparing against stored checksums.
info
Displays detailed information about a CHD file, including its format version, size, compression details, internal structure, and checksums.
convert
Converts an existing CHD file, potentially changing its compression algorithm, hunk size, or CHD format version (e.g., from v3 to v5).
-i <inputfile>
Specifies the input file for the operation (e.g., a raw disk image, a CUE file, or an existing CHD). This is mandatory for most commands.
-o <outputfile>
Specifies the output file for the operation (e.g., the new CHD file or the extracted raw data). This is mandatory for commands like createhd, createcd, createld, extractraw, and convert.
-c <algorithm>
Sets the compression algorithm to use when creating or converting a CHD. Common algorithms include zlib, lzma, huffman, flac, cd-rom, and cd-xa.
-h <size>
Specifies the hunk size in bytes for the CHD file. This affects compression efficiency and access patterns. Applicable to createhd and convert.
-j <level>
Sets the compression level, typically from 1 (fastest, lowest compression) to 9 (slowest, best compression). Applicable to algorithms like zlib or lzma.
-f
Forces the operation to overwrite an existing output file without prompting for confirmation.
-v
Displays verbose output, showing more details about the command's progress and actions.
DESCRIPTION
chdman is a command-line utility for creating, verifying, and manipulating CHD (Compressed Hunks of Data) files. CHD is a specialized disk image format primarily used by the MAME (Multiple Arcade Machine Emulator) project to store large media like hard drives, CD-ROMs, and LaserDiscs efficiently. It employs various compression algorithms to reduce file sizes, making it practical to store and emulate systems that originally used significant storage.
The tool allows users to convert raw disk images into the CHD format, extract raw data from existing CHDs, verify the integrity of CHD files, and display detailed information about their structure and content. It's an indispensable component for MAME enthusiasts and preservationists dealing with emulated systems that rely on large, complex storage media.
CAVEATS
CHD files come in different versions (v3, v4, v5), and older MAME versions might not support newer CHD formats. Creating or converting very large CHD files can be a time-consuming and resource-intensive process, potentially requiring significant CPU and disk I/O. The choice of compression algorithm impacts both file size and emulation performance; a highly compressed CHD might require more CPU cycles during emulation. Ensuring the source data is correct and complete before CHD creation is crucial, as errors will propagate into the CHD file.
COMPRESSION ALGORITHMS
chdman supports various compression algorithms, each suited for different types of data:
zlib: General-purpose lossless compression, good for most data.
lzma: Offers higher compression ratios than zlib, but is significantly slower.
huffman: Used for specific data patterns, often combined with other methods.
flac: Optimized for lossless audio compression, ideal for audio tracks.
cd-rom: Specialized for raw CD-ROM data, providing excellent compression for typical CD-ROM layouts.
cd-xa: Specifically designed for CD-ROM XA (Extended Architecture) data tracks, which have a different structure than standard CD-ROM tracks.
CHD FORMAT VERSIONS
The CHD format has evolved over time, with each version introducing new features or compression capabilities:
v3: An older version, still supported but generally less efficient in compression and features compared to newer versions.
v4: Introduced better compression, checksumming, and support for features like metadata, becoming widely used.
v5: The current standard, offering the best compression, robust checksumming, and advanced features. It is highly recommended for new CHDs and provides the most future-proof compatibility with MAME.
HISTORY
The CHD (Compressed Hunks of Data) format and its associated utility, chdman, were developed as an integral part of the MAME project to address the growing need to store and emulate systems utilizing large disk media. As MAME expanded to cover arcade games and systems that relied on hard drives, CD-ROMs, and LaserDiscs, a robust and efficient storage solution was necessary to manage gigabytes of data. chdman was introduced to compress these large media images, reducing storage requirements and improving load times during emulation. Over its development, the CHD format evolved through several versions (v3, v4, v5), each bringing improvements in compression algorithms, integrity checking, and feature sets, solidifying chdman's role as an essential tool for MAME ROM management and digital preservation.


