To improve storage performance using Non-Volatile Memory Express (NVMe) on ECS instances created from custom images, you must verify and install the NVMe driver. This topic details the steps to install the driver to ensure your instance boots correctly and operates stably.
NVMe is a high-speed interface protocol designed for solid-state storage (such as Flash SSDs). It delivers lower latency and higher bandwidth compared to traditional protocols like SCSI and virtio-blk.
Applicable scenarios
Perform the operations in this topic if you encounter the following issues:
The Image Check reports a missing NVMe driver when you import an image to Alibaba Cloud.
You are unable to select a specific custom image when purchasing an NVMe-enabled ECS instance. This occurs when the image's NVMe attributes do not match the instance type requirements.
NoteFor a list of instance families that support NVMe, see Overview of instance families. You can also programmatically verify support by configuring the
NvmeSupportparameter when calling the DescribeInstanceTypes operation.To determine if a custom image supports NVMe, configure the
NvmeSupportparameter when calling the DescribeImages operation.For further troubleshooting, see Why am I unable to find specific images when I create ECS instances?
Procedure
Launch a temporary instance using your existing custom image. Then connect to the instance. It serves as an intermediate environment to update the driver.
ImportantYou are charged for the intermediate ECS instance. Release the instance after you create the new custom image.
Verify and install the NVMe driver. Select your configuration method below.
Automatic configuration
The Cloud Assistant
ecs_nvme_configplugin automates the NVMe driver configuration for supported operating systems.Run the following command to verify if the agent is installed and the
ecs_nvme_configplugin is available:acs-plugin-manager --list
If no output is returned, you must install Cloud Assistant Agent.
If the plugin list is returned and includes
ecs_nvme_config, proceed to the next step.
Configure NVMe-related settings.
Use the
ecs_nvme_configplugin to check if the instance has the NVMe module and supports configuration:sudo acs-plugin-manager --exec --plugin ecs_nvme_config --params --checkIf the following message appears, the driver is already installed. You can proceed directly to creating the image without further configuration.
[SUCCESS] Summary: Your image can Runnig on nvme instanceIf you receive an
errorstating the module is missing, proceed to the fix step below.[ERROR] 1.initrd/initramfs not has nvme module, Please run acs-plugin-manager --exec --plugin ecs_nvme_config --params -f/--fix to enable nvme;
Run the following command to install the driver and configure parameters:
sudo acs-plugin-manager --exec --plugin ecs_nvme_config --params --fixReboot the instance to apply changes:
sudo rebootAfter the instance restarts, run the check command again to verify the installation:
sudo acs-plugin-manager --exec --plugin ecs_nvme_config --params --checkSample success output:
[OK] 1.initrd/initramfs already contain nvme module; [OK] 2.fstab file looks fine and does not contain any device names; [OK] 3.The nvme parameters already included. [SUCCESS] Summary: Your image can Runnig on nvme instance
Manual configuration (CentOS/Alibaba Cloud Linux)
Check whether the kernel loaded the NVMe driver:
cat /boot/config-`uname -r` | grep -i nvme | grep -v "^#"
If the output contains
CONFIG_BLK_DEV_NVME=y, The kernel supports NVMe natively. You can proceed directly to Automatic configuration.If the output contains
CONFIG_BLK_DEV_NVME=m, the driver is compiled as a module. Proceed to the next step.
Check the initial RAM filesystem (
initramfs) for the NVMe driver.sudo lsinitrd /boot/initramfs-`uname -r`.img | grep -i nvme | awk '{print $NF}'
If the command returns output (e.g.,
nvme.ko,nvme-core.ko): The driver is present. You can proceed directly to Step d.If no output is returned: The driver is missing. Proceed to the next step (Step c) to rebuild the
initramfs.
Configure
initramfsto include the NVMe driver.mkdir -p /etc/dracut.conf.d echo 'add_drivers+=" nvme nvme-core "' | sudo tee /etc/dracut.conf.d/nvme.conf > /dev/null sudo dracut -v -fNoteIf the
dracuttool is not installed in your operating system, run the sudo yum -y install dracut command to installdracut.Configure NVMe I/O timeout parameters in GRUB.
NoteConfiguring the
io_timeoutparameter prevents I/O failures caused by NVMe device timeouts. By increasing this value to the maximum supported limit, you ensure the system continues processing I/O requests without premature failure.In most Linux distributions, the
io_timeoutparameter defaults to 30 seconds. To check whether you can set theio_timeoutparameter to 4,294,967,295 seconds, run theecho 4294967295 > /sys/module/nvme_core/parameters/io_timeoutorecho 4294967295 > /sys/module/nvme/parameters/io_timeoutcommand. If you receive the error-bash: echo: write error: Invalid argument: Your kernel version is limited to a maximum of 255 seconds. Use 255 instead.
Method 1: Add parameters via grubby
Check if
grubbyis available.which grubbyIf a path (e.g., /usr/sbin/grubby) is returned, proceed with the next step.
If no path is returned, proceed to Add parameters via the GRUB config file.
Run the
grubbycommand to update the kernel arguments:sudo grubby --update-kernel=ALL --args="nvme_core.io_timeout=4294967295 nvme_core.admin_timeout=4294967295"
Method 2: Add parameters via the GRUB config file
Open the grub file:
sudo vi /etc/default/grubPress the I key to enter Insert mode. Locate the
GRUB_CMDLINE_LINUX=line, add thenvme_core.io_timeoutand nvme_core.admin_timeout parameters and set them both to 4294967295.The following figure shows an example on how to add the parameters.
NoteIf the GRUB configuration file already contains the preceding parameter settings, you do not need to add the parameters again.
Press the Esc key to exit Insert mode. Then, enter
:wqand press the Enter key to save and close the file.Apply the GRUB configurations.
Select a command based on the boot mode of the ECS instance.
Legacy BIOS boot
sudo grub2-mkconfig -o /boot/grub2/grub.cfgUnified Extensible Firmware Interface (UEFI) boot
View the content of the GRUB configuration file:
cat /boot/efi/EFI/centos/grub.cfgSelect a command based on the output of the preceding command.
If the file points to another config file (e.g., /boot/grub/grub.cfg), run:

sudo grub2-mkconfig -o /boot/grub2/grub.cfgOtherwise, update the UEFI config directly:
sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Run the check command again to confirm the NVMe driver is properly configured in the
initramfs:sudo lsinitrd /boot/initramfs-`uname -r`.img | grep -i nvme | awk '{print $NF}'If the command returns the driver filenames (e.g., nvme.ko), the configuration is complete. The operating system is now ready to boot on NVMe-enabled ECS instance types.

Manual configuration (Ubuntu/Debian)
(Optional) Check the NVMe drivers included in
initrd:lsinitramfs /boot/initrd.img-`uname -r` | grep -i nvmeThe following output indicates that the NVMe driver is loaded in the
initrdof the Ubuntu operating system.
Add NVMe-related
io_timeoutparameters to the GRUB file.NoteConfiguring the
io_timeoutparameter prevents I/O failures caused by NVMe device timeouts. By increasing this value to the maximum supported limit, you ensure the system continues processing I/O requests without premature failure.In most Linux distributions, the
io_timeoutparameter defaults to 30 seconds. To check whether you can set theio_timeoutparameter to 4,294,967,295 seconds, run theecho 4294967295 > /sys/module/nvme_core/parameters/io_timeoutorecho 4294967295 > /sys/module/nvme/parameters/io_timeoutcommand. If you receive the error-bash: echo: write error: Invalid argument: Your kernel version is limited to a maximum of 255 seconds. Use 255 instead.
Open the /etc/default/grub file:
sudo vi /etc/default/grubPress the I key to enter Insert mode. On the
GRUB_CMDLINE_LINUX=line, add thenvme_core.multipath,nvme_core.io_timeout, andnvme_core.admin_timeoutparameters. Then, setnvme_core.multipathto n andnvme_core.io_timeoutandnvme_core.admin_timeoutboth to 4294967295.The following figure shows the correct configuration.
NoteIf the GRUB file already contains the preceding parameter settings, you do not need to add the parameters again.
Press the Esc key to exit Insert mode. Then, enter
:wqand press the Enter key to save and close the file.
Apply the GRUB configurations.
Run one of the following commands based on the boot mode of the ECS instance:
The following command is applicable to Ubuntu and Debian operating systems, regardless of the boot mode.
sudo update-grub2Legacy BIOS boot
sudo grub-mkconfig -o /boot/grub/grub.cfgUEFI boot
sudo grub-mkconfig -o /boot/efi/EFI/debian/grub.cfg
Create a custom image from the instance where you installed the driver. Then modify the attributes and tags of an image to enable NVMe support.
ImportantIf you do not explicitly set the NVMe driver property to Supported, the system will not recognize the image as NVMe-compatible. Consequently, you will remain unable to select NVMe-capable instance types when creating instances from this image.
(Optional) Redeploy your workload using the new, NVMe-enabled custom image. For example, create an instance from custom image or shared image. During the creation process, ensure you select an instance type that supports the NVMe protocol.
NoteAfter verifying the deployment, delete the original custom image to avoid unnecessary charges for idle resources. For details, see Delete a custom image.
References
NVMe-based ECS instances support only Enterprise SSDs (ESSDs) and ESSD AutoPL disks. These disks support Multi-attach, allowing them to be attached to multiple instances simultaneously for data sharing. For more information, see Multi-attach for cloud disks.
Improper configuration of the io_timeout parameter on Linux instances can cause NVMe disks to become unavailable. For troubleshooting steps, see What do I do if a NVMe disk on a Linux ECS instance is unavailable due to an invalid I/O timeout parameter?