Collecting Livecore dump in Solaris

Introduction:

“Live core” is the crash dump of the running Solaris system, without rebooting or modifying the system in any way. Here mainly we are using two commands for collecting core dump "dumpadm" and "savecore".


dumpadm & savecore :

The dumpadm program is an administrative command that manages the configuration of the operating system crash dump facility. A crash dump is a disk copy of the physical memory of the computer at the time of a fatal system error. When a fatal operating system error occurs, a message describing the error is printed to the console. The operating system then generates a crash dump by writing the contents of physical memory to a predetermined dump device, which is typically a local disk partition. The dump device can be configured by way of dumpadm. Once the crash dump has been written to the dump device, the system will reboot.

Fatal operating system errors can be caused by bugs in the operating system, its associated device drivers and loadable modules, or by faulty hardware. Whatever the cause, the crash dump itself provides invaluable information to your support engineer to aid in diagnosing the problem. As such, it is vital that the crash dump be retrieved and given to your support provider. Following an operating system crash, the savecore utility is executed automatically during boot to retrieve the crash dump from the dump device, and write it to a pair of files in your file system named unix.X and vmcore.X, where X is an integer identifying the dump. Together, these data files form the saved crash dump. The directory in which the crash dump is saved on reboot can also be configured using dumpadm.


How to check physical memory size:

root@vaigai # prtconf | grep Memory
Memory size: 1024 Megabytes
root@vaigai #


Identify the current crash dump configuration:

root@vaigai # dumpadm
Dump content: kernel pages
Dump device: /dev/dsk/c0d0s1 (swap)  Current dump device is swap
Savecore directory: /var/crash/vaigai
Savecore enabled: yes
root@vaigai #
Configuring the core dump device (good to have its size same as physical
memory size) :

root@vaigai # mkfile -n 1g /livecore/lcfile
root@vaigai # cd livecore/
root@vaigai # ls -l
total 48
-rw------T 1 root root 1073741824 Jan 27 05:01 lcfile
root@vaigai #

Reconfiguring the Dump device to a dedicated Dump device (using file):

root@vaigai # dumpadm -d /livecore/lcfile
Dump content: kernel pages
Dump device: /livecore/lcfile (dedicated)
Savecore directory: /var/crash/vaigai
Savecore enabled: yes
root@vaigai #

Generate live core using savecore:

root@vaigai # savecore -L
dumping to /livecore/lcfile, offset 65536, content: kernel
100% done: 27895 pages dumped, compression ratio 3.11, dump succeeded
System dump time: Wed Jan 27 05:04:19 2010
Constructing namelist /var/crash/vaigai/unix.0
Constructing corefile /var/crash/vaigai/vmcore.0
100% done: 27895 of 27895 pages saved
root@vaigai #

Core dump generated two files: vmcore.0 and unix.0 :

root@vaigai # ls -l /var/crash/vaigai/
total 231058
-rw-r--r-- 1 root root 2 Jan 27 05:04 bounds
-rw-r--r-- 1 root root 1396825 Jan 27 05:04 unix.0
-rw-r--r-- 1 root root 116826112 Jan 27 05:04 vmcore.0
root@vaigai #


Generate live core using savecore in different directory :

root@vaigai # mkdir /nividya
root@vaigai # savecore -L /nividya
dumping to /livecore/lcfile, offset 65536, content: kernel
100% done: 29126 pages dumped, compression ratio 2.94, dump succeeded
System dump time: Wed Jan 27 05:08:18 2010
Constructing namelist /nividya/unix.0
Constructing corefile /nividya/vmcore.0
100% done: 29126 of 29126 pages saved
root@vaigai #]

root@vaigai # ls -l /nividya
total 240930
-rw-r--r-- 1 root root 2 Jan 27 05:08 bounds
-rw-r--r-- 1 root root 1396825 Jan 27 05:08 unix.0
-rw-r--r-- 1 root root 121872384 Jan 27 05:08 vmcore.0
root@vaigai #


Using dumpadm to set dumpdevice as swap :

root@vaigai # dumpadm -d swap
Dump content: kernel pages
Dump device: /dev/dsk/c0d0s1 (swap)
Savecore directory: /var/crash/vaigai
Savecore enabled: yes
root@vaigai #

Reconfiguring the Dump device to a dedicated Dump device (using partition):

root@vaigai # dumpadm -d /dev/dsk/c2t1d0s0
Dump content: kernel pages
Dump device: /dev/dsk/c2t1d0s0 (dedicated)
Savecore directory: /var/crash/vaigai
Savecore enabled: yes
root@vaigai #

Modify the dump configuration to automatically run savecore on reboot. This
is the default for this dump setting.

root@vaigai # dumpadm -y
Dump content: kernel pages
Dump device: /dev/dsk/c2t1d0s0 (dedicated)
Savecore directory: /var/crash/vaigai
Savecore enabled: yes
root@vaigai #

Modify the dump configuration to not run savecore automatically on reboot.
This is not the recommended system configuration.

root@vaigai # dumpadm -n
Dump content: kernel pages
Dump device: /dev/dsk/c2t1d0s0 (dedicated)
Savecore directory: /var/crash/vaigai
Savecore enabled: no
root@vaigai #