LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-14-2011, 04:24 PM   #1
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 207
Blog Entries: 3

Rep: Reputation: 16
how to know the remote machine is Virtual machine or physical machine


Hi All,

when i see the out put of cat /proc/cpuinfo
48bit for vm
38bit for physical

or their is any way to identify that this is a vm or physical machine


Thanks
dk
 
Old 11-14-2011, 04:41 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,058

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
Hi there,

Quote:
Originally Posted by pantdk View Post
when i see the out put of cat /proc/cpuinfo
48bit for vm
38bit for physical
that looks like lottery numbers to me. Neither of these make sense.

Quote:
Originally Posted by pantdk View Post
or their is any way to identify that this is a vm or physical machine
If the virtualization software is any good, you cannot tell the difference between a virtual and a physical machine by software. That's the idea, after all. There may be some subtle hints from which you can guess that you're running on or talking to a VM; but generally, the intention is that the VM is not distinguishable from a real physical machine.

[X] Doc CPU
 
Old 11-14-2011, 05:05 PM   #3
kbscores
Member
 
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Blog Entries: 9

Rep: Reputation: 32
Usually there is a specific set of tools on a box that is a vm client. It would vary depending virtual system used. For instance VMware has a VMware-toolkit on its clients.


AND - What he/she is referring to is address sizes

which in this case really has no reference to a "virtual machine"

The virtual aspect there refers to memory.

CPU cores can be virtual as well as physical. For instance usually w/an 8 core processor 4 of them are physical and other 4 are virtual.

That just specifies how many bits can fit in each address or "memory slot"

Below is a good image on wikipedia that shows dataflow in an 8 core processor

http://upload.wikimedia.org/wikipedi..._core_CPU).PNG
 
Old 11-14-2011, 05:06 PM   #4
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 207
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Hi
its not a lottery numbers & focus on my machine out put this could be a ESX or vm on ESX ????

I am getting the access from ssh (putty) & i need to fill some inventory sheets so that,s why i needed these information

Quote:
$ cat /proc/cpuinfo |more
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU X5660 @ 2.80GHz
stepping : 2
cpu MHz : 2799.204
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_
tsc ida nonstop_tsc pni cx16 popcnt lahf_lm
bogomips : 5598.40
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU X5660 @ 2.80GHz
stepping : 2
cpu MHz : 2799.204
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_
tsc ida nonstop_tsc pni cx16 popcnt lahf_lm
bogomips : 5597.70
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU X5660 @ 2.80GHz
stepping : 2
cpu MHz : 2799.204
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_
tsc ida nonstop_tsc pni cx16 popcnt lahf_lm
bogomips : 5598.32
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]

Last edited by pantdk; 11-14-2011 at 05:11 PM.
 
Old 11-14-2011, 05:15 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
I just ran this command in one of my virtual system, and found several /proc files that contained virt inside them.

find /proc -type f -exec grep -l virt '{}' 2>/dev/null ';' 2>/dev/null

Perhaps a check for virtio_balloon.*Live in /proc/modules would do the trick. That one is alive in my virtual systems but not in the host system. (virtio_net is live in the host and the virtuals.) If you've accessed the system over a network, I think that the virtio net access stuff needs to be running. But I'm not a virtual developer, and one of them might have a better answer.
 
Old 11-14-2011, 05:38 PM   #6
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
That line in the output has nothing to do with running in a vm, it's part of Physical Address Extensions.

Detecting if a host is running within a virtual machine is tricky because you have to rely on specific odd behaviours in each virtualiser.

Have a look at Detect if you are Running a Virtual Machine | CodeHill or How to detect virtualization or any number of other pages for some ideas and some scripts you can examine.
 
Old 11-14-2011, 06:00 PM   #7
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by pantdk View Post
when i see the out put of cat /proc/cpuinfo
48bit for vm
38bit for physical
I think it would be unusual for CPU info from /proc/cpuinfo in a virtual machine to differ from the info of the underlying machine. That would mean the virtualization software has gone to extra effort to do a worse job of simulating a real CPU.

Anyway, 48bit virtual addressing should be standard across all X86_64 CPUs regardless of physical machine vs. virtual machine, while physical addressing will vary by CPU, 38bit is a reasonable amount and I can't think of any reason virtualization software might want to pretend the physical addressing is different from that of the real CPU.

The words "virtual" and "physical" in computer systems have many different meanings. Maybe you did a blind search on those words. "Virtual machine" is a specific computer concept that is quite different from the many other things that "virtual" means.

The links SecretCode provided look plausible to me. I'm not at all expert in how to detect a virtual machine. I'm only saying that /proc/cpuinfo is not likely to be a good place to try to get that answer.

Last edited by johnsfine; 11-14-2011 at 06:03 PM.
 
Old 11-15-2011, 12:38 PM   #8
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 207
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Thanks to all(johnsfine,renholme,SecretCode,kbscores,Doc CPU)

now i found the simplest command

Quote:
dmidecode |grep -i "vm"
 
1 members found this post helpful.
Old 11-16-2011, 03:38 PM   #9
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 259

Rep: Reputation: 29
interesting

dmidecode by itself I found virtual mentioned a few times

dmidecode | grep -i "Virtual"

Version: VirtualBox
Product Name: VirtualBox
Family: Virtual Machine
 
Old 11-16-2011, 07:54 PM   #10
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
I don't think that dmidecode | grep -i vm is (close to) infallible.

On my host system I get
Code:
$ sudo dmidecode | grep -i vm
                VME (Virtual mode extension)
$
while, on the virtual system I get
Code:
$ sudo dmidecode | grep -i vm
$
 
Old 11-17-2011, 10:28 AM   #11
samtoddler
Member
 
Registered: Jul 2011
Location: Delhi
Distribution: Cent OS/RHEL
Posts: 37

Rep: Reputation: Disabled
Hi,

I got the same output on my VPS which is a virtual machine.

Code:
[root@localhost ~]# dmidecode  | grep -i "vm"
	Manufacturer: VMware, Inc.
	Product Name: VMware Virtual Platform
	Serial Number: VMware-56 4d d6 6c 32 aa e1 46-46 8b e8 da 78 cb 78 ef
		VME (Virtual mode extension)
	Description: VMware SVGA II
	String 1: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]
but when i ran the above command this give me output

Code:
dmidecode | grep -i vm
                VME (Virtual mode extension)
Can we just believe on the same output to decide that the machine is virtual. I've tested this on near 10 machines
it works the same way.
 
Old 11-17-2011, 07:40 PM   #12
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 207
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Hi All,


So is their is any better way to find that this is a physical or virtual machine.

When i am looking for the difference between the VM or physical machine i notice that virtual machine have all most same output

this is the output which i am getting from the vmware workstation 8 rhel5.5 & ESX Virtual machine


Quote:
[dk@localhost ~]$ sudo /usr/sbin/dmidecode |grep -i "vm"
[sudo] password for dk:
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Serial Number: VMware-56 4d 88 82 d2 6b 27 d1-d6 b2 e3 9b d8 82 43 f0
Description: VMware SVGA II
String 1: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]
[dk@localhost ~]$
This is the output from ESX box virtual machine rhel5.5

Quote:
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Serial Number: VMware-42 24 73 1e 48 88 83 3b-bd 53 7e c8 1c d3 cc b1
VME (Virtual mode extension)
VME (Virtual mode extension)
VME (Virtual mode extension)
VME (Virtual mode extension)
Description: VMware SVGA II
String 1: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]

Last edited by pantdk; 11-17-2011 at 07:43 PM.
 
Old 11-17-2011, 10:08 PM   #13
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
That is true because you were (obviously) using VMware as your virtual manager. Not every virtual system uses VMware.

In fact, I have my virtuals running under qemu-kvm using Fedora's virtual manager, and, as I noted above, the suggested "test" does not produce any output when run on a Fedora 17 virtual system.

The virt-what script (in the first reference of post 6 by Secret Code) returns KVM for that virtual system.
 
Old 11-19-2011, 04:39 AM   #14
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 207
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Hi PTrenholme,

"Thanks for view"
yes that's right every virtual system doesn't uses VMware so their out put dmidecode | grep -i "vm" also not same.
but i have to differentiate between the vm & physical so that's why i do that.

Last edited by pantdk; 11-19-2011 at 04:40 AM.
 
Old 11-19-2011, 12:11 PM   #15
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
A thought: If you use the converse of your original question to ask "How can I tell if I'm running on a non-virtual system?" would the reply of "VME (Virtual mode extension)" be sufficient? (Assuming, of course, that anyone offing a server of which would want to ask the question would be using a modern processor.)
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP: Get count of files on a remote machine directory to the source Linux machine mamu Linux - Newbie 3 10-28-2011 05:10 PM
Interconnect a Virtual machine in linux to Real machine in windows xp lola1987 Linux - Networking 2 06-05-2011 04:31 PM
router - win machine - vmware workstation - solusvm - virtual machine vmicovic Linux - Networking 2 05-01-2011 06:22 PM
Make virtual machine from many physical PCs galg Linux - Virtualization and Cloud 7 11-02-2010 03:34 PM
Is This Machine Physical or Virtual? unixanalyst Linux - Hardware 5 10-11-2009 05:24 AM


All times are GMT -5. The time now is 08:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration