現在硬碟越來越大,使用 Raid5 合併硬碟空間超過16T或20T
如何在大硬碟底下安裝 CentOS 5.x
 
首先是 CentOS 5.x 開機沒有支援GPT,所以開機區必須小於2T
16T 或更大的硬碟空間就必須切成2塊 partition
一塊 小於2T的 partition 安裝作業系統,另一塊用來放資料或把home mount在這裡
 
如果partition沒有先規劃好,那麼安裝完 CentOS 時 開機就會出現錯誤訊息:
Your boot partition is on a disk using the GPT partitioning Scheme but this machines cannot boot using GPT.


 
 
 
 
以我自己的例子來舉例:
我是硬碟是 Raid5 組成的10T硬碟空間
我先使用 parted 切割1T 給作業系統安裝OS,剩下的空間用來 mount 到 /home
開機的 Partition 要設定成 msdos
剩下的大 Partition 要設定成 GPT
在RHEL系統上,用fdisk命令分區最大硬碟分區不能超過2T(fdisk不支持GPT)。超過2T分區需要使用parted命令進行分區操作
超過2T只能將磁盤轉化成GPT格式。
 
parted
GNU Parted 1.8.1
Using /dev/md0
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
 
把1T 的空間切成一個 primary partition
(parted) mkpart primary
File system type? [ext2]? ext3
Start?
Start? 1
End? 1000000
(parted)
 
把1T 的空間設定為msdos,安裝完作業系統後才能開機
parted -s /dev/cciss/c0d1 mklabel msdos
 
(parted) select /dev/cciss/c0d0
Using /dev/cciss/c0d0
(parted) print
 
確認分區狀況
fdisk -l
 
Disk /dev/cciss/c0d0: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 Linux
/dev/cciss/c0d0p2 14 130541 1048466160 8e Linux LVM
 
WARNING: GPT (GUID Partition Table) detected on ‘/dev/cciss/c0d1’! The util fdisk doesn’t support GPT. Use GNU Parted.
 
WARNING: The size of this disk is 8.9 TB (8928084713472 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).
 

Disk /dev/cciss/c0d1: 8928.0 GB, 8928084713472 bytes
255 heads, 63 sectors/track, 1085444 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
/dev/cciss/c0d1p1 1 267350 2147483647+ ee EFI GPT
 
Disk /dev/dm-0: 1069.4 GB, 1069413302272 bytes
255 heads, 63 sectors/track, 130015 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-0 doesn’t contain a valid partition table
 
Disk /dev/dm-1: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


 
 
 
 
把剩下的 8.9T空間再切成一個 primary partition
(parted) select /dev/cciss/c0d1
Using /dev/cciss/c0d1
(parted) print
Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d1: 8928GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
 
parted) mkpart primary
File system type? [ext2]? ext3
Start? 0
End? -1
(parted) print
 
Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d1: 8928GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
 
Number Start End Size File system Name Flags
1 17.4kB 8928GB 8928GB primary
 
確認分區狀況
(parted) select /dev/cciss/c0d1
Using /dev/cciss/c0d1
(parted) print
 
Model: Compaq Smart Array (cpqarray)
Disk /dev/cciss/c0d1: 8928GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
 
Number Start End Size File system Name Flags
1 17.4kB 8928GB 8928GB primary
 

最後格式化 8.9T空間為ext3
mkfs -t ext3 -c /dev/cciss/c0d1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1089863680 inodes, 2179708182 blocks
108985409 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
66520 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632
 
Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
 
補充一下:
如果GPT的硬碟分區大於16T , 在格式化成ext3時會出現錯誤訊息
mkfs.ext3: Size of device /dev/sdc1 too big to be expressed in 32 bits using a blocksize of 4096.
來看看ext3文件系統對單個文件和整個file system的最大尺寸的限制情況,如下所示:
block大小 最大文件 最大file system
1kb 16G 2T
2KB 256G 8T
4KB 2T 16T
8KB 16T 32T
所以如果超過16T 就必須在切分區
就算使用8KB 去格式化 ext3 ,最後卻無法mount 只是在浪費時間
 
在補充一下parted 指令的help
(parted) help
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [free|NUMBER|all] display the partition table, a partition, or all devices
quit exit program
rescue START END rescue a lost partition near START and END
resize NUMBER START END resize partition NUMBER and its file system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version displays the current version of GNU Parted and copyright information
IMAG1429

Tags: , , , , ,