Configuring OS Dump
Scenarios
If your ECS OS becomes faulty, a system crash or blue screen of death (BSOD) may occur. In this case, you can configure OS dump to enable the memory data to be stored in a file. You can then use this information to locate the fault.
This section describes how to configure an OS dump.
Background
An OS dump is also known as a kernel dump or crash dump. When a system crash (usually a stop error) occurs, the memory data is completely backed up in real time. A complete memory dump is produced from this event.
The OS dump function relies on the OS kernel's capability of processing hardware exceptions. The OS kernel can detect hardware exceptions and determine the handling method based on the exception type. If the system encounters an exception or error that cannot be handled, some or all information will be dumped to disks. The information includes the CPU register, physical memory, process status, file system status, and hardware device status.
An OS dump can be triggered in the following ways:
- System crash: When an exception or error that cannot be handled occurs, such as invalid memory access or kernel panic, the system automatically triggers a dump.
- Manual triggering: The system administrator can use commands or operations to manually trigger a dump. For example, in Linux, the system administrator can add the parameter c to /proc/sysrq-trigger to trigger a dump.
- Scheduled triggering: The system administrator can schedule a dump at a specified time to simulate a system crash and obtain the system information at that time.
To obtain a dump file, you need to configure the OS of your ECS. For example, in the Linux OS, you need to configure kdump. The following describes how to manually trigger a dump.
Constraints
- An OS dump will cause the ECS to restart. Back up data in advance to prevent data loss.
- Kunpeng ECSs do not support OS dump.
- OS dump is only available for ECSs in Running, Stopped, or Faulty status.
- OS dump is only available for ECSs whose specifications are 4 vCPUs and 8 GiB of memory, or above.
- The reserved memory must be greater than the memory of the ECS.
Configuring an OS Dump (Windows)
The Windows Server 2016 is used as an example. For operations on more versions, see the help documents provided on the corresponding official website.
- Log in to a Windows ECS.
- Open Control Panel and choose System > Advanced system settings.
Figure 1 Advanced system settings
- In the Performance area of the System Properties dialog box, click Settings.
- In the Virtual memory area on the Advanced tab, click Change.
Figure 2 Performance options
- In the Virtual Memory dialog box, select Automatically manage paging file size for all drives.
Figure 3 Virtual memory
- Click OK to complete the virtual memory settings.
- In the Startup and Recovery area of the System Properties dialog box, click Settings.
- Configure required parameters.
- Write debugging information: Select Complete memory dump.
- Dump file: Change %SystemRoot%\MEMORY.DMP to a local drive with sufficient disk space, for example, E:\Memory.dmp.
Figure 4 Startup and recovery settings
- Click OK.
- Restart the ECS to complete the settings.
Configuring an OS Dump (Linux)
The CentOS 7.5 is used as an example. For operations on more versions, see the help documents provided on the corresponding official website.
- Log in to a Linux ECS.
- Install kexec-tools.
- Check the size of the memory reserved for crashkernel.
cat /etc/default/grub
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="net.ifnames=0 consoleblank=600 console=tty0 console=ttyS0,115200n8 spectre_v2=off nopti crashkernel=auto " GRUB_DISABLE_RECOVERY="true"
- Adjust the reserved memory size by changing the value of crashkernel.
vim /etc/default/grub
The reserved memory size for crashkernel is auto. You can adjust the reserved memory size by changing the value of crashkernel in the GRUB_CMDLINE_LINUX field.
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="net.ifnames=0 consoleblank=600 console=tty0 console=ttyS0,115200n8 spectre_v2=off nopti crashkernel=256M" GRUB_DISABLE_RECOVERY="true"
You can determine the reserved memory size for crashkernel based on the system architecture. If the size is too small, the coredump file may fail to be generated.
In this example, the system memory is 1 GiB, and the reserved memory is 256 MB.
- Generate a new grub configuration file.
- Edit the kernel parameter file /etc/sysctl.conf.
vim /etc/sysctl.conf
Add the following parameters to the /etc/sysctl.conf file to switch the OS to the emergency mode and generate a memory dump when an NMI is received:
kernel.panic_on_unrecovered_nmi=1 kernel.unknown_nmi_panic=1
- Reboot the system.
- Open /etc/kdump.conf and modify the default configuration.
vim /etc/kdump.conf
# Specify the path where the coredump file is stored. path /var/crash # Add the parameter -c to compress the coredump file. core_collector makedumpfile -c -l --message-level 1 -d 31 # Reboot the system after the coredump file is generated. default reboot
- Start kdump and enable auto-start upon system boot.
systemctl enable kdump.service
- Check whether kdump is started.
Redirecting to /bin/systemctl status kdump.service ● kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled) Active: active (exited) since Wed 2024-05-22 21:19:47 CST; 11min ago Main PID: 591 (code=exited, status=0/SUCCESS) CGroup: /system.slice/kdump.service
systemctl is-active kdump.service
active
Triggering an OS Dump
- Log in to the management console.
- Click in the upper left corner and select your region and project.
- Click . Under Compute, click Elastic Cloud Server.
- In the ECS list, locate the row containing the target ECS and choose More > Troubleshoot > Trigger OS Dump in the Operation column.
- Learn about the OS dump risks and select the check box.
- Click OK to trigger an OS dump.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot