2TB 單碟解決方式

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

2TB 單碟解決方式

文章 yehlu »

http://figaro.neo-info.net/?p=313

現在的硬碟容量越來越大,以前1TB的磁碟空間是多麼的遙不可及,但現在隨便買兩個500GB的磁碟就可以輕鬆達成。Linux 的 fdisk 磁碟分割工具有單碟2TB的分割限制,當超過2TB的磁碟分割出來會無法正常辨識,因此我們需要使用另外一個磁碟分割工具 parted 來解決此問題。


步驟一:利用parted 來分割大磁碟裝置

[root@server ~]# parted /dev/sda
GNU Parted 1.6.19
Copyright (C) 1998 - 2004 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Using /dev/sda
(parted) mklabel gpt 設定製作標籤為 GPT,一定得改成GPT模式,不然就會跟一般分割磁碟一樣有容量限制
(parted) mkpart primary 0 -1 分割一個主要的磁碟裝置,給全部的空間
(parted) print 檢視目前的分割表狀態
Disk geometry for /dev/sda: 0.000-3814436.000 megabytes
Disk label type: gpt
Minor Start End Filesystem Name Flags
1 0.017 3814435.000
(parted)

因為我有三個大磁碟需要融合成為一個大的磁碟區,所以選用LVM2來做為製作大磁區的工具:

步驟二:利用 pvcreate 建立 PV
[root@server~]# pvcreate /dev/sda1

[root@server~]# pvcreate /dev/sdb1

[root@server~]# pvcreate /dev/sdc1

步驟三:利用 pvdisplay 檢視剛才的 PV 製作結果

[root@server~]# pvdisplay /dev/sda1
— NEW Physical volume —
PV Name /dev/sda1
VG Name
PV Size 3.64 TB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID s4oBET-cHQb-jSfZ-Vs10-WKie-JfVG-rlLltg

[root@server ~]# pvdisplay /dev/sdb1
— NEW Physical volume —
PV Name /dev/sdb1
VG Name
PV Size 3.64 TB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID X2BSgD-7H6O-ekhl-cYhc-ea4W-o0zj-Th5Qoq

[root@server ~]# pvdisplay /dev/sdc1
— NEW Physical volume —
PV Name /dev/sdc1
VG Name
PV Size 3.64 TB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID kLFkcK-xoUq-fA2d-wqtH-v1VS-HdF4-73OQya

步驟四:建立VG

[root@server~]# vgcreate mainVG /dev/sda1 /dev/sdb1 /dev/sdc1
Volume group “mainVG” successfully created
[root@server ~]# vgdisplay mainVG
— Volume group —
VG Name mainVG
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 10.91 TB
PE Size 4.00 MB
Total PE 2860824
Alloc PE / Size 0 / 0
Free PE / Size 2860824 / 10.91 TB
VG UUID MfEFMb-TdB0-oPhP-ZcTb-wXOA-ze24-crF2mI

步驟六:產生一個LV裝置

[root@server ~]# lvcreate -n pub1 -l2860824 mainVG
Logical volume “pub1″ created
[root@server ~]# lvdisplay mainVG
— Logical volume —
LV Name /dev/mainVG/pub1
VG Name mainVG
LV UUID pNj7Eo-OpHw-ELW3-5P6d-dhfP-QDC2-9sXPuK
LV Write Access read/write
LV Status available
# open 0
LV Size 10.91 TB
Current LE 2860824
Segments 3
Allocation inherit
Read ahead sectors 0
Block device 253:3

大功告成了,接著你可以選擇 XFS 或是 Reiserfs 來做為主要的檔案系統,製作完檔案系統後就可以進行掛載了 ^^
回覆文章

回到「Linux」