Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Is there a way to tell if a box is really a VM or physical server? Expand / Collapse
Author
Message
Posted Friday, September 28, 2012 10:25 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, November 21, 2014 2:20 PM
Points: 94, Visits: 679
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
Post #1366002
Posted Friday, September 28, 2012 11:09 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 11:58 AM
Points: 257, Visits: 1,569
With VMWare having the VMware Tools installed, or in systray is a pretty good indicator.
Post #1366029
Posted Friday, September 28, 2012 12:03 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 3:23 PM
Points: 557, Visits: 1,637
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.
Post #1366056
Posted Friday, September 28, 2012 12:06 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, November 21, 2014 2:20 PM
Points: 94, Visits: 679
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.
Post #1366057
Posted Friday, September 28, 2012 1:24 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:09 AM
Points: 2,268, Visits: 3,429
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)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1366084
Posted Friday, September 28, 2012 2:17 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 11:58 AM
Points: 257, Visits: 1,569
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
Post #1366113
Posted Friday, September 28, 2012 3:52 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Saturday, November 1, 2014 5:07 AM
Points: 414, Visits: 2,899
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'



Post #1366130
Posted Saturday, September 29, 2012 9:48 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:21 AM
Points: 6,643, Visits: 14,230
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"
Post #1366199
Posted Monday, October 1, 2012 10:48 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 3:23 PM
Points: 557, Visits: 1,637
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.
Post #1366660
Posted Monday, October 1, 2012 1:24 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 3:47 PM
Points: 3,087, Visits: 1,437
You may find this link useful http://blogs.metcorpconsulting.com/tech/?p=40.




My blog
Post #1366734
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse