dumpadm - 配置操作系统的故障转储
/usr/sbin/dumpadm [-enpuy] [ -c content-spec] [-d dump-device] [-m mink | minm | min%] [-s savecore-dir] [-r root-dir] [-z on | off] [-D on | off]
dumpadm 程序是管理操作系统故障转储工具配置的管理命令。故障转储是指发生严重系统错误时为计算机物理内存创建的副本。当发生严重操作系统错误时,会在控制台上输出描述错误的消息。If deferred dumping is enabled (on), the operating system then generates a crash dump by preserving the contents of physical memory in RAM.If this is not possible, or if deferred dumping is disabled (off), the contents of physical memory are written to a predetermined dump device, which can be a ZFS ZVOL, or a local disk partition.
保留故障转储后,系统将重新引导。
严重的操作系统错误可能因操作系统、其关联的设备驱动程序和可装入的模块中的错误,或有故障的硬件而造成。不管原因是什么,故障转储本身都可为您的支持工程师提供宝贵的信息以帮助其诊断问题。因此,请务必检索故障转储并将其提供给您的支持提供商。Following an operating system crash, the savecore(8) utility is executed automatically during boot to retrieve the crash dump and write it to your file system in compressed form, to files named vmdump.X, and vmdump-<secname>.X, where X is an integer identifying the dump.Afterward, savecore(8) can be invoked on the same or another system to expand the compressed crash dump to files named vmcore.X and vmcore-<secname>.X.可以使用 dumpadm 命令配置重新引导时保存故障转储的目录。
缺省情况下,会将专用的 ZFS 卷用于转储设备。For further information about setting up a dump area with ZFS, see the Managing ZFS File Systems in Oracle Solaris 11.4 book.
要查看当前的转储配置,请使用不带参数的 dumpadm 命令:
example# dumpadm Dump content: kernel with ZFS metadata Dump device: /dev/zvol/dsk/rpool/dump (dedicated) Savecore directory: /var/crash Savecore enabled: yes Save compressed: on Deferred Dump: on
当未指定选项时,dumpadm 显示当前的故障转储配置。The example above shows the set of default values: the dump content is set to kernel memory pages and ZFS metadata only.故障转储将保留在内存中(如果可能),否则将使用转储设备。缺省情况下,转储设备是根池中的一个 zvol。savecore 文件的目录设置为 /var/crash/。savecore 配置为在重新引导时自动运行并且以压缩格式保存故障转储。
当指定一个或多个选项时,dumpadm 将验证您的更改是否有效,如果有效,将重新配置故障转储参数并显示生成的配置。您必须是 root 用户才能查看或更改转储参数。
系统安装时,dumpadm 会根据系统内存大小和其他内部信息建立足够大的转储设备,以容纳转储文件。如果您随后尝试创建的转储设备太小而无法存储转储文件,那么 dumpadm 将发出警告消息。
支持以下选项:
修改转储配置以便故障转储包含指定的转储内容。content-spec 包含可选的内容类型和内容修饰符:
content-type 提供基础,内容修饰符进一步更改要转储的内容。如果包含 +,内容修饰符将添加要转储的额外数据,如果包含 -,将忽略相应数据。
内容类型可以是以下类型之一:
仅内核内存页面。请注意,这仅包含基本的内核页面集,即,不包含可以使用内容修饰符指定的页面。
所有内存页面。如果指定了 all,则会将系统映像写入到转储设备中。请注意,生成的转储将包含用于文件系统缓冲区的页面。
内核内存页面(如通过 'kernel' 指定)以及其线程当前在启动故障转储的 CPU 上执行的进程的内存页面。如果在该 CPU 上执行的线程是内核线程,不与任何用户进程关联,则仅转储内核页面。
内核内存页面(如通过 'kernel' 指定)以及所有进程页面。如果指定了 allproc,则会将系统映像写入到转储设备中。
content-modifier 可以为以下值之一:
存储 ZFS 元数据的内核页面。
content-modifier 影响内核内存的哪些部分将被转储以及哪些不会被转储。当设置 'all' 内容类型时,内容修饰符不会产生任何效果。
如果省略了 content-type 并且仅指定了 content-modifier,则当前配置的 content-type 将保持不变。
修改转储配置以使用指定的转储设备。转储设备可以是下列之一:
指定为绝对路径名的块设备(例如 /dev/dsk/cNtNdNsN)或者 ZFS 卷(例如 /dev/zvol/dsk/rpool/dump)。
如果将特殊标记 swap 指定为转储设备,dumpadm 会检查活动交换条目,然后选择最合适的条目将其配置为转储设备。See swap(8).有关用于选择合适交换条目的算法的详细信息,请参见下文的“附注”部分。
Use of a single swap device for a dump device is not recommended for low memory systems.If the system has less than 8 gigabytes of RAM then it should have a dedicated swap device, sufficient to allow the system to boot to the multi-user milestone, and a separate dump device which may also be used as an additional swap device.
不使用基于磁盘的转储设备。如果有可能在内存中存储故障转储,则仍检索故障转储。
Modify the dump configuration to control whether dumping is deferred or not.The options are on, to preserve the crash dump in system memory if possible, and off, to write the crash dump to the dump device as part of the panic process.After the system reboots, savecore will find the crash dump in either system memory or on the dump device, and copy it to the savecore directory at that time.The default is on, because in most cases that will reduce the overall downtime of the system.
列显存储压缩的故障转储所需的磁盘空间估计值。该值是使用当前配置和当前运行的系统计算的。
在当前的 savecore 目录中创建 minfree 文件,指示 savecore 在 savecore 目录所在的文件系统中至少应保留指定大小的可用空间。min 参数可以为下列值之一:
后缀为单位 k 的正整数,用于指定千字节值。
后缀为单位 m 的正整数,用于指定兆字节值。
% 符号,指示应按照 savecore 目录所在文件系统的当前总大小乘以指定百分比来计算 minfree 值。
savecore 命令将在写入转储文件之前查询 minfree 文件(如果有)。如果这些文件的大小会使可用磁盘空间大小减少到 minfree 阈值之下,那么将不写入转储文件,并且会记录错误消息。管理员应立即清理 savecore 目录以提供足够的可用空间,然后手动重新执行 savecore 命令。管理员也可以在 savecore 命令行上指定备用目录。
修改转储配置以在重新引导时不自动运行 savecore。This is not the recommended system configuration. savecore(8) can be run manually once the system has booted up to extract the crash dump to the savecore directory.
如果转储设备是一个交换分区,则转储数据在系统开始使用交换设备时可能会被覆盖。如果引导后没有立即执行 savecore,那么可能无法检索故障转储。
生成计算机可解析的输出。
指定 dumpadm 应相对于哪个备用根目录创建文件。如果未指定 –r 参数,则使用缺省的根目录 /。
修改转储配置以使用指定的目录保存 savecore 写入的文件。目录应采用绝对路径形式,且该目录应存在于系统上。如果重新引导时该目录不存在,那么将在执行 savecore 之前创建该目录。有关访问 savecore 目录的安全问题的讨论,请参见下文的“附注”部分。缺省 savecore 目录为 /var/crash/。
根据 /etc/dumpadm.conf 的内容强制更新内核转储配置。通常此选项仅在必须恢复之前引导中的 dumpadm 设置的情况下使用,此选项在重新引导时启动 svc:/system/dump:config 时使用。您的转储配置保存在配置文件中以实现此目的。如果缺少配置文件或配置文件中有任何无效的转储属性值,则替换成缺省值。更新后,将重新同步配置文件与内核转储配置。
修改转储配置以在重新引导时自动运行 savecore。这是此转储设置的缺省值。请参见“附注”部分。
修改转储配置以控制重新引导时 savecore 的运行方式。选项为 on 时允许以压缩格式保存核心文件,为 off 时自动解压缩故障转储文件。缺省值为 on,因为故障转储文件可能会非常大,如果以压缩格式保存,所需的文件系统空间较少。
example# dumpadm -c curproc-zfs Dump content: kernel and current process without ZFS metadata Dump device: /dev/zvol/dsk/rpool/dump (dedicated) Savecore directory: /var/crash Savecore enabled: yes Save compressed: on Deferred Dump: on示例 2 指定 allproc 或 all 内容
example# dumpadm -c all Dump content: all Dump device: /dev/zvol/dsk/rpool/dump (dedicated) Savecore directory: /var/crash Savecore enabled: yes Save compressed: on Deferred Dump: on示例 3 如果禁用了 savecore,则保留故障转储
如果禁用了 savecore,则在重新引导之后可能会将故障转储保留在内存中并将其复制到转储设备。It can be extracted later by running savecore(8) manually.
example# dumpadm -n -c kernel+zfs Dump content: kernel with ZFS metadata Dump device: /dev/zvol/dsk/rpool/dump (dedicated) Savecore directory: /var/crash Savecore enabled: no Save compressed: on Deferred Dump: on
将返回以下退出值:
转储配置有效,并且已成功进行指定的修改(如果有)。
获取或修改转储配置时发生致命错误。
指定的命令行选项无效。
故障转储管理设备驱动程序。
包含 dumpadm 和 savecore 的配置参数。只能使用 dumpadm 修改。
包含 savecore-directory 的最小可用空间大小。请参见 savecore(8)。
有关下列属性的说明,请参见 attributes(7):
|
svcs(1)、uname(1)、attributes(7)、smf(7)、savecore(8)、svcadm(8)、swap(8)
系统故障转储服务由服务管理工具 smf(7) 管理,其服务标识符为:
svc:/system/dump:config svc:/system/dump:deferred svc:/system/dump:disk svc:/system/dump:swap
尽管可以使用 svcadm(8) 来对此服务执行管理操作(如启用、禁用或请求重新启动),但不建议禁用这些服务。可以使用 svcs(1) 命令来查询这些服务的状态。
将特殊标记 swap 指定为 dumpadm –d 的参数时,实用程序会尝试将最适合的交换设备配置为转储设备。dumpadm 将最大的交换块设备配置为转储设备;如果没有可用于交换的块设备,那么将最大的交换条目配置为转储设备。如果不存在交换条目,或者交换条目都不能配置为转储设备,那么将显示警告消息。
In the event that the dump device is also a swap device but not a ZFS volume and the swap device is deleted by the administrator using the swap –d command, the swap command will automatically invoke dumpadm –d swap in order to attempt to configure another appropriate swap device as the dump device.如果没有其他交换设备或者其他交换设备都不能配置为转储设备,那么将禁用故障转储并显示警告消息。类似地,如果故障转储处于禁用状态,并且管理员使用 swap –a 命令添加新的交换设备,那么将调用 dumpadm –d swap 以使用新的交换设备重新启用故障转储。
发出 dumpadm –d swap 命令后,会将新的转储设备存储在配置文件中以用于之后的重新引导。如果管理员添加了更大的或更适合的交换设备,转储设备不会发生更改;管理员必须重新执行 dumpadm –d swap 以从新的交换设备列表中重新选择最适合的设备。
使用 dumpadm –m 选项基于 savecore 目录所在文件系统总大小的百分比创建 minfree 文件时,如果在之后更改了文件系统大小,并不会自动重新计算该值。在这种情况下,管理员必须重新执行 dumpadm –m 以重新计算 minfree 值。如果 savecore 目录中不存在此类文件,那么 savecore 将可用空间阈值的缺省值设置为 1 兆字节。如果不需要可用空间阈值,那么可以创建大小设置为 0 的 minfree 文件。
If there is insufficient space in the dump directory, and system preserved a crash dump image in memory, then the image is written to the dump device for later extraction using savecore(8).
如果重新引导时指定的 savecore 目录不存在,那么将在执行 savecore 之前使用 0700 权限(仅允许所有者读取、写入和执行)和 root 所有者权限创建该目录。建议也使用类似的权限创建备用 savecore 目录,因为操作系统故障转储文件本身可能包含安全信息。
系统安装软件可能会保留专用的转储设备(例如,某个磁盘分片或 ZFS 卷)。在这种情况下,dumpadm 缺省值可以设置为 –n,表示 savecore 在系统重新引导时不自动运行。故障映像将保留在转储设备中,即使它最初设置为保留在内存中也是如此。以 root 用户身份手动运行 /usr/bin/savecore 可检索故障映像并将其复制到 /var/crash 下的一组文件中。故障映像将保留在转储设备上,直到被后一个映像所覆盖。