-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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