在centos/rhel上部署k8s時(shí)馒胆,安裝系統(tǒng)時(shí)有swap分區(qū)狭郑,后期部署環(huán)境時(shí)候關(guān)閉了swap分區(qū)亚茬,手動(dòng)刪除/dev/centos/swap后會(huì)出現(xiàn)這類問題。
解決方法:
進(jìn)入dracut抢呆,掛載系統(tǒng)根分區(qū)髓削。
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分區(qū)
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分區(qū)的設(shè)備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對(duì)應(yīng)的設(shè)備為/dev/vda1
掛載boot分區(qū)設(shè)備
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分區(qū)
查看efi分區(qū)的設(shè)備的UUID
/dev/sda1: UUID="B0AA-455F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="de397640-f96e-4bfc-a247-965144d06b28"
掛載efi分區(qū),修改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刪除