三小時架好 FreeNAS 私有雲(6)


ZFS 特色與術語

以下是幾個建置 FreeNAS 系統時,對於保護資料相當重要的設定。

6.1. 設定 Emails.


如果我們希望系統在檢測到硬碟故障時,能在第一時間用電子郵件通知我們,請設定好 E-mail吧!如果是使用 Gmail 的話,可參考 google 的官方資料。

使用其他電子郵件程式讀取 Gmail 郵件 (透過 IMAP 協定)


6.2. S.M.A.R.T. Tests

S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) ,顧名思義,透過各種回報的指標資料,它是一個監控硬碟並回報硬碟可能發生問題的技術,大部份的磁碟機都提供這項功能。 
點選 Tasks  S.M.A.R.T. 測試  新增 S.M.A.R.T. 測試。,如下圖,設定好之後,便到 “服務”選單,啟動這個功能,但假如沒有任何“volumes”被設立,S.M.A.R.T便無法啟動。
Note
如果有陣列卡,為了避免發生意外,請勿啟動 S.M.A.R.T. 服務,這是因為 RAID controller 本身就有這個功能。
_images/smart1.png


Warning
An example configuration is to schedule a Short Self-Test once a week and a Long Self-Test once a month. These tests should not have a performance impact, as the disks prioritize normal I/O over the tests. If a disk fails a test, even if the overall status is Passed, start to think about replacing that disk.
Some S.M.A.R.T. tests cause heavy disk activity and can drastically reduce disk performance. Do not schedule S.M.A.R.T. tests to run at the same time as scrub or resilver operations or during other periods of intense disk activity.
Which tests will run and when can be verified by typing smartd -q showtests within Shell.
The results of a test can be checked from Shell by specifying the name of the drive. For example, to see the results for disk ada0, type:
smartctl -l selftest /dev/ada0

If an email address is entered in the Email to report field of Services  S.M.A.R.T., the system will send email to that address when a test fails.





6.3. 加購不斷電系統。


6.4. 將 Scrubs 加入排程:


相對於傳統 unix 檔案系統的 fsck,ZFS 稱之為 scrub,若使用 scrub,ZFS 會去檢查儲存資料的確認索引值並修正有錯誤的地方,暫時的硬體問題造成的資料錯誤便可被處理好。Scrub 在 google 翻譯中,顯示為 “擦洗”,也有人把它叫做為“資料檢查”、“資料清理”、“磁碟清理”或是“垃圾清理”等。哈…我們還是練習一下它的英文原名吧!比較不會搞錯它原始的意思。

Linux 或是 FreeBSD下的 fsck 工具,執行前必須先 unmount (卸載)磁碟機,但執行 Scrub 卻不需要執行這個動作,甚至可以對正在操作的資料進行檢查。所以 Scrub 會檢查所有的資料,包括原始資料和資料本身,因此執行時間會比 fsck 長很多。

Scrub 是對已儲存的資料進行檢測,所以必須透過 S.M.A.R.T 輔助,執行的時間取決於已存入的資料總量。由於執行 Scrub 檢查會頻繁讀寫已存儲的數據,執行時對系統性能會產生一定影響,因此應該安排在晚上或週末執行Scrub 檢查,這可以降低對用戶的影響。

在磁碟機發生問題前,通常可以透過 Scrubs 檢查出來,所以把它加入排程吧!但是聰明的 FreeNAS 卻在我們一設好某個 volume時,便同時設定好同名的 scrub 了。

官方建議,如果你的 FreeNAS 系統安裝企業級硬盤,最好每個月執行一次 ,如果是配備消費級硬碟,建議每個星期執行一次 Scrub 。

點選

儲存 → 檢視 Scrubs → 檢視 Scrubs

如下圖,這可以顯示系統所有的 Scrubs 排程,點選 edit 可以修改它。









































此外,也可以手動執行 scrub







小結:

使用 ZFS 檔案系統的 FreeNAS,透過 Scrubs 和 S.M.A.R.T,可以提早檢測出可能出問題的磁碟機,保護我們珍貴的資料。

留言

這個網誌中的熱門文章

電腦科評語

拔河技巧

三小時架好 FreeNAS 私有雲(3)