Tuesday, 28 August 2012

Linux CPU flag checking for 64bit and virtualization!

This might save you some time, the easiest way to determine if a system supports 64bit and virtualization in Linux is to look at the output of: cat /proc/cpuinfo

The line(s) your looking for like something like this:
flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good nopl extd_apicid pni lahf_lm cmp_legacy

Depending on your hardware you may have many flag lines... the interesting flags which you need to look out for:

lm - 64bit support - (Long Mode - 64bit Extensions, AMD AMD64 or Intel EM64T)
vmx - Inter Virtualization - (Virtual Machine eXtensions)
svm - AMD Virtualization - (Secure Virtual Machine)

If the flags above appear you have support the the respective CPU feature. The easier way (but harder to remember) is to run:

64bit check: egrep -c ' lm ' /proc/cpuinfo
Virtualization check: egrep -c '( vmx | svm )' /proc/cpuinfo

The output above counts how many times the specified flag(s) appear, anything more than 0 indicates you have support.

No comments:

Post a Comment