Skip to content

Instantly share code, notes, and snippets.

@sunny
Created July 23, 2014 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunny/406a4c5000c58fbcb561 to your computer and use it in GitHub Desktop.
Save sunny/406a4c5000c58fbcb561 to your computer and use it in GitHub Desktop.
Command-line tool to unmount and create iso image of a disk, under OSX
#!/bin/sh
# Create disk images
#
# Put this in ~/bin/iso and add ~/bin/ to your $PATH, then run `iso`.
set -e
if [ "$1" ] && [ "$2" ]; then
diskutil unmountDisk "$1"
echo "Creating image at $2. Press ctrl-t to see progress."
dd "if=/dev/$1" "of=$2"
else
echo 'Usage: iso DISK_NAME ISO_PATH'
echo 'Example: iso disk3 ~/cd.iso'
echo
echo 'To find the disk name, use the `drutil status` command:'
echo
drutil status
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment