Is there a way to tell if a box is really a VM or physical server?

  • We have infrasctructure folks that setup and configure hardware when we need a new SQL Server for something.

    Once the server team turns it over to us, they provide me a name and say "Here's your server name."

    In turn, I use RDC to connect up to that machine and begin installing the SQL Server instance etc.

    But once I get onto it, is there a way that I can easily tell if I've been provided a physical server or a VM shared amongst 5 other SQL Server instances?

    We're seeing some strange stuff on one of our servers, and if I didn't know better, then I'd swear that the symptoms are more like those of a loaded-down VM.

    Is there perhaps a DMV query that might yield this information?

    Thanks for your thoughts.

    Larry

  • With VMWare having the VMware Tools installed, or in systray is a pretty good indicator.

  • I just opened Device Manager on a VM I use and saw "VMWare" listed in the descriptions for the Disk Drive, Display and DVD/CD-ROM devices.

  • True dat Benjamin, but you can click an option to hide that VM Tool icon in the sys-tray.

    I was hoping that there might be a DMV which might be able to detect it. A sneaky infrastructure builder could mask it if they wanted to conceal the fact that you might be running on a VM. We've put up several VMs with SAN-based storage, the C: drives even appear as Local drives.

    Hmmm...way back when, I was a mainframe system programmer. We ran IBM's VM operating system, but we could easily spin up an MVS machine under a VM and neither the OS or users of it could tell that they weren't running under VM.

    Thanks for the tip though.

  • You could try:

    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')

    If that doesn't work, there are SERVERPROPERTY parameters that aren't documented: you might try poking around for some of those and see if any of them help :-).

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • ScottPletcher (9/28/2012)


    You could try:

    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')

    If that doesn't work, there are SERVERPROPERTY parameters that aren't documented: you might try poking around for some of those and see if any of them help :-).

    That doesn't seem to work on my VMs. I don't think there is anything built into sql server that would give you that visability. I don't know that sql server would/should care that much at this point.

    I did find from the following thread just typing systeminfo into a cmd line will tell you. But I'd imagine if a really clever admin could obscure basically anything about a machine, though I doubt they would as that usually means a lot more admin overhead.

    http://serverfault.com/questions/109154/how-do-i-know-if-im-working-on-a-virtual-machine-or-not

  • This is how I collect it, might work for you:

    DECLARE

    @value VARCHAR(64),

    @key VARCHAR(512)

    set @key = 'HARDWARE\DESCRIPTION\System\BIOS\';

    EXEC master..xp_regread

    @rootkey = 'HKEY_LOCAL_MACHINE',

    @key = @key,

    @value_name = 'SystemProductName',

    @value = @value OUTPUT;

    SELECT @value as 'SystemProductName'

  • Larry Kruse (9/28/2012)


    True dat Benjamin, but you can click an option to hide that VM Tool icon in the sys-tray.

    I was hoping that there might be a DMV which might be able to detect it. A sneaky infrastructure builder could mask it if they wanted to conceal the fact that you might be running on a VM. We've put up several VMs with SAN-based storage, the C: drives even appear as Local drives.

    Hmmm...way back when, I was a mainframe system programmer. We ran IBM's VM operating system, but we could easily spin up an MVS machine under a VM and neither the OS or users of it could tell that they weren't running under VM.

    Thanks for the tip though.

    You can hide the icon from the system tray but the windows services will still be there

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • ScottPletcher (9/28/2012)


    You could try:

    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')

    This command returns the machine name for me. Interestingly, if you run it on a Named Instance or a multi-node clustered instance it returns the name of the machine that is currently running SQL, which might be useful.

    As for determining if a maching you're RDP'ing on is virtual, looking at the Disks Drives in Device Manager makes it clear: "VMWare Virtual Disk." Don't know about Hyper-V or other platforms.

  • You may find this link useful http://blogs.metcorpconsulting.com/tech/?p=40.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply