Upgrades are inevitable. At some point during your server’s life, you may want to know exactly what is in your machine, in terms of RAM, Hard Drives, CPUs, etc., so that you can plan your upgrades without having to take the server down.
For situations like this, give lshw a spin. This stands for “LiSt HardWare”. In many cases, people use lspci to find out what hardware they’re using. It isn’t a bad tool, but it isn’t very complete, either.
test:~# lspci
00:00.0 Host bridge: Intel Corporation E7520 Memory Controller Hub (rev 09)
00:02.0 PCI bridge: Intel Corporation E7525/E7520/E7320 PCI Express Port A (rev 09)
00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)
00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev 02)
01:00.0 PCI bridge: Intel Corporation 6700PXH PCI Express-to-PCI Bridge A (rev 09)
01:00.1 PIC: Intel Corporation 6700/6702PXH I/OxAPIC Interrupt Controller A (rev 09)
01:00.2 PCI bridge: Intel Corporation 6700PXH PCI Express-to-PCI Bridge B (rev 09)
01:00.3 PIC: Intel Corporation 6700PXH I/OxAPIC Interrupt Controller B (rev 09)
02:04.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller (rev 05)
04:03.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller (rev 05)
04:0d.0 VGA compatible controller: ATI Technologies Inc Radeon RV100 QY [Radeon 7000/VE]
Sure, this gives me a pretty decent list of bridges, controllers, NIC cards, my video card, etc., but it really doesn’t give me any detailed info on the system. For instance, if I want to find out how big my hard drives are, I’ll need to issue a “df -h” command (and know the status of any RAID in the system). If I want to know how much RAM I have, I’ll need to issue a “free -m” command. It will tell me how much RAM i have, but it doesn’t tell me what kind of RAM i have, how dense the sticks are, and so forth. Enter lshw.
I’ll just let lshw speak for itself.
test:~# lshw
test.net
description: Rack Mount Chassis
product: PowerEdge SC1425
vendor: Dell Computer Corporation
serial: 36L7J71
width: 32 bits
capabilities: smbios-2.3 dmi-2.3 smp-1.4 smp
configuration: boot=normal chassis=rackmount cpus=2 uuid=44454C4C-3600-104C-
8037-B3C04F4A3731
*-core
description: Motherboard
product: 0D7449
vendor: Dell Computer Corporation
physical id: 0
version: A01
serial: ..CN7170354S0533.
*-firmware
description: BIOS
vendor: Dell Computer Corporation
physical id: 0
version: A01 (01/18/2005)
size: 64KiB
capacity: 960KiB
capabilities: isa pci pnp upgrade shadowing escd cdboot bootselect edd
int9keyboard int14serial int10video acpi usb ls120boot biosbootspecification ne
tboot
*-cpu:0
description: CPU
product: Intel(R) Xeon(TM) CPU 2.80GHz
vendor: Intel Corp.
physical id: 400
bus info: cpu@0
version: 15.4.1
serial: 0000-0F41-0000-0000-0000-0000
slot: PROC_1
size: 2800MHz
capacity: 3600MHz
width: 64 bits
clock: 800MHz
capabilities: boot fpu fpu_exception wp vme de pse tsc msr pae mce cx8
apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pb
e nx x86-64 constant_tsc pni monitor ds_cpl cid cx16 xtpr
configuration: id=7
*-cache:0
description: L1 cache
physical id: 700
size: 16KiB
capacity: 16KiB
capabilities: internal write-through data
*-cache:1
description: L2 cache
physical id: 701
size: 1MiB
capacity: 2MiB
capabilities: internal write-back unified
*-cache:2 DISABLED
description: L3 cache
physical id: 702
capacity: 8MiB
capabilities: internal write-back unified
*-logicalcpu:0
description: Logical CPU
physical id: 7.1
width: 64 bits
capabilities: logical
*-logicalcpu:1
description: Logical CPU
physical id: 7.2
width: 64 bits
capabilities: logical
*-cpu:1
description: CPU
product: Intel(R) Xeon(TM) CPU 2.80GHz
vendor: Intel Corp.
physical id: 401
bus info: cpu@1
version: 15.4.1
serial: 0000-0F41-0000-0000-0000-0000
slot: PROC_2
size: 2800MHz
capacity: 3600MHz
width: 64 bits
clock: 800MHz
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic
mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx
x86-64 constant_tsc pni monitor ds_cpl cid cx16 xtpr
configuration: id=7
*-cache:0
description: L1 cache
physical id: 703
size: 16KiB
capacity: 16KiB
This is just a snippet. Now, notice what we have here. A program that actually queries the system for EXACT specs. You will know exactly what type of CPU is in the machine, it even gives you serial numbers, speeds, capacities, and so on.
As to RAM:
*-memory
description: System Memory
physical id: 1000
slot: System board or motherboard
size: 4GiB
*-bank:0
description: DIMM Synchronous 400 MHz (2.5 ns)
vendor: 7F98000000000000
physical id: 0
serial: AC163D8B
slot: DIMM1_A
size: 1GiB
width: 64 bits
clock: 400MHz (2.5ns)
*-bank:1
description: DIMM Synchronous 400 MHz (2.5 ns)
vendor: 7F98000000000000
physical id: 1
serial: AE163B8B
slot: DIMM1_B
size: 1GiB
width: 64 bits
clock: 400MHz (2.5ns)
*-bank:2
description: DIMM Synchronous 400 MHz (2.5 ns)
vendor: 7F98000000000000
physical id: 2
serial: AC163C8B
slot: DIMM2_A
size: 1GiB
width: 64 bits
clock: 400MHz (2.5ns)
*-bank:3
description: DIMM Synchronous 400 MHz (2.5 ns)
vendor: 7F98000000000000
physical id: 3
serial: AE16108B
slot: DIMM2_B
size: 1GiB
width: 64 bits
clock: 400MHz (2.5ns)
*-bank:4
description: DIMM Synchronous 400 MHz (2.5 ns) [empty]
physical id: 4
slot: DIMM3_A
width: 64 bits
clock: 400MHz (2.5ns)
*-bank:5
description: DIMM Synchronous 400 MHz (2.5 ns) [empty]
physical id: 5
slot: DIMM3_B
width: 64 bits
clock: 400MHz (2.5ns)
Check THAT out. This lets me know exactly what is in each slot. It even gives me the slot ID (bank 1_A, 1_B, etc..). It even gives me the serial number.
So now, if you need to know what parts to replace in a machine, you can find out that information live, and be ready to go, without wasting any downtime cracking open the case. To me, this is invaluable information to be able to obtain for use in the datacenter. There are times where a server just can’t really go down. Why take it down twice, if you don’t have to?
I find that the majority of our customers use CentOS, by a pretty large margin. This is how to get it for CentOS. lshw is built into Debian/Ubuntu, or easily obtained with apt-get, for those systems.
You will need to add the RPMforge repositories to do this. I am adding the links for RHEL (Centos, same thing) 4 and 5. If you are still using 3 or below, I highly suggest that you update soon.
Just enter the line appropriate for your distro:
Red Hat Enterprise Linux 5 / i386:
Red Hat Enterprise Linux 5 / x86_64:
Red Hat Enterprise Linux 4 / i386:
Red Hat Enterprise Linux 4 / x86_64:
…and issue “yum update“. To install lshw, “yum install lshw“.
-JP