問題描述:linux系統變為只讀,出現提示Read-only file system, 如圖所示:
問題原因:系統沒有正常關機,導致虛擬磁盤出現文件系統錯誤.
說明:此修復可能會導致個別文件及數據丟失,修復之前建議做好文件備份工作.
解決方法:使用 fsck 手動修復磁盤文件,具體操作如下:
1.使用mount查看磁盤加載情況
mount: 用于查看哪個模塊輸入只讀,一般顯示為:
[[email protected] ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=388136k,mode=700)
/dev/vdb1 on /home type ext4 (ro,relatime,data=ordered)
[[email protected] ~]#
查看ro掛載的分區,如果發現有ro說明此磁盤是只讀狀態(最好也檢查下/etc/fstab查看配置文件是否就已經設置為只讀掛載權限)
2.卸載只讀分區
[[email protected] ~]#umount /dev/vdb1
如果發現有提示“device is busy”,找到是什么進程使得他busy
比如可執行/etc/init.d/httpd stop 等命令停止正在運行的一些服務
fuser -m /home 將會顯示使用這個模塊的pid
fuser -mk /home 將會直接kill那個pid
3.fsck修復磁盤文件
[[email protected] ~]#fsck -fvy /home
修復異常的磁盤分區
然后重新mount即可。
4、直接remount或者是mount -a,命令為
[[email protected] ~]# mount -o rw,remount /home
最后啟動開始停止的服務/etc/init.d/httpd start也可執行reboot重啟下服務器讓系統自動啟動運行的服務.
本文地址:http://www.alolpiu.com.cn/host/1859.html
發表評論
評論列表(條)