天天看点

parted 如何对大于2T的磁盘进行分区

【我的/dev/sdb有20T 该如何分区】

yum install parted

总结:

1)fdisk 不能对其进行分区,因为只支持2T

    但是fdisk delete分区的操作还是可以的

    fdisk -l 可能看不了 操作2T磁盘的分区情况,需要改用parted -l

2)parded命令可以对其进行GPT格式的分区

分区命令:

  交互式进入去分区

<code>parted </code><code>/dev/sdb</code>

  将MBR磁盘格式化为GPT

<code>mklabel gpt</code>

 分一个10T的

<code>mkpart primary 0 10T</code>

  和一个将最后所有分区分到这个分区

<code>mkpart primary 10T  -1</code>

格式化

<code> </code><code>mkfs.ext4 </code><code>/dev/sdb1</code>

10T的磁盘大概需要格式化三分钟

<code>[root@hblf-bak002 ~]# parted /dev/sdb </code>

<code>GNU Parted 2.1</code>

<code>Using /dev/sdb</code>

<code>Welcome to GNU Parted! Type 'help' to view a list of commands.</code>

<code>(parted) mklabel gpt                                                      </code>

<code>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?</code>

<code>Yes/No? yes                                                               </code>

<code>(parted) mkpart primary 0 10T                                            </code>

<code>Warning: The resulting partition is not properly aligned for best performance.</code>

<code>Ignore/Cancel? Ignore                                                     </code>

<code>(parted) print                                                            </code>

<code>Model: DELL PERC H730P Mini (scsi)</code>

<code>Disk /dev/sdb: 19.8TB</code>

<code>Sector size (logical/physical): 512B/4096B</code>

<code>Partition Table: gpt</code>

<code>Number  Start   End     Size     File system  Name     Flags</code>

<code> </code><code>1      17.4kB  10.0TB  10000GB               primary</code>

<code>(parted) mkpart primary 10T -1                                            </code>

<code> </code><code>2      10.0TB  19.8TB  9797GB                primary</code>

非交互式命令:

<code>parted -s </code><code>/dev/sdb</code> <code>mklabel gpt</code>

<code>parted -s </code><code>/dev/sdb</code> <code>mkpart primary 0 100%</code>

分一个16T+的

parted -s /dev/sdb mklabel gpt

parted -s /dev/sdb mkpart primary 0 10T

parted -s /dev/sdb mkpart primary 10T 100%

parted -l 结果:

Model: DELL PERC H730P Mini (scsi)

Disk /dev/sdb: 16.2TB

Sector size (logical/physical): 512B/4096B

Partition Table: gpt

Number  Start   End     Size     File system  Name     Flags

 1      17.4kB  10.0TB  10000GB               primary

 2      10.0TB  16.2TB  6198GB                primary

然后在进行格式化

mkfs.ext4 /dev/sdb1

mkfs.ext4 /dev/sdb2

在mount 一下

########### 

一个分区大于16T ext4是不支持的。挂载会报错。

parted -s /dev/sdb mkpart primary 0 25T

parted -s /dev/sdb mkpart primary 25T 100%

mkfs.xfs /dev/sdb1 -f

mkfs.xfs /dev/sdb2 -f

mount -t xfs  /dev/sdb1 /data2/

mount -t xfs  /dev/sdb2 /data3/

本文转自残剑博客51CTO博客,原文链接http://blog.51cto.com/cuidehua/1773205如需转载请自行联系原作者

cuizhiliang