天天看點

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