Skip to content

Instantly share code, notes, and snippets.

@somian
Created July 28, 2013 20:38
Show Gist options
  • Save somian/6100138 to your computer and use it in GitHub Desktop.
Save somian/6100138 to your computer and use it in GitHub Desktop.
# get some metadata about present disk devices.
function disklookup
{
if [[ x"$1 " != x"" ]]
then
PATT="$1"
for LOL in `blkid -o device -t TYPE=ext4`
do blkid -o full -s 'UUID' -s 'LABEL' $LOL
done |
sed -n "/$PATT/{p}"
else
# Try this
for LOL in `blkid -o device -t TYPE=ext4`
do echo -n "$LOL " &&
blkid -o value -s 'LABEL' -s 'UUID' $LOL
done
fi
}
declare -x -f disklookup
@somian
Copy link
Author

somian commented Jul 28, 2013

Not thoroughly tested. It has helped us to edit /etc/fstab so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment