硬盘容量越来越大,当需要超过2T的分区时MBR已经不能支撑了,需要使用GPT,Linux中最常用的分区工具fdisk是无法进行GPT分区的,需要使用parted。

查看分区

# parted -l
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  标志
 1      1049kB  525MB   524MB   primary  ext4         启动
 2      525MB   53.7GB  53.2GB  primary               lvm

...

设置硬盘标识为gpt

# parted /dev/mapper/mpatha
GNU Parted 2.1
使用 /dev/mapper/mpatha
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel
新的磁盘标签类型? gpt                                                    
警告: The existing disk label on /dev/mapper/mpatha will be destroyed and all data on this disk will be lost. Do you want to continue?
/Yes//No? y                                                           
(parted) p                                                                
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpatha: 4196GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  标志

建立新的分区

# parted /dev/mapper/mpatha
GNU Parted 2.1
使用 /dev/mapper/mpatha
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpatha: 4196GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  标志

(parted) mkpart                                                           
分区名称  []? p1                                                        
文件系统类型  [ext2]? ext4                                              
起始点 1                                                                
结束点 4196GB                                                           
(parted) p                                                                
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpatha: 4196GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  标志
 1      1049kB  4196GB  4196GB  ext4         p1

(parted) q                                                                
信息: You may need to update /etc/fstab.

格式化分区

# mkfs -t ext4 /dev/mapper/mpathap1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
256114688 inodes, 1024458240 blocks
51222912 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
31264 block groups
32768 blocks per group, 32768 fragments per group
8192 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

正在写入inode: 完成                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override

[ 编辑 | 历史 ]
最近由“jilili”在“2016-11-19 09:20:58”修改