در این مقاله میبینیم که چطور ما میتوانیم با استفاده از دستور Dmidecode اطلاعات سخت افزاری در هر سیستم لینوکس را بدست آوریم.فرضا ما برای upgrade یک سیستم نیاز به جمع آوری اطلاعاتی شبیه به Memory و BIOS و CPU و … داریم.با دستور Dmidecode ما می توانیم بدون باز کردن سیستم ،جزئیات سخت افزاری را بدانیم.دستور Dmidecode بر روی سیستم عامل های RHEL/CentOS/Fedora/Ubuntu کار میکند.
ابزار Dmidecode ،جدول DMI (بعضی ها به اسم SMBIOS آن را می شناسند) را می خواند و اطلاعات کاربردی از قبیل hardware details, serial numbers و ورژن BIOS و پردازشگر را به صورت کاملا خوانا نمایش میدهد.شما برای استفاده از دستور Dmidecode باید با کاربر root لاگین باشید.
۱-خروجی ساده از Dmidecode
# dmidecode 2.11 SMBIOS 2.6 present. 101 structures occupying 3552 bytes. Table at 0x000EAD50. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: American Megatrends Inc. Version: 1608 Release Date: 05/10/2011 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 4096 kB Characteristics: PCI is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported BIOS ROM is socketed EDD is supported 5.25\"/1.2 MB floppy services are supported (int 13h) 3.5\"/720 kB floppy services are supported (int 13h) 3.5\"/2.88 MB floppy services are supported (int 13h) Print screen service is supported (int 5h) 8042 keyboard services are supported (int 9h) Serial services are supported (int 14h) Printer services are supported (int 17h) ACPI is supported USB legacy is supported BIOS boot specification is supported Targeted content distribution is supported BIOS Revision: 4.6 :
۲-بدست آوردن انواع DMI
DMI Id اطلاعات سخت افزار خاصی را به ما می دهد.Dmidecode با آپشن “-t” یا “–type” و “Id” این اطلاعات را فراهم می کند.id ۰ به ما اطلاعات Bios را نشان می دهد.
[root@tazik ~]# dmidecode -t 0 # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: American Megatrends Inc. Version: 1608 Release Date: 05/10/2011 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 4096 kB Characteristics: PCI is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported BIOS ROM is socketed EDD is supported 5.25\"/1.2 MB floppy services are supported (int 13h) 3.5\"/720 kB floppy services are supported (int 13h) 3.5\"/2.88 MB floppy services are supported (int 13h) Print screen service is supported (int 5h) 8042 keyboard services are supported (int 9h) Serial services are supported (int 14h) Printer services are supported (int 17h) ACPI is supported USB legacy is supported BIOS boot specification is supported Targeted content distribution is supported BIOS Revision: 4.6 [root@tazik ~]#
جدول DMI :
Type Information ---------------------------------------- 0 BIOS 1 System 2 Base Board 3 Chassis 4 Processor 5 Memory Controller 6 Memory Module 7 Cache 8 Port Connector 9 System Slots 10 On Board Devices 11 OEM Strings 12 System Configuration Options 13 BIOS Language 14 Group Associations 15 System Event Log 16 Physical Memory Array 17 Memory Device 18 32-bit Memory Error 19 Memory Array Mapped Address 20 Memory Device Mapped Address 21 Built-in Pointing Device 22 Portable Battery 23 System Reset 24 Hardware Security 25 System Power Controls 26 Voltage Probe 27 Cooling Device 28 Temperature Probe 29 Electrical Current Probe 30 Out-of-band Remote Access 31 Boot Integrity Services 32 System Boot 33 64-bit Memory Error 34 Management Device 35 Management Device Component 36 Management Device Threshold Data 37 Memory Channel 38 IPMI Device 39 Power Supply
بجای “type_id” شما می توانید از keyword های زیر به همراه “-t” هم استفاده کنید:
Keyword Types ------------------------------ bios 0, 13 system 1, 12, 15, 23, 32 baseboard 2, 10 chassis 3 processor 4 memory 5, 6, 16, 17 cache 7 connector 8 slot 9
برای مثال ما اطلاعات Cache روی سیستم ،با نوشتن cache بجای استفاده از Id 7 بدست می آوریم.
[root@tazik ~]# dmidecode -t cache # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0005, DMI type 7, 19 bytes Cache Information Socket Designation: L1-Cache Configuration: Enabled, Not Socketed, Level 1 Operational Mode: Write Back Location: Internal Installed Size: 256 kB Maximum Size: 256 kB Supported SRAM Types: Other Installed SRAM Type: Other Speed: Unknown Error Correction Type: None System Type: Unified Associativity: 8-way Set-associative Handle 0x0006, DMI type 7, 19 bytes Cache Information Socket Designation: L2-Cache Configuration: Enabled, Not Socketed, Level 2 Operational Mode: Varies With Memory Address Location: Internal Installed Size: 1024 kB Maximum Size: 1024 kB Supported SRAM Types: Other Installed SRAM Type: Other Speed: Unknown Error Correction Type: None System Type: Unified Associativity: 8-way Set-associative Handle 0x0007, DMI type 7, 19 bytes Cache Information Socket Designation: L3-Cache Configuration: Disabled, Not Socketed, Level 3 Operational Mode: Unknown Location: Internal Installed Size: 6144 kB Maximum Size: 6144 kB Supported SRAM Types: Other Installed SRAM Type: Other Speed: Unknown Error Correction Type: None System Type: Unified Associativity: Other [root@tazik ~]#
۳- روش بدست آوردن مشخصات Memory
من چطور می توانم بفهمم که سیستم من چه میزان Memory پشتیبانی می کند؟طبق این دستور ،میزان پشتیبانی سیستم من ۳۲ GB می باشد.
[root@tazik ~]# dmidecode -t 16 # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0024, DMI type 16, 15 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 32 GB Error Information Handle: No Error Number Of Devices: 4
نکته:
برطبق لیست keyword ،اطلاعات مربوط به memory ،ID های ۵, ۶, ۱۶ و ۱۷ می باشند.
۴- بدست آوردن Manufacturer و مدل و سریال نامبر :
برای بدست آوردن Manufacturer و مدل و سریال نامبر از سیستم باید از دستور زیر استفاده کنید:
[root@tazik ~]# dmidecode -t system # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: System manufacturer Product Name: System Product Name Version: System Version Serial Number: System Serial Number UUID: 1E008C40-008C-3F00-5DA5-BCAEC57527F3 Wake-up Type: Power Switch SKU Number: To be filled by O.E.M. Family: To be filled by O.E.M. Handle 0x0023, DMI type 12, 5 bytes System Configuration Options Option 1: To Be Filled By O.E.M. Handle 0x0033, DMI type 32, 20 bytes System Boot Information Status: No errors detected
اگر در بعضی از قسمت ها مثل Manufacturer و Product Name مشاهده کردید که اطلاعات کامل نیستند ،این به این خاطر هست که Manufacturer سیستم شما آن اطلاعات را وارد نکرده است.
برای اطلاعات بیشتر در ترمینال خود از دستور man dmidecode استفاده کنید.
Cheers !