Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
Larry Kruse
Larry Kruse
SSC-Enthusiastic
SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)

Group: General Forum Members
Points: 104 Visits: 746
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
benjamin.reyes
benjamin.reyes
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 2283
With VMWare having the VMware Tools installed, or in systray is a pretty good indicator.
dan-572483
dan-572483
SSChasing Mays
SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)

Group: General Forum Members
Points: 643 Visits: 1958
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.
Larry Kruse
Larry Kruse
SSC-Enthusiastic
SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)

Group: General Forum Members
Points: 104 Visits: 746
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.
ScottPletcher
ScottPletcher
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3946 Visits: 6686
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)

Prosecutor James Blackburn, in closing argument in the "Fatal Vision" murders trial: "If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them."
benjamin.reyes
benjamin.reyes
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 2283
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
andrewkane17
andrewkane17
SSC-Addicted
SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)SSC-Addicted (417 reputation)

Group: General Forum Members
Points: 417 Visits: 3208
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'



Perry Whittle
Perry Whittle
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8784 Visits: 16558
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" ;-)
dan-572483
dan-572483
SSChasing Mays
SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)

Group: General Forum Members
Points: 643 Visits: 1958
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.
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3114 Visits: 1439
You may find this link useful http://blogs.metcorpconsulting.com/tech/?p=40.




My blog

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search