假如想对>2T磁盘进行分区操作,请使用parted
fdisk 是基于MBR的分区工具,假如fdisk -l检查到了gpt磁盘,那么会报错
Disk /dev/sdb: 19998.4 GB, 19998430986240 bytes
255 heads, 63 sectors/track, 2431337 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 267350 2147483647+ ee GPT
WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
检测到
GPT分区表在
/dev/sdc,
fdisk不支持GPT,请使用Parted
####################################################################################
####################################################################################
parted分区过程:
[root@host1 ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
help
align-check TYPE N check partition N for TYPE(min|opt) alignment
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] print 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 partition 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 [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
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 display the version number and copyright information of GNU Parted
(parted)
p
Model: PM8060- R5 (scsi) <<<<<<<<<<<能够显示出RAID设置
Disk /dev/sdb: 20.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt <<<<<<<<<<<显示分区表类型
Number Start End Size File system Name Flags
(parted)
mklabel gpt
<<<<<<<<<将分区表转换为GPT格式后才能够进行分区
Warning: The existing disk label on /dev/sdb
will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)
mkpart p1 <<<<<<<<<<<<<<创建分区p1 注意这里只是个名字,并不影响其他使用
File system type? [ext2]? ext3 <<<<<<<<<<这里是选择使用哪种文件系统,我们的目标是ext4,但是parted不支持ext4
Start? 1 <<<<<<<从哪里开始? 第一个分区默认是1就行,但是假如是其他分区,那么接着上面的分区大小,最好+1G左右,继续分区
End?
End? 19998GB <<<<<<<<从哪里结束,网上有说-1是结束,有待试验.
(parted) p
Model: PM8060- R5 (scsi)
Disk /dev/sdb: 20.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 20.0TB 20.0TB p1
已经分好了
看起很好,分区很顺利,但是问题在后面...
注意:
RHEL6 上默认的 mkfs.ext4 工具并不支持>16TB的分区,网上的解决方案是:
1. 使用xfs,可以在mirror.163.com上下载
http://mirrors.163.com/centos/6.8/os/x86_64/Packages/
xfsprogs-3.1.1-19.el6.x86_64.rpm
xfsprogs-devel-3.1.1-19.el6.x86_64.rpm
xfsprogs-qa-devel-3.1.1-19.el6.x86_64.rpm
但是需要注意:
http://blog.csdn.net/msdnchina/article/details/50591833
XFS - XFS is supported when using OL7 or RHEL 7. Oracle has not tested XFS with earlier versions of OL or RHEL.
所以不建议在RHEL6上使用xfs用作安装ORACLE
2. 去官网下载新版
引自:http://blog.csdn.net/xztjhs/article/details/40182581
红帽/CentOS 6.5的e2fsprogs版本为1.41.12较低,无法创建16TB以上的文件系统
下载最新的e2fsprogs,编译安装
ftp://ftp.ntu.edu.tw/linux/kernel/people/tytso/e2fsprogs/
tar zxvf e2fsprogs-1.42.10.tar.gz
cd e2fsprogs-1.42.10
mkdir build
cd build/
../configure
make
make install
但是这招我也没试过
3. 使用8K的block进行格式化
What are the Valid/Supported Block Sizes for Ext3, Ext4 and XFS File Systems? (文档 ID 2256965.1)
For example, in x86_64 architecture, PAGESIZE IS 4096. This means filesystem on this computer can have a maximum block-size of 4K.
但是咱们默认的PAGESIZE就是4096
所以就算格式化完成了,也没办法挂载
最后的解决方案:
向大佬妥协了,将20TB划成一个12TB和一个8TB.
然后mkfs.ext4
后期创建数据文件的时候需要注意放在不同的分区下就行了