หลังการติดตั้งลีนุกซ์เสร็จทุกครั้่ง ก่อนจะคอนฟิกแล้วนำไปใช้งาน แนะนำให้ใช้คำสั่งลีนุกซ์ ดูฮาร์ดแวร์ของเครื่อง เพื่อตรวจสอบความถูกต้องว่าเราลงถูกต้อง ครบถ้วนไหม
ในที่นี้จะแนะนำคำสั่งเพื่อตรวจสอบฮาร์ดแวร์หลัก 3 ส่วนคือ CPU, Memory และ Disk
CPU
ใช้คำสั่ง lscpu เพื่อดูข้อมูลโดยรวมของ CPU เครื่องได้
ตัวอย่างผลลัพธ์ที่ได้
[root@cent6 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 4
Thread(s) per core: 1
Core(s) per socket: 4
CPU socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 15
Stepping: 11
CPU MHz: 2659.626
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
หรือหากต้องการดูรายละเอียดของ CPU ในแต่ละ core เลย สามารถทำได้โดยใช้คำสั่ง cat อ่านไฟล์ /proc/cpuinfo
ผลลัพธ์จะแสดงรายละเอียดขึ้นมาทั้งหมด (ในตัวอย่างนี้ตัดมาเฉพาะ 2 core แรก)
[root@cent6 ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 11
cpu MHz : 2659.626
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi
bogomips : 5319.25
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU X5355 @ 2.66GHz
stepping : 11
cpu MHz : 2659.626
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi
bogomips : 5320.01
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
...
Memory
สำหรับหน่วยความจำ หากต้องการดูแค่ขนาดรวม memory ที่ลีนุกซ์เห็นและใช้งานได้ ให้ใช้คำสั่ง free แล้วดูส่วน total จะเป็นขนาดของหน่วยความจำรวมของเครื่อง ผลลัพธ์ที่แสดงโดยดีฟอลต์จะเป็นหน่วย kB (kilo bytes)
[root@cent6 ~]# free
total used free shared buffers cached
Mem: 1020756 258060 762696 0 20140 106752
-/+ buffers/cache: 131168 889588
Swap: 2097144 0 2097144
เช่น เครื่องนี้มีขนาดหน่วยความจำ (memory) 1020756 kB หรือประมาณ 1 GB
แต่หากต้องการดูรายละเอียดถึงฮาร์ดแวร์เลยว่า มี memory กี่แผง กี่สล๊อต ต้องใช้คำสั่ง dmidecode ซึ่งค่อนข้างดูยากพอสมควร และแตกต่างกันตามชนิดของฮาร์ดแวร์
แนะนำให้ดูจาก BIOS หรือพอร์ต Management (out-of-band) ของเครื่องจะง่ายกว่า แล้วใช้คำสั่ง free เพื่อดูผลรวมของ memory ที่ลีนุกซ์เห็น
Disk
ใช้คำสั่ง fdisk -l เพื่อดูดิสก์ทั้งหมดที่ต่ออยู่ ผลลัพธ์ที่ได้ จะแสดงชื่อดิสก์ที่ลีนุกซ์ใช้ เช่น /dev/sda ขนาดฮาร์ดดิสก์ (500 GB) และข้อมูลการแบ่งพาร์ทิชั่น
[root@cent6 ~]# fdisk -l
Disk /dev/sda: 500 GB, 500007860016 bytes
255 heads, 63 sectors/track, 60800 cylinders
Units = cylinders of 16065 * 512 = 8225180 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 204800 83 Linux
/dev/sda2 26 12773 102400000 83 Linux
/dev/sda3 12774 14804 16380000 82 Linux swap / Solaris
หากต้องการดูรายละเอียดของฮาร์ดดิสก์ เช่นยี่ห้อ รุ่น serial number ต้องใช้คำสั่ง hdparm ออปชั่น ‘-I’ แล้วตามด้วยชื่อดิสก์ที่ต้องการดู
[root@cent6 ~]# hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: ST3500640A
Serial Number: 123456789
Firmware Revision: 3.0
เช่นเดียวกับการตรวจสอบหน่วยความจำ (memory) ผลลัพธ์ที่ได้ อาจแตกต่างกันไป บางเครื่องหรือดิสก์บางรุ่นก็ดูไม่ได้ ขึ้นอยู่กับชนิดของฮาร์ดแวร์ เพื่อความง่ายแนะนำให้ใช้ BIOS ของเครื่องตรวจสอบรายละเอียด