Recognizing hardware on a current Linux system
dmesg
dmidecode
ipmi-tool
lshw
Hardware vendor/model
Bear in mind that DMI information is very dependent on the vendor's implementation, and is not always available.
On an HP desktop:
/sys/class/dmi/id/product_nameHP Compaq dc5800 Small Form Factor /sys/class/dmi/id/product_versionOn an IBM/Lenovo ThinkPad:
/sys/class/dmi/id/product_name1872V2B /sys/class/dmi/id/product_versionThinkPad T43Motherboard (mostly on desktops/laptops)
/sys/class/dmi/id/board_vendorHewlett-Packard /sys/class/dmi/id/board_name2820hlscpu from the util-linux package:
$ lscpuArchitecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 2On-line CPU(s) list: 0,1Thread(s) per core: 1Core(s) per socket: 2Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 23Stepping: 6CPU MHz: 2533.000BogoMIPS: 5053.73L1d cache: 32KL1i cache: 32KL2 cache: 3072KNUMA node0 CPU(s): 0,1You can use /proc/cpuinfo as well but it requires more parsing.
"physical id" = socket#
"cpu cores" = cores
"core id" = core# (not linear! separate numbering per socket! for example, you have the IDs 0 1 9 10 per each socket on a 4-core Xeon)
"siblings" = threads
Individual parameters can be found in sysfs.
Number of CPU cores and threads
HP dc5800 / Core2Duo E7200:
/sys/devices/system/cpu/online0-1ProLiant DL360 G7 / Xeon E5620:
/sys/devices/system/cpu/online0-15Number of threads in each core (SMP n-way)
E7200 (1-way):
/sys/devices/system/cpu/cpu0/topology/thread_siblings_list0E5620 (2-way):
/sys/devices/system/cpu/cpu0/topology/thread_siblings_list0,8Clock (frequency) in kHz
Maximum/Minimum
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq1733000 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq800000Current (root only)
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq2533000Frequency scaling governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand
Architecture
$ uname -px86_64Supported features
$ grep -m1 ^flags /proc/cpuinfoflags : 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 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm dts/proc/meminfo
/sys/devices/system/node/node0/meminfo
free -m (parses /proc/meminfo...)
vmstat -s -S M
Disks and partitions
Generic, basic information about physical devices (works on old Linux versions as well)
$ cat /proc/partitionsmajor minor #blocks name 8 0 120060864 sda 8 1 71680 sda1 8 2 119987200 sda2 253 0 119986172 dm-0 253 1 26214400 dm-1 253 2 20971520 dm-2 253 3 2097152 dm-3Block devices: physical location and hiearchy. Includes LVM (device-mapper) devices.
$ ls -l /sys/block/total 0lrwxrwxrwx 1 root root 0 Jan 12 11:43 dm-0 -> ../devices/virtual/block/dm-0lrwxrwxrwx 1 root root 0 Jan 11 14:15 dm-1 -> ../devices/virtual/block/dm-1lrwxrwxrwx 1 root root 0 Jan 11 14:15 dm-2 -> ../devices/virtual/block/dm-2lrwxrwxrwx 1 root root 0 Jan 11 14:15 dm-3 -> ../devices/virtual/block/dm-3lrwxrwxrwx 1 root root 0 Jan 11 14:15 sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sdalrwxrwxrwx 1 root root 0 Jan 12 11:43 sr0 -> ../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0The lsscsi command works with IDE and Serial ATA as well:
$ lsscsi -d[0:0:0:0] disk ATA Maxtor 6Y120M0 YAR5 /dev/sda [8:0][1:0:0:0] cd/dvd ATAPI DVD D DH16D3S SH37 /dev/sr0 [11:0]lsblk gives a nice detailed overview:
$ lsblk -aNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 114.5G 0 disk|-sda1 8:1 0 70M 0 part /boot`-sda2 8:2 0 114.4G 0 part `-cr_sda2 (dm-0) 253:0 0 114.4G 0 crypt |-system-home (dm-1) 253:1 0 25G 0 lvm /home |-system-root (dm-2) 253:2 0 20G 0 lvm / `-system-swap (dm-3) 253:3 0 2G 0 lvm [SWAP]sr0 11:0 1 1024M 0 romOptional columns (very rare with Linux utilities!) - most of them are available for root only:
# lsblk -n -o NAME,KNAME,FSTYPE,UUID,SIZE,TYPEsda sda 114.5G disk|-sda1 sda1 ext4 f16c1a22-83d5-477f-b9c1-2ab6e51e2a84 70M part`-sda2 sda2 crypto_LUKS 12c6a7c5-3aba-44d1-bf59-9ba9fcf2041d 114.4G part `-cr_sda2 (dm-0) dm-0 LVM2_member POILkH-7nel-5wjA-8iZZ-vwYB-4WBr-9kgBpc 114.4G crypt |-system-home (dm-1) dm-1 ext4 0e32fb87-3c8d-4e2b-b406-a6d035500188 25G lvm |-system-root (dm-2) dm-2 ext4 3dc2fc2b-931e-492c-bd73-c1241e55c10e 20G lvm `-system-swap (dm-3) dm-3 swap 16cb90d7-7d2f-4948-9b9b-a527e880d2bf 2G lvmsr0 sr0 1024M romA way to determine ATA port to device mapping
Details from dmesg:
[ 1.092442] ata1.00: ATA-7: Maxtor 6Y120M0, YAR51HW0, max UDMA/133[ 1.092121] ata2.00: ATAPI: ATAPI DVD D DH16D3S, SH37, max UDMA/100Note that ataX numbering starts from 1.
In the example, ata1 maps to host0 in the SCSI naming hierarchy, which can be identified by looking at the unique_id entry:
$ for host in $(find /sys/devices/pci*/*/host* -prune); do [ -d "$host"/target* ] && ls -d "$host"/target*/*/block/*; done/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sys/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0$ for host in $(find /sys/devices/pci*/*/host* -prune); do [ -d "$host"/target* ] && ls -1 "$host"/scsi_host/$(basename "$host")/unique_id; done/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id$ cat /sys/devices/pci0000\:00/0000\:00\:1f.2/host0/scsi_host/host0/unique_id1There is a separate tree for ata* devices in sysfs, without reference to the physical bus/host mapping.
$ ls -1d /sys/devices/pci*/*/ata*/sys/devices/pci0000:00/0000:00:1f.2/ata1/sys/devices/pci0000:00/0000:00:1f.2/ata2/sys/devices/pci0000:00/0000:00:1f.5/ata3/sys/devices/pci0000:00/0000:00:1f.5/ata4Filesystems
df -PTh -t ext3 -t ext4