全国建设网站,wordpress演示数据库,徐州做网站的设计师,做ps的赚钱的网站有哪些关于MBR和GPT这两种分区表#xff0c;wiki上讲的很清楚。不过有些同学可能看不了#xff0c;你需要先了解科学上网。这里我就只把它们的结构图贴上#xff0c;简要说明了。https://zh.wikipedia.org/wiki/%E4%B8%BB%E5%BC%95%E5%AF%BC%E8%AE%B0%E5%BD%95https://zh.wikipedi… 关于MBR和GPT这两种分区表wiki上讲的很清楚。不过有些同学可能看不了你需要先了解科学上网。这里我就只把它们的结构图贴上简要说明了。https://zh.wikipedia.org/wiki/%E4%B8%BB%E5%BC%95%E5%AF%BC%E8%AE%B0%E5%BD%95https://zh.wikipedia.org/wiki/GUID%E7%A3%81%E7%A2%9F%E5%88%86%E5%89%B2%E8%A1%A8MBRMBR使用磁盘的最开始的512Byte结构图如下。可以看到只有中间的64Byte是用来描述分区表的每16Byte描述一个分区所以最多只能同时划分4个主分区。而描述硬盘分区结构信息的这16Byte是如下这样的结构。可以发现只有最后4Byte是用来描述分区总的扇区数的4Byte是32位也就是分区最大只能是2^32*512Byte,大概是2.2TB。# 备份MBR分区表
[rootlocalhost ~]# dd if/dev/sda of/backup/mbr.bak bs512 count1GPTGPT的结构是下面这样的一个逻辑块LBA大小是512Byte。出于兼容性考虑LBA 0即硬盘的第一个扇区仍然用作MBR之后LBA 1是分区表头。LBA 2-33都用来描述分区表项每个LBA可描述4个分区即每个分区使用128Byte来描述。另外GPT分区将在磁盘最后的33个扇区作为主分区表的备份称为备份分区表。而每个分区表项是如下这样的结构可以看到它使用8Byte描述分区起始位置和结束位置那么就是(2^64-1)*512Byte9.4ZB9.4×10^21字节。# 备份GPT分区表
[rootlocalhost ~]# dd if/dev/sda of/backup/gpt.bak bs512 count34parted在执行parted命令过程中我得到了这样一个警告信息说是分区在划分时没有对齐可能会影响性能。(parted) mkpart boot 0 200M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?参照这两篇文章CentOS parted分割大于2TB硬盘的performance问题处理 | 月飞博客How to align partitions for best performance using partedparted的交互模式[rootlocalhost /]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type help to view a list of commands.
(parted) mklabel gpt
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?
Yes/No? y
(parted) mkpart boot 2048s 200M
(parted) mkpart swap 200M 2248M
(parted) mkpart data 2248M 100%
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: Number Start End Size File system Name Flags1 1049kB 200MB 199MB ext4 boot2 200MB 2248MB 2048MB swap3 2248MB 21.5GB 19.2GB data(parted) rm 3
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: Number Start End Size File system Name Flags1 1049kB 200MB 199MB ext4 boot2 200MB 2248MB 2048MB swap(parted) mkpart data 2248M -1
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: Number Start End Size File system Name Flags1 1049kB 200MB 199MB ext4 boot2 200MB 2248MB 2048MB swap3 2248MB 21.5GB 19.2GB data(parted) name 3 backup
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: Number Start End Size File system Name Flags1 1049kB 200MB 199MB ext4 boot2 200MB 2248MB 2048MB swap3 2248MB 21.5GB 19.2GB backup(parted)
(parted) quit
Information: You may need to update /etc/fstab.危险操作清除GPT分区表[rootlocalhost ~]# dd if/dev/zero of/dev/sdb bs512 count34parted的非交互模式[rootlocalhost ~]# cat parted-script.sh
#!/usr/bin/bashparted -s /dev/sdb mklabel gpt
parted -s /dev/sdb mkpart boot 2048s 200MiB
parted -s /dev/sdb mkpart swap 200MiB 2248MiB
parted -s /dev/sdb mkpart backup 2248Mib 100%
parted -s /dev/sdb print[rootlocalhost homework]# bash parted-script.sh
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: Number Start End Size File system Name Flags1 1049kB 210MB 209MB ext4 boot2 210MB 2357MB 2147MB swap3 2357MB 21.5GB 19.1GB backup 转载于:https://blog.51cto.com/knfprex3a29/1750581