FreeBSD 上關於硬碟的各種疑問

最近在裝新的機器,FreeBSD 9 的預設 partition table 變成  GPT 了。我產生了幾點疑問:

  1. FreeBSD 9 之前,分割區通常都是長類似這樣:/dev/ad0s1a ,可是我新灌了一台他是長這樣:/dev/ada0p2
  2. GPT label 與 glabel 有何不同
  3. FreeBSD 9 到底能不能從 EFI 開機?我灌的那一臺是 EFI 的機器沒錯,不過我不確定他是否有啓用什麼模擬 BIOS 的機制之類的
  4. 對 BSD 來說,partition 與 slice 到底是什麼意思?
  5. 何謂 soft-updates? journaled soft-updates? 又 UFS 預設是什麼狀況?

依次就我調查到的結果來做個筆記:

一、

有兩個地方不同,首先是 ad 變成 ada ,這是因爲啓用了 AHCI ,AHCI 讓 SATA 硬碟速度稍微加速,並支援熱插拔功能。參考:

再來是 s1a 變成 p2 ,大致上來說前者是只有在 MBR partition table 纔會出現,意思是第一個 slice (s1) 的第一個 partition (a) ;後者只有在 GPT 纔會出現,意思是第二個 GPT 分割區 (p2) 。

二、

GPT label 很顯然是只有分割表格式是 GPT 的時候才能用,可以使用 # gpart show -l 來查看目前各分割區的 label 。在分割區未掛載的狀況下,裝置節點會出現在 /dev/gpt/<label> ,掛載之後,這個節點就消失了。可以直接在 /etc/fstab 中將原本的裝置節點 (eg. /dev/ada0p2) 改成 GPT 的裝置節點 eg. /dev/gpt/<label> 。 glabel 與 FreeBSD 特有的 GEOM 有關,即使是 MBR 也可以作 glabel ,裝置節點會出現在 /dev/label/<label>

三、

GPT 其實是 EFI 標準的一部分,但 BIOS 系統也可以使用 GPT partition table 。FreeBSD 支援 EFI+GPT 和 BIOS+GPT 。但是那臺機器上到底是哪一種我搞不清楚,尚待調查。

四、

BSD 當中,partition 與 slice 是兩個很容易混淆的概念,尤其是 BSD 的 partition 代表的意義又與一般常見的意義不同。

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disk-organization.html

File systems are contained in partitions. This does not have the same meaning as the common usage of the term partition (for example, MS-DOS partition), because of FreeBSD’s UNIX® heritage. Each partition is identified by a letter from a through to h. Each partition can contain only one file system, which means that file systems are often described by either their typical mount point in the file system hierarchy, or the letter of the partition they are contained in.

“partition" 裏面裝的是檔案系統 (file system) 。"partition" 在此與一般常見(像是 MS-DOS partition )的意義不同,這是由於 FreeBSD 的 UNIX® 傳統。每一個 partition 由 a 到 h 作爲編號。每一個 partition 只能包含一個 File System 。[…]

Each partition-that-contains-a-file-system is stored in what FreeBSD calls a slice. Slice is FreeBSD’s term for what the common call partitions, and again, this is because of FreeBSD’s UNIX background. Slices are numbered, starting at 1, through to 4.

每一個包含 File System 的 “partition" 都被儲存於 FreeBSD 稱作 “slice" 的東西之中。FreeBSD 中"slice" 的意義其實與 “partition" 的一般常見意義是相同的,這也是由於 FreeBSD 的 UNIX 傳統。"slice" 的編號從 1 到 4 。

五、

我還沒完全瞭解。參考:

其他筆記

  • FreeBSD 5.0 開始, UFS 的預設版本都是 UFS2 http://en.wikipedia.org/wiki/Unix_File_System
  • /dev/ad0s1a 中的 a~h 的編號是由 bsdlabel(8) 建立的
  • 參考 manpage
    • bsdlabel(8)
    • gpart(8)
    • newfs(8)
    • fdisk(8)
    • glabel(8)