Skip to content

Instantly share code, notes, and snippets.

@pcolby
Created January 10, 2018 10:35
Show Gist options
  • Save pcolby/21e6c5e6092d42e0a1167fa32e13c570 to your computer and use it in GitHub Desktop.
Save pcolby/21e6c5e6092d42e0a1167fa32e13c570 to your computer and use it in GitHub Desktop.
A simple way to copy a DVD ISO using dd
#!/bin/bash
DEVICE=/dev/cdrom
DD=`which dd` || { echo 'Required command not found: dd' >&2; exit 1; }
ISOINFO=`which isoinfo` || { echo 'Required command not found: isoinfo' >&2; exit 1; }
SED=`which sed` || { echo 'Required command not found: sed' >&2; exit 1; }
LABEL=`"$ISOINFO" -d -i "$DEVICE" | "$SED" -nre 's/^Volume id: //p'`
BLOCK_SIZE=`"$ISOINFO" -d -i "$DEVICE" | "$SED" -nre 's/^Logical block size is: //p'`
VOLUME_SIZE=`"$ISOINFO" -d -i "$DEVICE" | "$SED" -nre 's/^Volume size is: //p'`
echo "$LABEL.iso ($BLOCK_SIZE, $VOLUME_SIZE)"
"$DD" if="$DEVICE" of="$LABEL.iso" bs="$BLOCK_SIZE" count="$VOLUME_SIZE" status=progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment