cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 2,322 Views

Red Hat Linux Interview Series 1

Q.) How do you identify if you have logged into a physical linux server or a virtual linux server?

 

Q.) How would you diagnose and resolve a sudden spike in a RHEL server CPU usage?

 

Q.) What do you mean by Swap memory / space ? and how does it help in the efficient usage of system memory ?

 

I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.

Labels (8)
5 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 2,283 Views

These are the kind of questions that will expand the knowledge base!

Let's have a look at that first question: 
"How do you identify if you have logged into a physical linux server or a virtual linux server?"

A truly great question!!!

There are several approaches (linux commands) to gathering information to answer this 
question.  Let's start with one that most of the community may have been exposed
to:   lshw

When lshw is executed, it spits out a lot of wonderful info, but we're only going to
target 2 lines of the output, that will identify the host being either a physical machine
or a virtual machine. 

The 2 lines are:
Product
Vendor

If the host is a physical machine, then you can expect to see the name of vendor
that manufactures computer systems (e.g. Dell, HP, Lenovo, Acer, etc.).

I'm running Fedora on a very old laptop (but it still gets the job done very well that I
require), and here's what those 2 lines display:

Product: Dell Latitude E6410           
Vendor: Dell Inc.

Executing that same lshw  command on a virtual machine (one of the VMs in the
Red Hat Interactive Labs platform), those same 2 lines display the following:

Product: Google Compute Engine
Vendor: Google

Google Compute Engine?  Really?  I know Google develops a great many things,
but I don't think computer hardware manufacturing is a part of their domain.

When executing the lswh command on a VM, the information that you will see,
obviously, will depend on the virtualization software!

In summary, if the system is a physical machine, then you'll see the name of a
recognizable computer manufacturer.  If not, then the system is a VM!!!

Another command that I'll get into in a separate post is the dmidecode command.
A true jewel of a command!

I'll stop here, and let the lshw command serve as the appetizer, and follow it up with
a portion of the entree.  Oh, and don't laugh at me about my laptop.  I did admit that 
it was old

 

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 2,254 Views

@Trevor wonderful explanation!

  • 1,552 Views

Answer of 1st question.

Use #hostnamectl or #lscpu

Hardware Vendor: VMware, Inc.
Hardware Model: VMware Virtual Platform
 

grundblom
Flight Engineer Flight Engineer
Flight Engineer
  • 1,480 Views

@Akashfanase99Thank you, I did not know hostnamectl had Chassis, Virtualization, and  Hardware Vendor fields.

 

- Glen
P.S. I love mono spaced fonts
sjsp
Flight Engineer
Flight Engineer
  • 448 Views

dmidecode -s system-product-name

Join the discussion
You must log in to join this conversation.