Created
August 30, 2017 03:59
-
-
Save helen-fornazier/4cc431d79c523d8cfb4131e8d19c833f to your computer and use it in GitHub Desktop.
lvm-partition-mount-test
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/bash | |
MNT="/mnt" | |
BOOT="not found" | |
ROOT="not found" | |
for label in $(blkid -o device | grep -v /dev/sda); do | |
if ! mount $label $MNT 2>/dev/null; then | |
continue | |
fi | |
if [ -f $MNT/sbin/init ]; then | |
ROOT=$label | |
fi | |
if [ -f $MNT/boot/grub/grub.cfg ]; then | |
BOOT=$label | |
elif [ -f $MNT/grub/grub.cfg ]; then | |
BOOT=$label | |
fi | |
umount $MNT | |
done | |
echo "ROOT $ROOT" | |
echo "BOOT $BOOT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment