kdump機能を使用する設定手順を,次の順序で説明します。
C.2.1 カーネルダンプ出力用のディスクを追加する
カーネルダンプの出力先となるディスクを追加します。
システムディスク(/varディレクトリ)のファイルシステムに異常が発生した場合でもカーネルダンプを採取できるようにするため,カーネルダンプ出力用のディスクは,システムディスクから独立した別のディスクに設定することを推奨します。
次のどちらかの条件に該当する場合,ディスクの追加は不要です。
# /sbin/dlmcfgmgr -r
KAPL10339-I This operation will change the configuration of HDLM devices. Do you want to continue? [y/n]: y
KAPL10341-I The HDLM device configurations have been changed.
KAPL10302-I /sbin/dlmcfgmgr completed normally.
# /sbin/dlmcfgmgr -v
HDevName Management Device Host Channel Target Lun
/dev/sddlmaa configured /dev/sda 0 0 0 0
/dev/sdc 1 0 0 0
/dev/sddlmab configured /dev/sdb 0 0 0 1
/dev/sdd 1 0 0 1
/dev/sddlmac configured /dev/sde 0 0 0 2
KAPL10302-I /sbin/dlmcfgmgr completed normally.
# /sbin/dlmcfgmgr -o /dev/sddlmac
KAPL10339-I This operation will change the configuration of HDLM devices. Do you want to continue? [y/n]: y
KAPL10341-I The HDLM device configurations have been changed.
KAPL10302-I /sbin/dlmcfgmgr completed normally.
# /sbin/dlmcfgmgr -v
HDevName Management Device Host Channel Target Lun
/dev/sddlmaa configured /dev/sda 0 0 0 0
/dev/sdc 1 0 0 0
/dev/sddlmab configured /dev/sdb 0 0 0 1
/dev/sdd 1 0 0 1
/dev/sddlmac unconfigured /dev/sde 0 0 0 2
KAPL10302-I /sbin/dlmcfgmgr completed normally.
C.2.2 カーネルダンプの出力先を設定する
次の操作を実行して,カーネルダンプの出力先を設定します。
次に示す条件をすべて満たす場合,手順1から4は実行しないで,手順5から実行してください。
# fdisk /dev/sde
The number of cylinders for this disk is set to 10240.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sde: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10240, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10240, default 10240):
Using default value 10240
Command (m for help): p
Disk /dev/sde: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 10240 10485744 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs -t ext3 -L kdump_disk /dev/sde1
mke2fs 1.39 (29-May-2006)
Filesystem label=kdump_disk
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2621436 blocks
131071 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mkfs -t ext4 /dev/sde1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262094 blocks
13104 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
UUID="bf5d6d8d-d18b-45f8-8187-86837d895488" TYPE="ext4"
LABEL=kdump_disk /var/crash ext3 defaults 1 2
UUID=bf5d6d8d-d18b-45f8-8187-86837d895488 /var/crash ext4 defaults 1 2
path hdlm
ext3 LABEL=kdump_disk
path hdlm
ext4 UUID=bf5d6d8d-d18b-45f8-8187-86837d895488
disk_timeout 1
C.2.3 ブートローダの設定ファイルを編集する
ブートローダの設定ファイルに,kdump機能のオプションを追加します。
ブートローダとしてGRUBを使用している場合(カーネルパラメータにLABELを使用する場合)
/etc/grub.confファイルの編集例を次に示します。下線部の個所を編集してください。
:
:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
#title HDLM-Red Hat Enterprise Linux Server (2.6.18-8.el5)
# root (hd0,0)
# kernel /vmlinuz-2.6.18-8.el5 ro rhgb quiet
# initrd /initrd-2.6.18-8.el5-hdlm.img
title HDLM-kdump-Red Hat Enterprise Linux Server (2.6.18-8.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet crashkernel=128M@16M
initrd /initrd-2.6.18-8.el5-hdlm.img
:
:
ブートローダとしてGRUBを使用している場合(カーネルパラメータにUUIDを使用する場合)
/etc/grub.confファイルの編集例を次に示します。下線部の個所を編集してください。
:
:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
#title HDLM-Red Hat Enterprise Linux Server (2.6.32-220.el6.x86_64)
# root (hd0,0)
# kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=43a23c95-4a5f-42ad-bce6-23fcf4c1f13a
# rd_NO_LUKS rd_NO_MD
# initrd /initrd-2.6.32-220.el6.x86_64-hdlm.img
title HDLM-kdump-Red Hat Enterprise Linux Server (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=43a23c95-4a5f-42ad-bce6-23fcf4c1f13a
rd_NO_LUKS rd_NO_MD crashkernel=128M
initrd /initrd-2.6.32-220.el6.x86_64-hdlm.img
:
:
ブートローダとしてELILOを使用している場合
/etc/elilo.confファイルの編集例を次に示します。下線部の個所を編集してください。
:
:
prompt
timeout=10
default=HDLM-kdump-Red_Hat_Enterprise_Linux_Server_2.6.18-8.el5
relocatable
#image=vmlinuz-2.6.18-8.el5
# label=HDLM-Red_Hat_Enterprise_Linux_Server_2.6.18-8.el5
# initrd=initrd-2.6.18-8.el5-hdlm.img
# read-only
# append="rhgb quiet"
image=vmlinuz-2.6.18-8.el5
label=HDLM-kdump-Red_Hat_Enterprise_Linux_Server_2.6.18-8.el5
initrd=initrd-2.6.18-8.el5-hdlm.img
read-only
append="rhgb quiet root=LABEL=/ crashkernel=256M@256M"
:
:
C.2.4 kdump機能用の初期RAMディスクイメージファイルを作成する
カーネルダンプの採取時に,セカンドカーネルで使用されるkdump機能用の初期RAMディスクイメージファイルを作成します。
# shutdown -r now
# touch /etc/kdump.conf
# /sbin/service kdump restart
Stopping kdump: [ OK ]
Detected /etc/kdump.conf or /boot/vmlinuz-2.6.18-8.el5 change
Rebuilding /boot/initrd-2.6.18-8.el5kdump.img
Starting kdump: [ OK ]
# ls -l /boot/initrd-`uname -r`kdump.img
-rw-r--r-- 1 root root 2769763 mmm dd hh:mm
/boot/initrd-2.6.18-8.el5kdump.img
C.2.5 カーネルダンプが正しく採取されることを確認する
カーネルパニックを発生させて,カーネルダンプが正しく採取されることを確認します。
# echo c > /proc/sysrq-trigger
カーネルパニックが発生すると,カーネルダンプが採取されます。そのあと,ホストが再起動します。# ls -lR /var/crash/
/var/crash/:
total 24
drwxr-xr-x 3 root root 4096 mmm dd hh:mm hdlm
drwx------ 2 root root 16384 mmm dd hh:mm lost+found
/var/crash/hdlm:
total 4
drwxr-xr-x 2 root root 4096 mmm dd hh:mm 127.0.0.1-yyyy-mm-dd-hh:mm:ss
/var/crash/hdlm/127.0.0.1-yyyy-mm-dd-hh:mm:ss:
total 1971852
-r-------- 1 root root 2017199848 mmm dd hh:mm vmcore
/var/crash/lost+found:
total 0
以上で,kdump機能を使用するために必要な設定は終了です。