检查服务器上的 RAM 数量

检查服务器上的 RAM 数量

有没有办法检查服务器(无需打开并实际查看)机箱中的内存量(即有多少个可用插槽)。另外我需要知道它可以占用多少内存?

我知道我可以检查 /proc/meminfo 中的 RAM,但我更关心 RAM 的类型,有多少个插槽是空闲的/被占用的。也就是说,我需要知道我可以添加多少 RAM,以及要添加到特定类型的 RAM,但不知道如何去做。

答案1

除 之外,还有一个不错的工具dmidecodelshw

例如,

$ sudo lshw -short -C memory
H/W path               Device       Class      Description
==========================================================
/0/0                                memory     64KiB BIOS
/0/400/700                          memory     16KiB L1 cache
/0/400/701                          memory     1MiB L2 cache
/0/1000                             memory     2GiB System Memory
/0/1000/0                           memory     512MiB DIMM SDRAM Synchronous 400 MHz (2.5 
/0/1000/1                           memory     512MiB DIMM SDRAM Synchronous 400 MHz (2.5 
/0/1000/2                           memory     512MiB DIMM SDRAM Synchronous 400 MHz (2.5 
/0/1000/3                           memory     512MiB DIMM SDRAM Synchronous 400 MHz (2.5 

或者

$ sudo lshw -C memory
[...]

      *-cache:0
           description: L1 cache
           physical id: 700
           size: 16KiB
           capacity: 16KiB
           capabilities: internal write-back data
[...]
      *-memory
           description: System Memory
           physical id: 1000
           slot: System board or motherboard
           size: 2GiB
         *-bank:0
              description: DIMM SDRAM Synchronous 400 MHz (2.5 ns)
              physical id: 0
              slot: DIMM_1
              size: 512MiB
              width: 64 bits
              clock: 400MHz (2.5ns)
         *-bank:1
              description: DIMM SDRAM Synchronous 400 MHz (2.5 ns)
              physical id: 1
              slot: DIMM_3
              size: 512MiB
              width: 64 bits
              clock: 400MHz (2.5ns)
         *-bank:2
[...]

答案2

另一个选项是lshw命令(手册页) - 它提供很多东西的输出,包括 RAM 插槽。完整输出很长,但sudo lshw -short提供摘要,包括每个 RAM 插槽一行,无论插槽中是否有 RAM。或者提供有关 RAM 的完整信息,但省略您可以执行的其他所有操作sudo lshw -class memory

我得到的输出sudo lshw -short是:

H/W path               Device      Class          Description
=============================================================
                                   system         ESPRIMO E ()
/0                                 bus            D2348-A2
/0/0                               memory         109KiB BIOS
/0/4                               processor      Intel(R) Core(TM)2 CPU          6300  @ 1.86GHz
/0/4/6                             memory         2MiB L2 cache
/0/7                               memory         2MiB L3 cache
/0/25                              memory         6GiB System Memory
/0/25/0                            memory         2GiB DIMM DDR2 Synchronous 533 MHz (1.9 ns)
/0/25/1                            memory         1GiB DIMM DDR2 Synchronous 533 MHz (1.9 ns)
/0/25/2                            memory         2GiB DIMM DDR2 Synchronous 533 MHz (1.9 ns)
/0/25/3                            memory         1GiB DIMM DDR2 Synchronous 533 MHz (1.9 ns)
/0/100                             bridge         82Q963/Q965 Memory Controller Hub
/0/100/2                           display        82Q963/Q965 Integrated Graphics Controller
/0/100/3                           communication  82Q963/Q965 HECI Controller
/0/100/3.2                         storage        82Q963/Q965 PT IDER Controller
/0/100/3.3                         communication  82Q963/Q965 KT Controller
/0/100/19              eth0        network        82566DM Gigabit Network Connection
/0/100/1a                          bus            82801H (ICH8 Family) USB UHCI Controller #4
/0/100/1a.1                        bus            82801H (ICH8 Family) USB UHCI Controller #5
/0/100/1a.7                        bus            82801H (ICH8 Family) USB2 EHCI Controller #2
/0/100/1b                          multimedia     82801H (ICH8 Family) HD Audio Controller
/0/100/1d                          bus            82801H (ICH8 Family) USB UHCI Controller #1
/0/100/1d.1                        bus            82801H (ICH8 Family) USB UHCI Controller #2
/0/100/1d.2                        bus            82801H (ICH8 Family) USB UHCI Controller #3
/0/100/1d.7                        bus            82801H (ICH8 Family) USB2 EHCI Controller #1
/0/100/1e                          bridge         82801 PCI Bridge
/0/100/1f                          bridge         82801HO (ICH8DO) LPC Interface Controller
/0/100/1f.2            scsi0       storage        82801H (ICH8 Family) 4 port SATA IDE Controller
/0/100/1f.2/0          /dev/sda    disk           160GB ST3160812AS
/0/100/1f.2/0/1        /dev/sda1   volume         149GiB EXT4 volume
/0/100/1f.2/1          /dev/cdrom  disk           DVD-RAM GSA-H30N
/0/100/1f.3                        bus            82801H (ICH8 Family) SMBus Controller
/0/100/1f.5            scsi2       storage        82801H (ICH8 Family) 2 port SATA IDE Controller
/0/100/1f.5/0.0.0      /dev/sdb    disk           40GB KINGSTON SSDNow
/0/100/1f.5/0.0.0/1    /dev/sdb1   volume         31GiB EXT4 volume
/0/100/1f.5/0.0.0/2    /dev/sdb2   volume         5867MiB Extended partition
/0/100/1f.5/0.0.0/2/5  /dev/sdb5   volume         5867MiB Linux swap / Solaris partition
/1                                 power          S26113-E505-V80
/2                     wlan0       network        Wireless interface

我得到的输出sudo lshw -class memory是:

  *-firmware              
       description: BIOS
       vendor: FUJITSU SIEMENS // Phoenix Technologies Ltd.
       physical id: 0
       version: 6.00 R1.02.2348.A2
       date: 09/18/2006
       size: 109KiB
       capacity: 448KiB
       capabilities: pci pnp upgrade shadowing escd cdboot bootselect int13floppynec int13floppytoshiba int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification
  *-cache
       description: L2 cache
       physical id: 6
       slot: L2 Cache
       size: 2MiB
       capacity: 2MiB
       capabilities: burst internal write-back unified
  *-cache
       description: L3 cache
       physical id: 7
       slot: L3 Cache
       size: 2MiB
       capacity: 16MiB
       capabilities: burst internal write-back unified
  *-memory
       description: System Memory
       physical id: 25
       slot: System board or motherboard
       size: 6GiB
     *-bank:0
          description: DIMM DDR2 Synchronous 533 MHz (1.9 ns)
          physical id: 0
          slot: Slot-1
          size: 2GiB
          width: 40968 bits
          clock: 533MHz (1.9ns)
     *-bank:1
          description: DIMM DDR2 Synchronous 533 MHz (1.9 ns)
          physical id: 1
          slot: Slot-3
          size: 1GiB
          width: 41480 bits
          clock: 533MHz (1.9ns)
     *-bank:2
          description: DIMM DDR2 Synchronous 533 MHz (1.9 ns)
          physical id: 2
          slot: Slot-2
              size: 2GiB
          width: 41992 bits
          clock: 533MHz (1.9ns)
     *-bank:3
          description: DIMM DDR2 Synchronous 533 MHz (1.9 ns)
          physical id: 3
          slot: Slot-4
          size: 1GiB
          width: 42504 bits
          clock: 533MHz (1.9ns)

答案3

尝试

sudo dmidecode --type 17

# dmidecode 2.9
SMBIOS 2.4 present.
Handle 0x0018, DMI type 17, 27 bytes
Memory Device
        Array Handle: 0x0017
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 2048 MB
        Form Factor: DIMM
        Set: None
        Locator: J6H1
        Bank Locator: CHAN A DIMM 0
        Type: DDR2
        Type Detail: Synchronous
        Speed: 800 MHz (1.2 ns)
        Manufacturer: 0x2CFFFFFFFFFFFFFF
        Serial Number: 0x00000000
        Asset Tag: Unknown
        Part Number: 0x5A494F4E203830302D3247422D413131382D
Handle 0x001A, DMI type 17, 27 bytes
Memory Device
        Array Handle: 0x0017
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: J6H2
        Bank Locator: CHAN A DIMM 1
        Type: DDR2
        Type Detail: None
        Speed: Unknown
        Manufacturer: NO DIMM
        Serial Number: NO DIMM
        Asset Tag: NO DIMM
        Part Number: NO DIMM

如果 17 型记忆法不适合您,您可以尝试其他记忆法此处列出,例如 6 或 37。

相关内容