Created
July 2, 2015 16:46
-
-
Save josch/ba0617edc27018438d0a to your computer and use it in GitHub Desktop.
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 | |
set -x | |
set -e | |
DEV=/dev/sdb | |
if ! sudo parted -lm 2>/dev/null | grep scsi | grep "$DEV" > /dev/null; then | |
echo "refusing to work on a device that is not a scsi disk" >&2 | |
exit 1 | |
fi | |
if sudo fdisk -l "$DEV" | grep "^$DEV" > /dev/null; then | |
echo "refusing to work on partitioned drive" >&2 | |
echo "if you are sure, you might want to call `sgdisk --zap-all $DEV`" >&2 | |
exit 1 | |
fi | |
sudo sgdisk --new 0:0:100M --new 0:0:0 "$DEV" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment