Now, a new GPT partition table is going to be created by means of parted, and afterwards, it will be displayed.
root@ubuntu-server:~# parted /dev/sdb mklabel gpt
root@ubuntu-server:~# parted /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
If you try to edit the partition table with fdisk, you will come across a message as follows.
root@ubuntu-server:~# fdisk /dev/sdb
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
...
Let's create for example ten primary partitions of 10 MB each through a simple bash script.
root@ubuntu-server:~# j=1 ; for ((i=11; i<=101; i+=10)); do parted /dev/sdb mkpart primary $j $i; j=$i ; done
root@ubuntu-server:~# parted /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 10.5MB 9437kB primary
2 10.5MB 21.0MB 10.5MB primary
3 21.0MB 31.5MB 10.5MB primary
4 31.5MB 40.9MB 9437kB primary
5 40.9MB 51.4MB 10.5MB primary
6 51.4MB 60.8MB 9437kB primary
7 60.8MB 71.3MB 10.5MB primary
8 71.3MB 80.7MB 9437kB primary
9 80.7MB 91.2MB 10.5MB primary
10 91.2MB 101MB 9437kB primary
If we take a look at the GPT table, we can distinguish the following parts.
root@ubuntu-server:~# dd if=/dev/sdb bs=512 count=4 | xxd -c 16
0000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
...
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa ..............U.
0000200: 4546 4920 5041 5254 0000 0100 5c00 0000 EFI PART....\...
...
0000400: a2a0 d0eb e5b9 3344 87c0 68b6 b726 99c7 ......3D..h..&..
0000410: 4e6e ad36 2fec 8046 bc1f 4a42 82d2 8052 Nn.6/..F..JB...R
0000420: 0008 0000 0000 0000 ff4f 0000 0000 0000 .........O......
0000430: 0000 0000 0000 0000 7000 7200 6900 6d00 ........p.r.i.m.
0000440: 6100 7200 7900 0000 0000 0000 0000 0000 a.r.y...........
...
First up, it is the legacy MBR, which GPT holds for reasons of compatibility (the code 0x55AA points to the end of the MBR). The second part of the GPT (512 bytes) contains the header information for GUID partitioning. And the first partition entry appears in position 0x400.
No comments:
Post a Comment