LinuxCommandLibrary

bchunk

Convert CD image into separate data/track files

TLDR

Convert binary CD into a standard iso9960 image file

$ bchunk [path/to/image.bin] [path/to/image.cue] [path/to/output]
copy

Convert with verbose mode
$ bchunk -v [path/to/image.bin] [path/to/image.cue] [path/to/output]
copy

Output audio files in WAV format
$ bchunk -w [path/to/image.bin] [path/to/image.cue] [path/to/output]
copy

SYNOPSIS

bchunk [-f] [prefix]

PARAMETERS

-f
    Force overwrite. If the output file already exists, bchunk will overwrite it without prompting.

prefix
    The common filename prefix of the split .bz2 files. For example, if input files are archive.bz2s_001.bz2, archive.bz2s_002.bz2, then the prefix is archive.bz2s_. If this argument is not provided, bchunk defaults to looking for files with the prefix bzip2s_.

DESCRIPTION

bchunk is a utility designed to concatenate a series of .bz2 files that were previously split by bzip2split(1) back into a single, complete .bz2 archive. This is particularly useful for handling very large bzip2 archives that needed to be broken into smaller, more manageable pieces, perhaps for storage on multiple removable media, transmission over networks with size limits, or simply for easier partial processing.

bchunk reads the individual .bz2 chunks, which typically have a common prefix and a sequential numeric suffix, and writes them contiguously to standard output or a specified output file. The process effectively reverses the splitting operation, restoring the original compressed file.

CAVEATS

bchunk expects the input files to be valid .bz2 chunks, typically generated by bzip2split using its standard numbering scheme (e.g., 001, 002, 003). It is specifically designed for and only handles .bz2 compressed files, not other archive formats.

TYPICAL USAGE

To reassemble a file that was previously split using bzip2split, you would use bchunk and redirect its output to a new file.

Example:
bzip2split largefile.bz2 # This creates files like largefile.bz2s_001.bz2, largefile.bz2s_002.bz2, etc.
bchunk largefile.bz2s_ > recreated.bz2

OUTPUT DESTINATION

By default, bchunk writes the reassembled content to standard output (stdout). To save the result to a file, you must explicitly use shell redirection (e.g., > output.bz2) as shown in the example above, as bchunk does not accept an output filename as a direct argument.

HISTORY

bzip2split and bchunk are integral parts of the bzip2 project, initially developed by Julian Seward. They were introduced to provide a practical solution for managing and manipulating extremely large bzip2 compressed files by enabling them to be reliably split into smaller segments and subsequently recombined. Their inclusion enhanced the utility of bzip2 for handling large datasets.

SEE ALSO

bzip2(1), bzip2split(1)

Copied to clipboard