LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2009, 07:16 AM   #1
surya_prakash
LQ Newbie
 
Registered: Oct 2008
Location: Hyderabad
Posts: 26

Rep: Reputation: 15
detect underlying Hardware


Hi,
All

Is there any method to know whether linux is installed directly on harware or on some virtualisation product like(VMware,citrix xen server,virtual iron,Hyper-V)

Thanks
prakash
 
Old 03-25-2009, 07:21 AM   #2
rizwanrafique
Member
 
Registered: Jul 2006
Distribution: Debian, Ubuntu, openSUSE, CentOS
Posts: 147

Rep: Reputation: 19
I would use dmidecode, lspci or lshw to see what hardware I've and check manufacturer information for BIOS or PCI devices etc.
 
Old 03-25-2009, 07:36 AM   #3
surya_prakash
LQ Newbie
 
Registered: Oct 2008
Location: Hyderabad
Posts: 26

Original Poster
Rep: Reputation: 15
I came to know that Operating system has some tables called IDT(Interrupt descriptor table).By view IDTR address we can say whether it is installed on Hardware or on some hypervisor.But i found this method work good only for single processor systems.And giving unexpected results for multi processor systems.
 
Old 03-25-2009, 08:14 AM   #4
surya_prakash
LQ Newbie
 
Registered: Oct 2008
Location: Hyderabad
Posts: 26

Original Poster
Rep: Reputation: 15
I used the following program to detect if it is VM or Hardware



#include <stdio.h>
#include <stdlib.h>

struct idtr {
unsigned short limit;
unsigned int base;
} __attribute__ ((packed));

unsigned int get_addr_idt() {
struct idtr idtr;
asm("sidt %0" : "=m" (idtr));
return idtr.base;
}
int main(int argc, char ** argv)
{
unsigned int ptr_idt;

ptr_idt=get_addr_idt();
printf("IDT Addr %p \n",ptr_idt);
if ( (ptr_idt>>24)==0xc0)
printf("Real Linux\n");
else printf("Maybe in VMware\n");
return 0;
}

But this works only for single processor systems
 
  


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
detect hardware ust Linux - Newbie 1 11-17-2008 01:05 AM
re-detect deleted hardware icechong Linux - Newbie 1 12-13-2006 05:09 AM
Hardware detect and configure Drunkalot Linux - Software 2 09-24-2004 08:55 PM
what is the command to detect hardware yenonn Solaris / OpenSolaris 1 04-07-2004 04:31 AM
How to detect hardware hotrodowner Linux - Hardware 1 06-11-2002 10:57 AM


All times are GMT -5. The time now is 07:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration