问题描述:
swap无法挂载,挂载成功后,约5秒后自动umount。
环境说明:
OS:Redhat 7.6
问题现象:
查看swap没有分配大小
[root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 0 0 0问题原因:
查看自动挂载配置
[root@VM-VM-XXX-CJCOS ~]# cat /etc/fstab|grep swap /dev/mapper/vg_srv-lv_swap swap swap defaults 0 0
尝试手动挂载 [root@VM-XXX-CJCOS ~]# swapon /dev/mapper/vg_srv-lv_swap [root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 7 0 7 [root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 7 0 7 [root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 7 0 7约5秒后自动umount
[root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 0 0 0 [root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 0 0 0 [root@VM-XXX-CJCOS ~]# swapon -a [root@VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 6 Swap: 0 0 0查看messages日志
显示和kubernetes有关
[root@VM-XXX-CJCOS ~]# tail -f /var/log/messages ...... Jan 25 18:49:11 VM-VM-XXX-CJCOS12 kubelet: I0125 18:49:11.582232 52234 client.go:104] Start docker client with request timeout=2m0s Jan 25 18:49:11 VM-VM-XXX-CJCOS12 kubelet: F0125 18:49:11.582472 52234 server.go:273] failed to run Kubelet: failed to create kubelet: failed to get docker version: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Jan 25 18:49:11 VM-VM-XXX-CJCOS12 systemd: kubelet.service: main process exited, code=exited, status=255/n/a Jan 25 18:49:11 VM-VM-XXX-CJCOS12 systemd: Unit kubelet.service entered failed state. Jan 25 18:49:11 VM-VM-XXX-CJCOS12 systemd: kubelet.service failed. Jan 25 18:49:16 VM-VM-XXX-CJCOS12 systemd: Configuration file /etc/systemd/system/kubelet.service is marked executable. Please remove executable permission bits. Proceeding anyway. Jan 25 18:49:16 VM-VM-XXX-CJCOS12 systemd: Reloading.由于是测试服务去,k8s已经不在使用,停止kubelet后,再次挂载swap
[root@VM-XXX-CJCOS ~]# systemctl stop kubelet.servic systemctl disable kubelet.service [root@VM-XXX-CJCOS ~]# swapon /dev/mapper/vg_srv-lv_swap再次查看,恢复正常
[root@VM-VM-XXX-CJCOS ~]# free -g total used free shared buff/cache available Mem: 7 0 3 0 3 6 Swap: 7 0 7 [root@VM-VM-XXX-CJCOS ~]# swapon -s Filename Type Size Used Priority /dev/dm-1 partition 8388604 0 -2
###chenjuchao 2021-01-27 19:25###