分区模式中的王思聪:GPT
传统分区模式MBR
主分区最多4个
单个分区容量不能大于2TB
没有主分区系统将无法引导
GPT分区模式
主分区最多128个
单个分区容量不能大于18EB
不存在主分区逻辑分区的概念
不适合安装X86架构的系统
GPT分区创建方法:parted命令
[root@tomshen ~]# parted GNU Parted 2.1 #版本 使用 /dev/sda #默认指定第一块磁盘 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted)
parted命令:获取帮助信息
help 或h
(parted) h align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system move NUMBER START END move partition NUMBER 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 resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit 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 (parted)
parted命令:查看分区详情
print查看当前磁盘分区详情print all 查看所以分区详情
(parted) print #只查看当前磁盘/dev/sda Model: VMware, VMware Virtual S (scsi) Disk /dev/sda: 21.5GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system 标志 1 1049kB 525MB 524MB primary ext4 启动 2 525MB 21.5GB 20.9GB primary lvm (parted) print all #查看所以磁盘分区详情 Model: VMware, VMware Virtual S (scsi) Disk /dev/sda: 21.5GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system 标志 1 1049kB 525MB 524MB primary ext4 启动 2 525MB 21.5GB 20.9GB primary lvm Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 10.7GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name 标志 2 3000MB 4000MB 1000MB tom Model: Linux device-mapper (linear) (dm) Disk /dev/mapper/vg_tomshen-lv_swap: 2080MB Sector size (logical/physical): 512B/512B Partition Table: loop Number Start End Size File system 标志 1 0.00B 2080MB 2080MB linux-swap(v1) Model: Linux device-mapper (linear) (dm) Disk /dev/mapper/vg_tomshen-lv_root: 18.9GB Sector size (logical/physical): 512B/512B Partition Table: loop Number Start End Size File system 标志 1 0.00B 18.9GB 18.9GB ext4 警告: 无法以读写方式打开 /dev/sr0 (只读文件系统)。/dev/sr0 已按照只读方式打开。 #光驱中无光盘,故而报错 错误: 无效的分区表 - /dev/sr0 出现递归分区。 忽略/Ignore/放弃/Cancel?
parted命令:创建分区(交互式)
使用mkpart命令不带参数交互式创建分区
如在/dev/sdb上创建分区,首先使用select命令切换到/dev/sdb
(parted) select /dev/sdb #切换到/dev/sdb 使用 /dev/sdb (parted) mklabel gpt #使用mklabel命令指定分区表类型默认为msdos(既MBR) 警告: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? 是/Yes/否/No? y (parted) (parted) mkpart #开始创建 分区名称? []? mygpt #输入分区名称(卷标) 文件系统类型? [ext2]? ext4 #输入文件系统类型(默认ext2) 起始点? 4000 #从第几MB开始 结束点? 6000 #第几MB结束 (parted)
使用parted命令创建GPT分区分区范围是以#MB至#MB表示范围,而不是#扇区至#扇区。
parted命令:创建分区(命令行式)
语法:mkpart 分区名称 开始MB 结束MB
(parted) mkpart tomshen 6000MB 8000MB #创建分区tomshen 范围从6000MB(不包含6000MB)到8000MB (parted) print Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 10.7GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name 标志 2 3000MB 4000MB 1000MB tom #以前创建的分区 1 4000MB 6000MB 2000MB mygpt 3 6000MB 8000MB 2000MB tomshen (parted)
parted命令:删除分区
rm 分区编号
(parted) rm 3 (parted) print Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 10.7GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name 标志 #Number 既分区编号 2 3000MB 4000MB 1000MB tom 1 4000MB 6000MB 2000MB mygpt (parted)
退出parted命令行:quit
如果要退出parted命令行的话,输入quit即可。
转载于:https://blog.51cto.com/3037673/1736369