Problem description
During the migration of an operating system, the "Not enough space on /boot" error message is reported.
Cause
The /boot
partition of the operating system to be migrated must have at least 100 MiB available space to install the new initramfs file and kernel. If the /boot
directory does not have at least 100 MiB available 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.
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.
Run the following command to view the installed kernel versions:
rpm -qa | grep kernel
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
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
Set the kernel of the latest version in the remaining kernels to the default startup kernel.
Run the following command to view all installed kernels:
grubby --info=ALL
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
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
After the error is resolved, run the SMC client and retry the migration job. For more information, see Run the SMC client.