# Detect Xen / ESX



## Leander (Nov 29, 2013)

Hi,

When I boot FreeBSD I can read somewhere right in the beginning something about XENHVM. Now for some scripts I should need to know whether the FreeBSD is running on virtual or physical HW hardware. As well as it would be neat to know on what virtual platform it's running - e.g. Xen or ESX etc.

Thanks.


----------



## Leander (Nov 29, 2013)

OK, dmesg is the answer:  `dmesg  | grep -Ei "^XEN:[[:space:]]"`

Hope it helps someone


----------



## kpa (Nov 29, 2013)

I think this is a better way to extract the same information:

`sysctl -n kern.vm_guest`

```
# sysctl -d kern.vm_guest 
kern.vm_guest: Virtual machine guest detected? (none|generic|xen)
#
```

This is on FreeBSD 10, I'm not sure if the same sysctl(8) is available on FreeBSD 9.


----------



## Leander (Nov 29, 2013)

*N*ice*.*


----------

