MARGA by EknathaLabs

"Bare metal and datacenter" cheat sheet

"Remote management, provisioning, disks and RAID, bonding and the first checks on a sick server."

Talk to the BMC

ipmitool -H BMC_IP -U USER -P PASS chassis power status
ipmitool -H BMC_IP -U USER -P PASS chassis power cycle
ipmitool -H BMC_IP -U USER -P PASS sel elist
ipmitool -H BMC_IP -U USER -P PASS sensor list

Check disks

lsblk -f
sudo smartctl -H /dev/sda
sudo smartctl -a /dev/sda | grep -E "Reallocated|Pending|Power_On"
cat /proc/mdstat
sudo mdadm --detail /dev/md0

Replace a failed RAID member

sudo mdadm /dev/md0 --fail /dev/sdb
sudo mdadm /dev/md0 --remove /dev/sdb
sudo mdadm /dev/md0 --add /dev/sdc
watch cat /proc/mdstat

Network and bonding

cat /proc/net/bonding/bond0
ip -s link show bond0
ethtool eno1 | grep -E "Speed|Link detected"
dmesg | grep -i bond

PXE problems

sudo journalctl -u dnsmasq -f
grep -E "dhcp-boot|next-server|filename" /etc/dnsmasq.conf
sudo tcpdump -ni eth0 port 67 or port 68 or port 69

A sick server checklist

  1. Drain the workloads.
  2. Read the BMC event log, SMART, kernel log and switch counters.
  3. Decide which part is at fault. Do not swap parts at random.
  4. Change one thing, test, record it by asset tag.

Quick inventory

lscpu | head -5
free -h
lsblk -o NAME,SIZE,MODEL,SERIAL
dmidecode -s system-serial-number
ip -br link

Cautions

Official references

Read the vendor and project documentation for the full, current detail.