發新話題

[分享] Read-only file system錯誤訊息,馬上備份與還原!

Read-only file system錯誤訊息,馬上備份與還原!

# smartctl -q errorsonly -H -l selftest -l error /dev/sda
--------------------- Smartd Begin ------------------------
Currently unreadable (pending) sectors detected:
/dev/sda - 48 Time(s)
6 unreadable sectors detected
---------------------- Smartd End -------------------------
當你在 Linux 下指令時出現 "Read-only file system" 的錯誤訊息時,請不要大意,因為你的硬碟可能已經出問題了。昨天早上收到一封從 smartd daemon 寄出的郵件,得知我的硬碟可能出狀況了。
This email was generated by the smartd daemon running on:
host name: xxxxx.abc.com
DNS domain: xxx.abc.com
NIS domain: (none)
The following warning/error was logged by the smartd daemon:
Device: /dev/hdc, 1 Currently unreadable (pending) sectors
For details see host's SYSLOG (default: /var/log/messages).
You can also use the smartctl utility for further investigation.
No additional email messages about this problem will be sent.
接著我在系統輸入任何指令都會出現異常,因為整個磁碟區都無法寫入任何資料,當然也包括 /tmp 目錄,所以許多服務都掛點了,而我也試著下 mount 指令重新掛載硬碟讓他變成可讀寫:
mount -o rw,remount /
不過卻於事無補,之後用 dmesg 工具查看最近的硬體狀況,結果發現硬碟真的出現讀寫失敗的情況。雖然我有定時備份的習慣,但我的第一步就是先趕快備份重要資料,備份完之後就是趕緊想辦法修復硬碟,不過修著...修著...,「它」不說一聲的就走了~ 根本沒給我多少的時間,而我大部分設定檔也沒備份出來,就只備份了資料庫與一些重要的程式而已,雖然是內部用的主機,不過也有些最近寫的 Script 與設定檔消失不見了。真的等「痛」到了之後,才知道「備份」與「還原」何等重要,而且「缺一不可」,因為我從來沒有認真的做過 Linux 的「還原」演練,導致真的發生狀況時手忙腳亂的,剎那間真的有點傻住了,短時間要去查詢指令或測試指令怎麼用根本來不及應付狀況,只好趕快重新安裝一台 Linux 比較快。

但這時的我心理想到的竟然是「如果 Linux 也有像微軟一樣提供優秀的技術支援中心那該有多好」,因為當下無助的狀況真的想罵人都不知道要罵誰,如果是微軟的產品出問題還有 0800 電話可以問,解決不了還可以發發飆出出氣(開玩笑啦~呵呵)。網路上 Linux 的相關資料真的是一大堆,不過大多都是論壇討論或一些垃圾資訊,真的想快速找到解決方案真的很難,像是這種像硬體失敗的狀況問題百百種,每個人遇到的狀況都不盡相同,且 Linux 版本這麼多,多少遇到的問題都有些差異,所以真的很累人。因為跟了我將近六年的主機(硬碟)就在一轉眼說走就走,真的只能怪自己沒好好做功課把「備份」與「還原」的機制演練好,所以人真的是「不經一事、不長一智」,這個慘痛的經驗跟大家分享,該做的事千萬不要遲疑,馬上行動,才不會空留遺憾啊!
----------------------------------
mount -t auto /dev/sdb1 /mnt/hdc
We have mounted it on /hdc
# mkdir /hdc
# mount -t ext3 /dev/sdb1 /hdc
# df
ilesystem           1K-blocks      Used Available Use% Mounted on
dev/sda3            464561716   5923300 434659396   2% /
dev/sda1               396623     22985    353157   7% /boot
mpfs                  8090412         0   8090412   0% /dev/shm
usr/tmpDSK             495844     12744    457500   3% /tmp
dev/sdb1            480719056    202812 456097044   1% /mnt/hdc
dev/sdb1            480719056    202812 456097044   1% /hdc
----------------------------------------------
just type
# umount /hdc
then do the mount like we did to your /mnt
-----------------------------------------------
Re: mount 掛載新硬碟的問題... linux 新手碰到問題
引述:
    請問各位有關 mount 掛載的問題..
    我有一顆硬碟另外裝至 linux 上
    一如往常的使用 mount -t auto /dev/hdc1 /mnt/hdc
    可是... 奇怪的事情來了 /mnt/hdc 檔案的屬性怪怪的
    它的檔案權限就只有 755 的權限
    但是我掛載在 /mnt/hdc  有需要給samba 做分享
    因為我有需要將檔案放到 那顆新硬碟
    所以必定"其他"使用者的權限要是可以寫入才行...
    當然我也試過 chmod 將之改為 777格式... 但是沒用 - -
    ls -l 看之後 他的檔案還是 755 的格式 怎麼會這樣阿  救救我阿

因為你的硬碟是 windows fat 格式檔案系統?
若是的話,請於 mount 時傳入 -o umask 指定權限遮罩項目。
ps: vfat 的 fs 不支援權限設定,所以當然無法用 chmod 改權限。
----------------------------------------------
That's why we ran that command to check for ANY errors, and there's no errors, no bad sectors. You can run the command and check for yourself.If there is error with the drive, you will see something like this:
# smartctl -q errorsonly -H -l selftest -l error /dev/sda
ATA Error Count: 8121 (device log contains only the most recent five errors)
Error 8121 occurred at disk power-on lifetime: 3447 hours (143 days + 15 hours)
Error 8120 occurred at disk power-on lifetime: 3447 hours (143 days + 15 hours)
Error 8119 occurred at disk power-on lifetime: 3447 hours (143 days + 15 hours)
Error 8118 occurred at disk power-on lifetime: 3447 hours (143 days + 15 hours)
Error 8117 occurred at disk power-on lifetime: 3447 hours (143 days + 15 hours)

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。