|
|
|
|
|
Linux - MBR & GPT
同事遇到一個問題,他有一個 RAID 硬碟系統,硬碟大小大概 20T Bytes (20 x 1024 Gbytes) ,很可惜的是用 RHEL 下的 #fdisk 卻不能用,
上網查了一下原來傳統的 #fdisk 只適用於由 MBR 切割出來的磁區,但 MBR 最大也只支援到 2.2 TB ,所以必須透過 GPT(GUID Partition Table) 的切割硬碟方式.所以只能使用 #parted 這個工具.那在 Redhat 什麼版本支援 gpt 呢!!其實從 RHEL4 就開始支援了,在這個網站 http://www.delltechcenter.com/page/3TB+drives:+OS+Behavior+Matrix 的列表中顯示 RHEL 4.8 / RHEL 5.5 / RHEL 6 都支援,其他常用的作業系統是否支援在這網站上都查詢的到.
其中的 gpt 和 uEFI 是息息相關的,在安裝 RHEL6 時光碟是由 uEFI 的光碟開啟時,系統預設就會使用 gpt 的切割方式, "Intel therefore developed a new partition-table format in the late 1990s as part of what eventually became UEFI. The GPT as of 2010 forms a subset of the UEFI specification."有興趣可以自行參考 wiki http://en.wikipedia.org/wiki/GUID_Partition_Table
- uEFI - http://en.wikipedia.org/wiki/Extensible_Firmware_Interface
- GPT - http://en.wikipedia.org/wiki/GUID_Partition_Table
Extensible Firmware Interface (EFI) 的功能就類似傳統 BIOS ,他是 OS 與硬體之間溝通介面. 不過相較於傳統的 BIOS EFI 他的架構更模組化,功能更強大.EFI 的架構是由 Intel 提出的, 目前是交由 Unified EFI Forum 來管理.也就是我們現在所稱的 Unified Extensible Firmware Interface (UEFI)
GUID Partition Table 就類似於 MBR 的功能但是傳統的 MBR 有 2.2 TB 大小的限制,所以新的 uEFI 系統採用 GPT 新的切割方式.
如果在安裝時系統沒將硬碟使用 GPT 的切割磁區時,可以透過 [Ctrl]+[Alt]+[F2] "shell prompt" 使用 parted 來手動改變硬碟為 GPT 並做切割等動作.
| [anaconda root@localhost /]# parted /dev/sda GUN Parted 2.1 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel New disk label type?gpt Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No?Yes (parted) q Information: You may need to update /etc/fstab. |
要透過 parted 切割磁區時使用 (parted) mkpart ,比較會讓人困惑的是 start 和 end, parted 在做切割時我們可以自己選擇由系統的哪一個區塊的空間開始並由哪一個空間結束,如果你選擇 start ?100 End?10000 就表示系統會保留硬碟前 100MB 的空間之後再切割出 10G (10000MB) 大小的硬碟.但是如果那 10G 的空間已經是被其他 partition tables 占用時也沒關係系統會自動幫我們選擇一個最適合的空間.
| (parted) mkpart Partition type? Primary/extended?p File system type? [ext2]? Start? 100 End? 10000 Warning: You requested a partition from 100MB to 10.0GB. The closest location we can manage is 10.0GB to 10.GB. Is this still acceptable to you? Yes/No?y (parted) print |
切割完磁區後要選擇檔案格式,因為是 20TB 容量的硬碟如果要使用 ext2 http://en.wikipedia.org/wiki/Ext2 當成檔案格式時有一點需要注意的,#mkfs.ext2 預設的 Block size 為 2K 其最大檔案系統上限為 8TB ,所以要使用這 20TB 大硬碟時可以在建立 ext2 時加入參數 -b 並指定大小 4KB 可達 16TB 而 8KB 可達 32TB,但如果超過 32 TB就必須選擇 ext4 http://en.wikipedia.org/wiki/Ext4 的格式了.
-
- sunchiahome's blog
- 增加新的回應
- 瀏覽次數 2505
回應
xfs
我同事建議如果超過 16TB 的硬碟裝置可以使用 xfs 的檔案格式,一樣就是使用 GPT + XFS 的組合就可以格式化超過 16TB 的硬碟裝置.
不過很可惜 Ubuntu 11.04 和 RHEL 6 對於 xfs 並不是預設安裝,須透過 yum 或是 apt-get 去安裝.並在格式化時選擇格式為 xfs