Skip to content

Instantly share code, notes, and snippets.

@kevinbin
Created May 17, 2013 05:01
Show Gist options
  • Save kevinbin/5597024 to your computer and use it in GitHub Desktop.
Save kevinbin/5597024 to your computer and use it in GitHub Desktop.
check hardware support virtualization
#!/bin/bash
cpuinfo=`egrep '^flags.*(vmx|svm)' /proc/cpuinfo`
if [ "$cpuinfo" = "" ]; then
echo "There doesn't appear to be any hardware support for virtualization"
exit
fi
hardware=`dmesg | grep kvm | grep -i 'no hardware support'`
bios=`dmesg | grep kvm | grep -i 'disabled by bios'`
if [ "$hardware" != "" ]; then
echo "No hardware support for KVM"
exit
fi
if [ "$bios" != "" ]; then
echo "KVM disabled by bios"
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment