/dev/centos/swap does not exist

在centos/rhel上部署k8s时,安装系统时有swap分区,后期部署环境时候关闭了swap分区,手动删除/dev/centos/swap后会出现这类问题。

解决方法:

进入dracut,挂载系统根分区。

dracut# mkdir tmp1
dracut# mount /dev/centos/root tmp1
dracut# vi tmp1/etc/defaut/grub

修改GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rhgb quiet"

#GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rhgb quiet"

挂载boot分区

dracut# cat tmp1/etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Jan  2 21:15:59 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=22747de8-b577-4bbb-9b5e-40c1b8c3c504 /boot                   xfs     defaults        0 0
#/dev/mapper/centos-swap swap                    swap    defaults        0 0

可以看到boot分区的设备UUID为22747de8-b577-4bbb-9b5e-40c1b8c3c504

dracut# blkid
/dev/vda1: UUID="22747de8-b577-4bbb-9b5e-40c1b8c3c504" TYPE="xfs"
/dev/vda2: UUID="T7xTcp-ywWd-ciYc-k9mU-Fd3f-TCfe-wgKQgd" TYPE="LVM2_member"

UUID为22747de8-b577-4bbb-9b5e-40c1b8c3c504对应的设备为/dev/vda1

挂载boot分区设备

dracut# mkdir tmp2
dracut# mount /dev/vda1 tmp2

删除下面两处的rd.lvm.lv=centos/swap

dracut# vi /tmp2/grub2/grub.cfg
linux16 /vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8

linux16 /vmlinuz-0-rescue-6f9bcc60986041238dcda79bfef462d5 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet

改为

linux16 /vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quiet LANG=en_US.UTF-8

linux16 /vmlinuz-0-rescue-6f9bcc60986041238dcda79bfef462d5 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rhgb quiet

保存退出并重启

挂载EFI分区

查看efi分区的设备的UUID

/dev/sda1: UUID="B0AA-455F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="de397640-f96e-4bfc-a247-965144d06b28"

挂载efi分区,修改tmp3/efi/EFI/centos/grub.cfg文件

dracut# mkdir tmp3
dracut# mount /dev/sda1 tmp3
dracut# vi tmp3/efi/EFI/centos/grub.cfg

将tmp3/efi/EFI/centos/grub.cfg文件下的rd.lvm.lv=centos/swap删除

你可能感兴趣的:(/dev/centos/swap does not exist)