ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux swap挂载失败问题处理

linux swap挂载失败问题处理

原创 Linux操作系统 作者:chenoracle 时间:2021-01-27 19:29:18 0 删除 编辑

问题描述:
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###

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29785807/viewspace-2753902/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE Associate、OCMU 用户组成员、Oracle 11g OCM、微信公众号"IT小Chen"

注册时间:2014-08-05

  • 博文量
    604
  • 访问量
    1384674