Home / Solaris 10 / Preventing zone core files on Global zone -Solaris

Preventing zone core files on Global zone -Solaris

Coredump is memory dump of program or application and its generates when application  crashes or terminated abnormally.This coredump is very useful to find root cause of application crashes.But sometimes it will create a problem by filling the root filesystem if /var/core is part of root filesystem and again all the local zones core files will be dump in global zone’s /var/core.Since we have same core files in local zones /var/core ,then what is a need of having it in global zone.This is absolutely  unnecessary. Here is a trick to stop local zones core files on global zone

First thing will be modifying global zones coreadm. Set the global core file pattern and init core file pattern like the below one.So all the global zone core files will be stored in /var/core/core-node1/ directory .
node1#coreadm -g /var/core/core-%n/core_%n_%f_%u_%g_%t_%p
node1#coreadm -i /var/core/core-%n/core_%n_%f_%u_%g_%t_%p
node1#coreadm
global core file pattern: /var/core/core-%n/core_%n_%f_%u_%g_%t_%p
global core file content: default
init core file pattern: /var/core/core-%n/core_%n_%f_%u_%g_%t_%p
init core file content: default
global core dumps: enabled
per-process core dumps: enabled
global setid core dumps: enabled
per-process setid core dumps: enabled
global core dump logging: enabled

node1#cd /var/core/core-node1/
node1#ls -l
total 0

Let us test our work.

node1#ps -ef |grep auto
root 1925 1 0 Feb 23 ? 0:00 /usr/lib/autofs/automountd
root 1927 1925 0 Feb 23 ? 0:00 /usr/lib/autofs/automountd
root 16445 16443 0 00:46:54 ? 0:00 /usr/lib/autofs/automountd
root 16462 4228 0 00:48:25 pts/2 0:00 grep auto
root 16443 1 0 00:46:54 ? 0:00 /usr/lib/autofs/automountd

node1#kill -6 1927
node1#ls -l
total 2
-rw------- 1 root root 6562608 Feb 25 00:48 core_node1_automountd_0_0_1330111111_1927
-rw------- 1 root root 6562608 Feb 25 00:48 core_node1_automountd_0_0_1330111112_1927

Our next step will be modifying the local zones coreadm setup.Just modify the coreadm parameters like the below one.

node1#zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 test running /export/home/test native shared
- znode1 configured /zoravol1 native shared
node1#zlogin test
[Connected to zone 'test' pts/3]Last login: Sat Feb 25 00:46:13 on pts/3
Oracle Corporation SunOS 5.10 Generic Patch January 2005
# bash
bash-3.00# coreadm
global core file pattern: /var/core/core_%n_%f_%u_%g_%t_%p
global core file content: default
init core file pattern: /var/core/core_%n_%f_%u_%g_%t_%p
init core file content: default
global core dumps: enabled
per-process core dumps: enabled
global setid core dumps: enabled
per-process setid core dumps: enabled
global core dump logging: enabled

Testting our work.Now local zones corefiles should not generate in global zones /var/core/core-node1.

bash-3.00# ps -ef |grep nfs
daemon 16369 4572 0 00:46:49 ? 0:00 /usr/lib/nfs/nfsmapid
daemon 16398 4572 0 00:46:50 ? 0:00 /usr/lib/nfs/lockd
daemon 16375 4572 0 00:46:49 ? 0:00 /usr/lib/nfs/statd
daemon 16373 4572 0 00:46:49 ? 0:00 /usr/lib/nfs/nfs4cbd

bash-3.00# kill -6 16375
bash-3.00#cd /var/core/core-zonename
bash-3.00# ls -l
total 1
-rw------- 1 root root 3498092 Feb 25 00:52 core_test_statd_1_12_1330111367_16375
bash-3.00# exit
exit
# exit
[Connection to zone 'test' pts/3 closed]
node1#ls -l
total 3
drwxr-xr-x 2 root root 4 Feb 25 00:48 core-node1
node1#cd core-node1/

You can see there is no core file from zone “test”. So our setup just good enough to prevent the core files of local zones.
node1#ls -l
total 26138
-rw------- 1 root root 6562608 Feb 25 00:48 core_node1_automountd_0_0_1330111111_1927
-rw------- 1 root root 6562608 Feb 25 00:48 core_node1_automountd_0_0_1330111112_1927

You will get similar error in messages file whenever there is new core files generated on the localzones.
node1#tail -10 /var/adm/messages
Feb 25 00:48:33 node1 genunix: [ID 603404 kern.notice] NOTICE: core_log: automountd[1927] core dumped: /var/core/core-node1/core_node1_automountd_0_0_1330111112_1927
Feb 25 00:52:47 node1 genunix: [ID 457380 kern.notice] NOTICE: core_log: statd[16375] core dump failed, errno=2: /var/core/core-test/core_test_statd_1_12_1330111367_16375
So using the above setup, we can prevent the local zone core files on global zone instead disabling the coredump.If you have any doubt on this ,you can leave a comment and I will reply to your questions as soon possible.
VMTURBO-CLOUD-CAPACITY

Leave a Reply

Your email address will not be published. Required fields are marked *