linux swap掛載失敗問題處理

chenoracle發表於2021-01-27

問題描述:
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章