Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
11-14-2011, 03:24 PM
|
#1
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Rep:
|
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
|
|
|
11-14-2011, 03:41 PM
|
#2
|
Senior Member
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099
|
Hi there,
Quote:
Originally Posted by pantdk
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
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
|
|
|
11-14-2011, 04:05 PM
|
#3
|
Member
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Rep:
|
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
|
|
|
11-14-2011, 04:06 PM
|
#4
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
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 04:11 PM.
|
|
|
11-14-2011, 04:15 PM
|
#5
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
11-14-2011, 05:00 PM
|
#7
|
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286
|
Quote:
Originally Posted by pantdk
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 05:03 PM.
|
|
|
11-15-2011, 11:38 AM
|
#8
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
Thanks to all(johnsfine,renholme,SecretCode,kbscores,Doc CPU)
now i found the simplest command
|
|
1 members found this post helpful.
|
11-16-2011, 02:38 PM
|
#9
|
Senior Member
Registered: Dec 2002
Distribution: slackware!
Posts: 1,398
|
interesting
dmidecode by itself I found virtual mentioned a few times
dmidecode | grep -i "Virtual"
Version: VirtualBox
Product Name: VirtualBox
Family: Virtual Machine
|
|
|
11-16-2011, 06:54 PM
|
#10
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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
$
|
|
|
11-17-2011, 09:28 AM
|
#11
|
Member
Registered: Jul 2011
Location: Delhi
Distribution: Cent OS/RHEL
Posts: 37
Rep: 
|
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.
|
|
|
11-17-2011, 06:40 PM
|
#12
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
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 06:43 PM.
|
|
|
11-17-2011, 09:08 PM
|
#13
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
11-19-2011, 03:39 AM
|
#14
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
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 03:40 AM.
|
|
|
11-19-2011, 11:11 AM
|
#15
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
All times are GMT -5. The time now is 10:59 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|