Hardware Hotplug

Festplatten

echo "- - -" > /sys/class/scsi_host/host0/scan

oder

echo "scsi scan-new-devices" > /proc/scsi/scsi

Prozessor

#!/bin/bash
for CPU in $(ls /sys/devices/system/cpu/ | egrep "cpu[0-9]+$"); do
	CPU_DIR="/sys/devices/system/cpu/${CPU}"
	STATE_FILE="${CPU_DIR}/online"
 
	echo -e -n "CPU: \"${CPU_DIR}\"\t\t"
 
	if [ -f "${STATE_FILE}" ]; then
		STATE=$(cat "${STATE_FILE}" | grep "1")
		if [ "x${STATE}" == "x1" ]; then
			echo "already online"
		else
			echo "1" > "${STATE_FILE}"
			echo "new, onlined"
		fi
	else
		echo "already configured"
	fi
done

Ram

#!/bin/bash
for MEMORY in $(ls /sys/devices/system/memory/ | egrep "memory[0-9]+$"); do
	SPARSEMEM_DIR="/sys/devices/system/memory/${MEMORY}"
	STATE_FILE="${SPARSEMEM_DIR}/state"
	STATE=$(cat "${STATE_FILE}" | grep -i online)
 
	echo -e -n "Memory: \"${SPARSEMEM_DIR}\"\t\t"
 
	if [ "x${STATE}" == "xonline" ]; then
		echo "already online"
	else
		echo "online" > "${STATE_FILE}"
		echo -e "new, onlined"
	fi
done

Ursprüngliche Quelle: OVH Forum - Scripte wurden etwas modifiziert.