問(wèn)題描述:linux系統(tǒng)變?yōu)橹蛔x,出現(xiàn)提示Read-only file system, 如圖所示:
問(wèn)題原因:系統(tǒng)沒(méi)有正常關(guān)機(jī),導(dǎo)致虛擬磁盤出現(xiàn)文件系統(tǒng)錯(cuò)誤.
說(shuō)明:此修復(fù)可能會(huì)導(dǎo)致個(gè)別文件及數(shù)據(jù)丟失,修復(fù)之前建議做好文件備份工作.
解決方法:使用 fsck 手動(dòng)修復(fù)磁盤文件,具體操作如下:
1.使用mount查看磁盤加載情況
mount:? ?用于查看哪個(gè)模塊輸入只讀,一般顯示為:
[root@localhost ~]# 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)
[root@localhost ~]#
查看ro掛載的分區(qū),如果發(fā)現(xiàn)有ro說(shuō)明此磁盤是只讀狀態(tài)(最好也檢查下/etc/fstab查看配置文件是否就已經(jīng)設(shè)置為只讀掛載權(quán)限)
2.卸載只讀分區(qū)
[root@localhost ~]#umount /dev/vdb1
如果發(fā)現(xiàn)有提示“device is busy”,找到是什么進(jìn)程使得他busy
比如可執(zhí)行/etc/init.d/httpd stop 等命令停止正在運(yùn)行的一些服務(wù)
fuser -m /home 將會(huì)顯示使用這個(gè)模塊的pid
fuser -mk /home 將會(huì)直接kill那個(gè)pid
3.fsck修復(fù)磁盤文件
[root@localhost ~]#fsck -fvy /home
修復(fù)異常的磁盤分區(qū)
然后重新mount即可。
4、直接remount或者是mount -a,命令為
[root@localhost ~]# mount -o rw,remount /home
最后啟動(dòng)開(kāi)始停止的服務(wù)/etc/init.d/httpd start也可執(zhí)行reboot重啟下服務(wù)器讓系統(tǒng)自動(dòng)啟動(dòng)運(yùn)行的服務(wù).