天天看點

GPT分區一、介紹二、案例

GPT分區

一、介紹

分區模式GPT

GPT,GUID Partition Table

–全局唯一辨別分區表

–突破固定大小64位元組的分區表限制

–最多可支援128個主分區,最大支援18EB容量

1 EB = 1024 PB = 1024 x 1024 TB

二、案例

parted常用分區指令
–help    //檢視指令幫助
–mktable  gpt    //建立指定模式分區表
–mkpart  分區的名稱  檔案系統類型  start  end
    //指定大小或百分比%作為起始、結束位置
–print   //檢視分區表
–rm  序号    //删除指定的分區
–quit   //退出互動環境
//檢視塊裝置
[root@www ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   60G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   59G  0 part
  ├─centos-root 253:0    0 38.3G  0 lvm  /
  ├─centos-swap 253:1    0    2G  0 lvm  [SWAP]
  └─centos-home 253:2    0 18.7G  0 lvm  /home
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
└─sdb5            8:21   0    1G  0 part
sdc               8:32   0   10G  0 disk
sr0              11:0    1  4.3G  0 rom  /mydvd
[root@www ~]#

// 對sdc進行分區
[root@www ~]# parted /dev/sdc
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mktable gpt    //指定分區模式
(parted) mkpart        //劃分新的分區
Partition name?  []? sdb_test 
File system type?  [ext2]? ext4
Start? 0  // 初始點
End? 1G   // 結束點
// 此時會警告,因為我們占用了初始的空間,測試環境中,我們忽視即可
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?
Ignore/Cancel? Ignore
// 檢視分區表資訊
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name      Flags
 1      17.4kB  1000MB  1000MB               sdb_test

(parted)
// 在進行一次分區

(parted) mkpart
Partition name?  []? sdc_test2
File system type?  [ext2]? ext4
Start? 1G
End? 5G
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name       Flags
 1      17.4kB  1000MB  1000MB               sdb_test
 2      1000MB  5000MB  3999MB               sdc_test2

(parted)

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

// 此時我們可以看到分好的區
[root@www ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0    60G  0 disk
├─sda1            8:1    0     1G  0 part /boot
└─sda2            8:2    0    59G  0 part
  ├─centos-root 253:0    0  38.3G  0 lvm  /
  ├─centos-swap 253:1    0     2G  0 lvm  [SWAP]
  └─centos-home 253:2    0  18.7G  0 lvm  /home
sdb               8:16   0    10G  0 disk
├─sdb1            8:17   0     1G  0 part
├─sdb2            8:18   0     1G  0 part
├─sdb3            8:19   0     1G  0 part
├─sdb4            8:20   0     1K  0 part
└─sdb5            8:21   0     1G  0 part
sdc               8:32   0    10G  0 disk
├─sdc1            8:33   0 953.7M  0 part
└─sdc2            8:34   0   3.7G  0 part
sr0              11:0    1   4.3G  0 rom  /mydvd
[root@www ~]#

           

繼續閱讀