Update mkgpt.sh

This commit is contained in:
kneutron 2024-06-02 12:25:01 -06:00 committed by GitHub
parent d443903566
commit bc1f503efa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,8 +2,13 @@
# DEPENDS: smartctl, parted, fdisk
echo "Parameter: Supply short device name [sdb], etc"
echo "MAKE SURE you supply the right disk device - author takes NO RESPONSIBILITY for data loss!"
echo "Use at your own risk!"
argg=$1
[ $(which parted |wc -l) -gt 0 ] || apt-get install -y parted
#source ~/bin/failexit.mrg
# failexit.mrg
function failexit () {
@ -17,9 +22,11 @@ fdisk -l /dev/$argg
ls -l /dev/disk/by-id |grep $argg
echo "THIS WILL DESTRUCTIVELY APPLY A GPT LABEL - ARE YOU SURE - PK OR ^C"
echo "THIS WILL DESTRUCTIVELY APPLY A GPT LABEL to /dev/$argg - ARE YOU SURE - Enter to proceed OR ^C"
read
parted -s /dev/$argg mklabel gpt || failexit 99 "! Failed to apply GPT label to /dev/$argg"
fdisk -l /dev/$argg
exit;