All Products
Search
Document Center

Server Migration Center:What do I do if the "Not enough space on /boot" error message appears?

Last Updated:Jul 14, 2023

Problem description

The "Not enough space on /boot" error message appears when you migrate an operating system.

Cause

The /boot partition of the operating system to be migrated must have at least 100 MiB free space to install the new initramfs file and kernel. If the /boot directory does not have at least 100 MiB free space, the operating system may fail to be migrated.

Solution

Delete the kernel versions that are no longer needed in the /boot directory, including the corresponding initramfs, vmlinuz, and config files. Make sure that the kernel can successfully start after the unnecessary kernel versions are deleted.

  1. Connect to the Elastic Compute Service (ECS) instance whose operating system you want to migrate. In this case, connect to the ECS instance as the root user. For more information, see Connect to a Linux instance by using a password or key.

  2. Run the following command to view the installed kernel versions:

    rpm -qa | grep kernel
  3. Run the following command to view the kernel version that is being used:

    uname -r

    A command output similar to the following one is returned:

    [root@iZbp104w56ovfyfxy9o**** ~]# uname -r
    3.10.0-1160.el7.x86_64
  4. Delete the kernel versions that are no longer needed.

    In this example, kernel-3.10.0-514.26.2.el7.x86_64 is deleted.

    • If the kernel version is installed by using an RPM package, run the following command to delete the kernel version:

      yum remove kernel-3.10.0-514.26.2.el7.x86_64
    • If the kernel version is installed by compiling the source code, run the following commands in sequence to delete the kernel version:

      REMOVE_KERNEL=3.10.0-514.26.2.el7.x86_64
      grubby --remove-kernel=/boot/vmlinuz-$REMOVE_KERNEL
      rm -rf /boot/initramfs-$REMOVE_KERNEL.img /boot/initramfs-${REMOVE_KERNEL}kdump.img /boot/symvers-$REMOVE_KERNEL.gz /boot/System.map-$REMOVE_KERNEL /boot/vmlinuz-$REMOVE_KERNEL /boot/config-$REMOVE_KERNEL
      grubby --remove-kernel=/boot/vmlinuz-$REMOVE_KERNEL
  5. Set the kernel of the latest version in the remaining kernels to the default startup kernel.

    1. Run the following command to view all installed kernels:

      grubby --info=ALL
    2. Run the following command to view the default startup kernel:

      grubby --default-kernel

      A command output similar to the following one is returned:

      [root@iZbp104w56ovfyfxy9o**** ~]# grubby --default-kernel
      /boot/vmlinuz-3.10.0-1160.90.1.el7.x86_64
    3. Run the following command to set the kernel of the latest version in the remaining kernels to the default startup kernel.

      In this example, 3.10.0-1160.76.1.el7.x86_64 is set to the default startup kernel.

      grubby --set-default /boot/vmlinuz-3.10.0-1160.76.1.el7.x86_64
  6. Retry the operating system migration job. For more information, see Migrate an operating system.