Kernel Modules and Configuration

The standard kernel supports SMP and 4GB of physical memory with a limit of 3GB per processor. The PAE kernel supports up to 16GB of RAM. The RHEL5 x86-64 kernel supports up to 256GB of Ram and 64 CPU's. The Xen kernel supports 64GB of physical RAM with a limit of 16GB per domain so you may allocate 16GB to Dom0 and 16GB to three additional DomU for example.

The kernel is stored in /boot/vmlinuz-....

The kernel modules are stored in /lib/modules/$(uname -r)/ and are loaded dynamically at will with support for 3rd party add-ons

Module Utilities:

  • modprobe loads and unloads modules
  • modinfo displays module info
  • lsmod lists the currently loaded modules

Use modprobe <module> to install a module or modprobe -r <module> to remove a module

Use /etc/modprobe.conf to configure settings for common modules

In order to boot the system the kernel must load modules such as ext3, jbd, raid1, scsi_mod. Therefore, GRUB provides the modules in the form of an initrd image which is specified in the grub.conf file.

To create an initrd file examples ( use uname -r ):

  • mkinitrd /boot/initrd-2.6.18-92.1.10.el5.img 2.6.18-92.1.10.el5
  • mkinitrd /boot/initrd-$(uname -r).img $(uname -r)

To include modules example (scsi_mod):

  • mkinitrd --with=scsi_mod /boot/initrd-2.6.18-92.1.10.el5.img 2.6.18-92.1.10.el5
  • mkinitrd --with=scsi_mod /boot/initrd-$(uname -r).img $(uname -r)

To add qla2300 module and dependencies to initrd use:

echo "alias scsi_hostadapter qla2300" >> /etc/modprobe.conf
mkinitrd --with=scsi_mod /boot/initrd-$(uname -r).img $(uname -r)

Configuring the kernel with /proc can be useful for testing kernel configuration changes that will not persist across a reboot. The /proc filesystem can also be very useful for gathering system information i.e. cat /proc/meminfo or cat /proc/cpuinfo

To see info about running processes use: strings /proc/<PID>/* # replace <PID> with actual process id

Boot time options: cat /proc/cmdline

Dynamic modules: cat /proc/modules

Mounts: cat /proc/mounts

Network activity: strings /proc/net/*

Partitions: cat /proc/partitions

Turn IP Forwarding on: echo on > /proc/sys/net/ipv4/ip_forward

Free up cached memory: echo 1 > /proc/sys/vm/drop_caches

Adjust swap aggressiveness (1 - 100): echo 60 > /proc/sys/vm/swappiness

Making kernel configuration persistent across reboots

  • sysctl -a lists all kernel parameters and values
  • sysctl -w net.ipv4.tcp_syncookies=1 turns on syncookies and sysctl -p makes change permanent

No comments: