在 /opt 建立目錄提示 cannot create directory: Read-only file system。三大可能原因:掛載選項無寫入權限、檔案系統錯誤需 fsck、硬碟故障。本文提供分級排查步驟。
mkdir /opt/test
mkdir: cannot create directory 'test': Read-only file system
mount
# 確認 /opt 對應裝置 (如 /dev/sda10) 掛載選項含 rw
/dev/sda10 on /opt type ext3 (rw,acl,user_xattr) # 正常有 rw
# 找出佔用進程並停止
fuser -m /dev/sda10
ps aux | grep
service httpd stop # 範例停止佔用服務
umount /opt
fsck -V -a /dev/sda10
# 輸出: /opt: recovering journal ... clean, ... files, ... blocks
hpacuclidelldset / omreportsmartctl -a /dev/sda (需安裝 smartmontools)chattr +i 導致不可寫:報錯為 Operation not permitted,非 read-only。Disk quota exceeded。