Resolving Kernel Panic after New NVMe SSD Installation on CentOS 7
In this article, we will discuss the steps to resolve a kernel panic that can occur after installing a new NVMe SSD on a CentOS 7 system. This guide assumes that you have an existing CentOS 7 (7.6.1810) system running on an AMD platform, and it is currently using a Core O/SATA SSD. You have decided to add storage by installing a new Samsung NVMe SSD.
Kernel Panic: What is it and Why Does it Happen?
A kernel panic is a critical error that occurs when the Linux kernel encounters an issue it cannot recover from. This results in the system halting and displaying a panic message, indicating that the system cannot continue to operate normally. This can be caused by various reasons, including hardware or software issues, such as incompatible drivers or firmware.
Installing the New NVMe SSD
Begin by installing the new NVMe SSD in your system. Make sure to properly connect it to the motherboard and secure it in place. Once installed, boot your CentOS 7 system and enter the BIOS setup to ensure that the system recognizes the new NVMe SSD. Save any changes and exit the BIOS setup.
Partitioning and Formatting the NVMe SSD
Next, you will need to partition and format the new NVMe SSD. To do this, you can use the fdisk or parted utilities. For this example, we will use fdisk:
sudo fdisk /dev/nvme0n1
Create a new GPT partition table, then create a new partition. Set the partition type to Linux filesystem, and make sure to write the changes to the disk.
Command (m for help): g
Created a new GPT disklabel.
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-209715199, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199):
Created a new partition 1 of type 'Linux filesystem' and of size 100 GiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 83
Changed type of partition 'Linux filesystem' to 'Linux'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.Now, format the new partition using the mkfs.ext4 utility:
sudo mkfs.ext4 /dev/nvme0n1p1
Mounting the New NVMe SSD
Create a new directory where you will mount the new NVMe SSD:
sudo mkdir /mnt/nvme
Mount the new NVMe SSD to the directory you just created:
sudo mount /dev/nvme0n1p1 /mnt/nvme
Resolving Kernel Panic
The kernel panic can occur due to incompatible drivers for the NVMe SSD. To resolve this, you need to install the latest kernel and NVMe drivers. Follow these steps to install the updated kernel and NVMe drivers:
- Update the package list:
sudo yum update -y
- Install the latest kernel:
sudo yum install kernel-ml -y
- Reboot the system to load the new kernel:
sudo reboot
- Install the latest NVMe drivers:
sudo yum install kmod-nvme-fabrics -y
- Load the NVMe driver:
sudo modprobe nvme-fabrics
Verifying the Fix
After completing the above steps, reboot the system one more time to ensure that the kernel panic has been resolved:
sudo reboot
Once the system has rebooted, check the system logs to verify that there are no further kernel panics. You can do this by using the journalctl command:
sudo journalctl -b -1 -k
- Kernel panic can occur after installing a new NVMe SSD on CentOS 7.
- To resolve the kernel panic, install the latest kernel and NVMe drivers.
- Make sure to properly partition, format, and mount the new NVMe SSD.
- Verify that the kernel panic has been resolved by checking the system logs.
References
- Kernel Panic: https://www.kernel.org/doc/html/latest/admin-guide/kernel-panic.html
- Installing NVMe SSD on CentOS 7: https://wiki.centos.org/HowTos/NVMe
- Installing Kernel-ml on CentOS 7: https://wiki.centos.org/AdditionalResources/Repositories/Kernel-ml
- Installing NVMe Drivers on CentOS 7: https://rpmfind.net/linux/rpm2html/search.php?query=kmod-nvme-fabrics