31

Linux虚拟机文件系统突然变成只读问题解决

 5 years ago
source link: https://www.linuxprobe.com/linux-file-question.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
导读 出现IO错误。重启虚拟机表示磁盘错误,用命令“fsck / -y”修复磁盘错误。这种情况出现过几次,有时修复磁盘之后可以继续启动,后来干脆就无法启动了。

重新安装虚拟机并checkout代码,也很容易出现这个问题。宿主系统运行任务比较多,系统比较慢。有一次svn checkout出错,在宿主系统(Ubuntu)用iotop看进程IO状况,发现updatedb.mlocate写入速度很大,达到10M/s以上。

这个页面解析了原因:High I/O causing filesystem corruption

当宿主系统和虚拟机的IO都比较繁忙时,虚拟机的IO请求得不到及时的响应。虚拟机Linux不知道自己运行在虚拟机里面,会认为是磁盘IO错误,为了保护磁盘数据会remount分区为只读。

解决方法见上面的链接,不过都比较高级(使用直接IO、修改内核参数、使用LVM分区等)。

简单解决办法:

1) 不要在宿主系统和虚拟机同时运行高IO任务(别以为你的i7电脑很厉害);

2) 备份虚拟机(复制vmdk文件或使用VirtualBox快照),就算出错了也容易恢复。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK