如何在Linux操作系统中使用parted分区---gpt

一、实验环境

VMware虚拟机
CentOS 7

二、需求分析

Linux系统一般是作为服务器的,分区采用LVM分区,之前LVM分区采用2TB的分区大小,现在硬盘越来越大,超过2TB的很常见。对于超过2TB的话,需要采用parted分区模式。

三、实验步骤

先在虚拟机中加一块大小为4096GB的硬盘,即为4TB
查看分区,分区为sdd

[root@localhost ~]# fdisk -l     //查看一下分区信息
......
磁盘 /dev/sdd:4398.0 GB, 4398046511104 字节,8589934592 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

进入/dev/sdd
使用help命令,相当于MBR中的m,帮助指令
在这里插入图片描述

[root@localhost ~]# parted /dev/sdd
GNU Parted 3.1
使用 /dev/sdd
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
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  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
  
  resizepart NUMBER END                    resize partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  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

创建新的分区表,一般用gpt类型
创建新分区大小:起始容量0T、结束容量1T,大小为1T

(parted) mklabel gpt                                                      
(parted) mkpart primary 0 1T                                              
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel?
忽略/Ignore/放弃/Cancel? ignore 

在这里插入图片描述
再创建一个大小为2T的分区
p命令显示分区信息
在这里插入图片描述

(parted) mkpart primary 1T 3T
(parted) p                                                                
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     标志
 1      17.4kB  1000GB  1000GB               primary
 2      1000GB  3000GB  2000GB               primary

使用rm命令可以删除分区
在这里插入图片描述

(parted) rm                                                               
分区编号? 2                                                              
(parted) p                                                                
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     标志
 1      17.4kB  1000GB  1000GB               primary

quit命令为退出
在这里插入图片描述

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

parted分区完后,就可以用fdisk命令进行划分了

猜你喜欢

转载自blog.csdn.net/ycycyyc_/article/details/107069877