Skip to content

Instantly share code, notes, and snippets.

@helen-fornazier
Created August 30, 2017 03:59
Show Gist options
  • Save helen-fornazier/4cc431d79c523d8cfb4131e8d19c833f to your computer and use it in GitHub Desktop.
Save helen-fornazier/4cc431d79c523d8cfb4131e8d19c833f to your computer and use it in GitHub Desktop.
lvm-partition-mount-test
#!/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