背景:
看到监控报警swap空间不足,系统内存本身占用不高是什么原因呢。
登录到服务器查看发现swap空间没有了,很奇怪。因为swap空间为dd 出来的文件然后挂载的。找到swap文件尝试启动。
# swapon swapfile
报错: changing permissions of ‘swap’: Read-only file system
查看权限之前我设置的是600。本身root用户登录,看下属组和属主是root,这不应该只读。尝试修改权限报同样的错误。
尝试在当前目录创建一个文件也是只读。突然明白,本身所在分区出了问题。mount 查看是ro模式。怪不得呢
尝试重新挂载
# mount -o remount,rw /dev/vdb1 /home/
提示:cannot remount block device /dev/vdb1 read-write, is write-protected
写保护了。
斟酌了一下。主要的服务没在该分区,只有一个测试用的oracle 数据库,数据库本身已经挂了。果断选择卸载后重挂。
# umount /home
umount: /home: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
卸载失败。
根据提示 lsof查看一下
# lsof /home
看到结果3个root用户进程在占用 、
因终端退出没有错误信息了。
在根据提示fuser 杀掉进程
# fuser -k /home
杀掉进程后 umount 卸载分区后重新挂载 解决。
进入分区 swapon swapfile 成功。
mount -a 也可以将 /etc/fstab里面配置的所有分区挂载