Create an Image File from any Medium on macOS and Linux

This post is about how to basically pack a whole volume (like any partition) into a so called image file. This is mostly used to create image files from bootable CD or DVD installation media.

First take a look at all volumes.

The next command copies bit by bit of the source volume to a target image file: sudo dd if=[path/to/source/volume] of=[path/to/image/file.img] bs=1m

Here’s an example: sudo dd if=/dev/rdisk# of=~/Desktop/image.img bs=1m, where # is the volume’s index.