Install lshw
yum install lshw
lshw -class memory
View
Чтобы определить количество слотов памяти на сервере или компьютере под управлением CentOS или другого дистрибутива Linux, можно воспользоваться командой lshw (Linux Hardware). Этот инструмент позволяет детально изучить аппаратное обеспечение системы, включая память.
Шаги для проверки количества слотов памяти:
Установите пакет lshw, если он ещё не установлен:
# Для CentOS/RHEL
sudo yum install lshw
Или
для Debian/Ubuntu:
sudo apt-get update && sudo apt-get install lshw
Запустите команду для вывода подробной информации о слотах памяти:
Чтобы увидеть конкретные слоты памяти и их состояние, выполните следующую команду:
sudo lshw -class memory | grep -A 8 ‘bank’
Эта команда покажет вам всю доступную информацию о модулях оперативной памяти, включая количество слотов (slots), доступные модули и заполненность каждого из них.
Примеры вывода команды:
[root@hydra ~]# lshw -class memory
*-firmware
description: BIOS
vendor: American Megatrends Inc.
physical id: 0
version: 3.5c
date: 03/18/2016
size: 64KiB
capacity: 2MiB
capabilities: isa pci pnp upgrade shadowing escd cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification
*-cache:0
description: L1 cache
physical id: 5
slot: L1-Cache
size: 768KiB
capacity: 768KiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=1
*-cache:1
description: L2 cache
physical id: 6
slot: L2-Cache
size: 16MiB
capacity: 16MiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=2
*-cache:2
description: L3 cache
physical id: 7
slot: L3-Cache
size: 12MiB
capacity: 12MiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=3
*-cache:0
description: L1 cache
physical id: 9
slot: L1-Cache
size: 768KiB
capacity: 768KiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=1
*-cache:1
description: L2 cache
physical id: a
slot: L2-Cache
size: 16MiB
capacity: 16MiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=2
*-cache:2
description: L3 cache
physical id: b
slot: L3-Cache
size: 12MiB
capacity: 12MiB
clock: 1GHz (1.0ns)
capabilities: pipeline-burst internal write-back unified
configuration: level=3
*-memory
description: System Memory
physical id: 11
slot: System board or motherboard
size: 64GiB
capabilities: ecc
configuration: errordetection=multi-bit-ecc
*-bank:0
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: M393B5270CH0-CH9
vendor: Samsung
physical id: 0
serial: 483EB2EB
slot: P1_DIMM1B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:1
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: M393B5270CH0-CH9
vendor: Samsung
physical id: 1
serial: 483EB2F1
slot: P1_DIMM1A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:2
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: HMT151R7BFR4C-H9
vendor: Hynix
physical id: 2
serial: 2324A9EB
slot: P1_DIMM2B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:3
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: HMT151R7BFR4C-H9
vendor: Hynix
physical id: 3
serial: 0D64816E
slot: P1_DIMM2A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:4
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: 4
serial: D31CED11
slot: P1_DIMM3B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:5
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: 5
serial: D51CEA78
slot: P1_DIMM3A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:6
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: 6
serial: E51C1B1F
slot: P1_DIMM4B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:7
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: 7
serial: E31C7D1E
slot: P1_DIMM4A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:8
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: M393B5270CH0-CH9
vendor: Samsung
physical id: 8
serial: 483EA5A8
slot: P2_DIMM1B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:9
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: M393B5270CH0-CH9
vendor: Samsung
physical id: 9
serial: 483EB2EF
slot: P2_DIMM1A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:10
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: HMT151R7BFR4C-H9
vendor: Hynix
physical id: a
serial: 0DB48166
slot: P2_DIMM2B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:11
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: HMT151R7BFR4C-H9
vendor: Hynix
physical id: b
serial: 32719C38
slot: P2_DIMM2A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:12
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: c
serial: D51CFF11
slot: P2_DIMM3B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:13
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: d
serial: D31CD678
slot: P2_DIMM3A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:14
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: e
serial: E31C281E
slot: P2_DIMM4B
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
*-bank:15
description: DIMM DDR3 Synchronous 1333 MHz (0,8 ns)
product: 9965447-034.A00LF
vendor: Kingston
physical id: f
serial: D51C0012
slot: P2_DIMM4A
size: 4GiB
width: 64 bits
clock: 1333MHz (0.8ns)
Здесь видно два банка (*-bank) — соответственно, два слота памяти используются, и каждый из них занят модулем объемом 16 ГБ.
Таким образом, используя команду sudo lshw -class memory, вы сможете легко выяснить количество слотов памяти на вашем оборудовании под управлением Linux.