1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
大数据盘的分区和文件系统格式化和小盘都存在差异。大盘必须采用 GPT 分区格式, 不能再采用小盘使用的 MBR 分区格式。
MBR 分区格式:最大支持 2 TB 的磁盘。
GPT 分区格式:最大支持 18 EB。
对于 Linux 系统上的大磁盘,也要采用 GPT 分区格式, 也可以不分区, 把磁盘当成一个整体设备使用。
在 Linux 上一般采用 XFS 或者 EXT4 来做大盘的文件系统。
磁盘的分区管理
在 Linux 上可以采用 parted 来对磁盘进行分区。
1,通过
fdisk
-l 可以查看磁盘是否存在, 由于使用的是大磁盘,
fdisk
不能用来作为分区工具了,而应该使用 parted。
# fdisk -l
WARNING: GPT (GUID Partition Table) detected on
'/dev/sdb'
! The util
fdisk
doesn't support GPT. Use GNU Parted.
Disk
/dev/sdb
: 17679.7 GB, 17679696003072 bytes
256 heads, 63 sectors
/track
, 2141037 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical
/physical
): 512 bytes / 4096 bytes
I
/O
size (minimum
/optimal
): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1
1 266306 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
2,使用 parted 对
/dev/sdb
进行分区。首先创建分区表, 选择 GPT 格式的分区表。 parted
/dev/vdb
# parted /dev/sdb
GNU Parted 2.1
Using
/dev/sdb
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/sdb
will be destroyed and all data on this disk will be lost. Do you want to
continue
?
Yes
/No
?
Yes
/No
?
yes
(parted) p
Model: DELL PERC H730 Mini (scsi)
Disk
/dev/sdb
: 17.7TB
Sector size (logical
/physical
): 512B
/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
3,创建分区。
(parted) mkpart
Partition name? []?
File system
type
? [ext2]? ext4
Start? 0G
End? 17679G
(parted) p
Model: DELL PERC H730 Mini (scsi)
Disk
/dev/sdb
: 17.7TB
Sector size (logical
/physical
): 512B
/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 17.7TB 17.7TB
(parted) quit
Information: You may need to update
/etc/fstab
.
EXT4 文件系统格式化
假定 Linux 实例上的大数据盘设备为
/dev/sdb
, 可以用如下方式来格式化。以下参数为常用参数, 用户可以根据自己的需要来调整。
对于 16TB 以上的大盘, 对 ext4 格式化所用的工具包 e2fsprogs 的版本有要求。如果 e2fsprogs 版本太低, 比如:e2fsprogs 1.41.11,会出现如下错误信息:
mkfs.ext4: Size of device
/dev/md0
too big to be expressed
in
32 bits using a blocksize of 4096.
升级:
wget https:
//www
.kernel.org
/pub/linux/kernel/people/tytso/e2fsprogs/v1
.42.8
/e2fsprogs-1
.42.8.
tar
.gz
tar
xvzf e2fsprogs-1.42.8.
tar
.gz
cd
e2fsprogs-1.42.8
.
/configure
make
make
install
/sbin/mke2fs
-O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
/dev/sdb1
|
本文转自 wpf926 51CTO博客,原文链接:http://blog.51cto.com/wupengfei/1956715,如需转载请自行联系原作者