Skip to content

Instantly share code, notes, and snippets.

@maccyber
Created December 16, 2016 12:37
Show Gist options
  • Save maccyber/f1ec2edd8449b14a4333ae7f5c70af26 to your computer and use it in GitHub Desktop.
Save maccyber/f1ec2edd8449b14a4333ae7f5c70af26 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Finds disk and partition where boot is mounted
lsblk -i --output KNAME,TYPE,MOUNTPOINT | while read KNAME TYPE MOUNTPOINT
do
if [ "$TYPE" = "disk" ]; then
SELECTED_DISK="$KNAME"
elif [ "$MOUNTPOINT" = "/boot" ]; then
printf "Disk: $SELECTED_DISK\nPartition: $KNAME\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment