關(guān)于Read-only file system問(wèn)題的解決
Linux有時(shí)候會(huì)遇到無(wú)法寫(xiě)文件、新建保存文件的情況,提示Readonly file system,我們可以在終端輸入如下命令即可解決:
mount -o remount rw /重新掛載文件系統(tǒng),添加寫(xiě)權(quán)限即可。
linux系統(tǒng)變?yōu)橹蛔x出現(xiàn)提示Read-only file system問(wèn)題描述linux系統(tǒng)變?yōu)橹蛔x,出現(xiàn)提示Read-only file system,如圖所示:
系統(tǒng)沒(méi)有正常關(guān)機(jī),導(dǎo)致虛擬磁盤(pán)出現(xiàn)文件系統(tǒng)錯(cuò)誤。
說(shuō)明:此修復(fù)可能會(huì)導(dǎo)致個(gè)別文件及數(shù)據(jù)丟失,修復(fù)之前建議做好文件備份工作。
解決方法使用 fsck 手動(dòng)修復(fù)磁盤(pán)文件,具體操作如下:
1.使用mount查看磁盤(pán)加載情況mount: 用于查看哪個(gè)模塊輸入只讀,一般顯示為:
[root@localhost ~]#?mountsysfs 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ō)明此磁盤(pán)是只讀狀態(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è)模塊的pidfuser -mk /home 將會(huì)直接kill那個(gè)pid修復(fù)異常的磁盤(pán)分區(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ù).
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
