Solaris的Crash配置

1,959 Views
『作者:RickyZhu 转载务必注明出处和作者』
Tag:

Solaris系统在出现故障的时候会在/var/crash目录下生成一些crash文件,这些文件对磁盘的空间占用非常严重,我最近几次磁盘总是动不动就满了,找了很久终于找到了这个罪魁祸首-就是这些crash文件,大小经常超过10G!!

Solaris提供了一个dumpadm命令可以对这些crash文件进行配置和开关设置,请参考下面:

关闭crash开关:

# dumpadm -n
Dump content: all pages
Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
Savecore enabled: no

打开crash开关:
# dumpadm -y
Dump content: all pages
Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
Savecore enabled: yes

如何从一个crash目录中恢复:

In this scenario, the system crashes but no room is left in the savecore directory, and you want to save some critical system crash dump information.

1. Log in as superuser after the system reboots.
2. Clear out the savecore directory, usually /var/crash/hostname, by removing existing crash dump files that have already been sent to your service provider. Or, run the savecore command and specify an alternate directory that has sufficient disk space. See the next step.
3. Manually run the savecore command and if necessary, specify an alternate savecore directory.

# savecore [ directory ]

检查一个crash dump目录:

# /usr/bin/mdb -k unix.0
Loading modules: [ unix krtld genunix ip nfs ipc ptm ]
> ::status
debugging crash dump /dev/mem (64-bit) from ozlo
operating system: 5.9 Generic (sun4u)
> ::system
set ufs_ninode=0×9c40 [0t40000]
set ncsize=0×4e20 [0t20000]
set pt_cnt=0×400 [0t1024]

修改一个crash的配置,比如dump目录等:

In this example, all of memory is dumped to the dedicated dump device, /dev/dsk/c0t1d0s1, and the minimum free space that must be available after the crash dump files are saved is 10% of the file system space.

# dumpadm
Dump content: kernel pages
Dump device: /dev/dsk/c0t3d0s1 (swap)
Savecore directory: /var/crash/pluto
Savecore enabled: yes
# dumpadm -c all -d /dev/dsk/c0t1d0s1 -m 10%
Dump content: all pages
Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
Savecore enabled: yes

下面是具体的语法:

# dumpadm -c content -d dump-device -m nnnk | nnnm | nnn% -n -s savecore-dir

-c content
Specifies the type of data to dump. Use kernel to dump of all kernel memory, all to dump all of memory, or curproc, to dump kernel memory and the memory pages of the process whose thread was executing when the crash occurred. The default dump content is kernel memory.

-d dump-device
Specifies the device that stores dump data temporarily as the system crashes. The primary swap device is the default dump device.

-m nnnk | nnnm | nnn%
Specifies the minimum free disk space for saving crash dump files by creating a minfree file in the current savecore directory. This parameter can be specified in Kbytes (nnnk), Mbytes (nnnm) or file system size percentage (nnn%). The savecore command consults this file prior to writing the crash dump files. If writing the crash dump files, based on their size, would decrease the amount of free space below the minfree threshold, the dump files are not written and an error message is logged. For information on recovering from this scenario, see How to Recover From a Full Crash Dump Directory (Optional).

-n
Specifies that savecore should not be run when the system reboots. This dump configuration is not recommended. If system crash information is written to the swap device, and savecore is not enabled, the crash dump information is overwritten when the system begins to swap.

-s
Specifies an alternate directory for storing crash dump files. The default directory is /var/crash/hostname where hostname is the output of the uname -n command.


随机文章

沙发

(Required)
(Required, not published)


Close
E-mail It