DiskPartitioning:Example:UEFI with GPT
fdisk를 사용한 UEFI with GPT 파티션 방법.
Layout overview
Mount point | Partition | Suggested size | |
| | EFI system partition | 260–512 MiB |
| | Linux x86-64 root (/) | Remainder of the device |
[SWAP] | | Linux swap | More than 512 MiB |
Step by Step
fdisk를 사용하여 아래와 같이 진행한다.
파티션 확인
실행
도움말 출력
Command (m for help): m
Help:
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
파티션 테이블 출력
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 26186DBA-706B-4B55-8F8D-A04D98C4762A
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 490233855 489183232 233.3G Linux filesystem
파티션 제거
반복 실행하여, 존재하는 모든 파티션을 제거한다:
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 26186DBA-706B-4B55-8F8D-A04D98C4762A
빈 GPT 파티션을 만든다
Command (m for help): g
Created a new GPT disklabel (GUID: 8C8A1B68-71C1-AE46-9161-8884F72BE345).
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8C8A1B68-71C1-AE46-9161-8884F72BE345
첫 번째 파티션을 생성한다
Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-490234718, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-490234718, default 490234718): +512M
Created a new partition 1 of type 'Linux filesystem' and of size 512 MiB.
Partition #1 contains a vfat signature.
Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8C8A1B68-71C1-AE46-9161-8884F72BE345
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M Linux filesystem
Filesystem/RAID signature on partition 1 will be wiped.
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): L
1 EFI System C12A7328-F81F-11D2-BA4B-00A0C93EC93B
2 MBR partition scheme 024DEE41-33E7-11D3-9D69-0008C781F39F
3 Intel Fast Flash D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
4 BIOS boot 21686148-6449-6E6F-744E-656564454649
5 Sony boot partition F4019732-066E-4E12-8273-346C5641494F
6 Lenovo boot partition BFBFAFE7-A34F-448A-9A5B-6213EB736C22
7 PowerPC PReP boot 9E1A2D38-C612-4316-AA26-8B49521E5A8B
8 ONIE boot 7412F7D5-A156-4B13-81DC-867174929325
9 ONIE config D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149
10 Microsoft reserved E3C9E316-0B5C-4DB8-817D-F92DF00215AE
11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
12 Microsoft LDM metadata 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
13 Microsoft LDM data AF9B60A0-1431-4F62-BC68-3311714A69AD
14 Windows recovery environment DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
15 IBM General Parallel Fs 37AFFC90-EF7D-4E96-91C3-2D7AE055B174
16 Microsoft Storage Spaces E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D
17 HP-UX data 75894C1E-3AEB-11D3-B7C1-7B03A0000000
18 HP-UX service E2A1E728-32E3-11D6-A682-7B03A0000000
19 Linux swap 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
20 Linux filesystem 0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data 3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86) 44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM) 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64) B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64) 993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID A19D880F-05FC-4D3B-A006-743F0F84911E
30 Linux extended boot BC13C2FF-59E6-4262-A352-B275FD6F7172
31 Linux LVM E6D6D379-F507-44C2-A23C-238F2A3DF928
...
Partition type (type L to list all types): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8C8A1B68-71C1-AE46-9161-8884F72BE345
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
Filesystem/RAID signature on partition 1 will be wiped.
두 번째 파티션을 생성한다
두 번째 파티션의 마지막 섹터를 계산할 때, 아래와 같이 출력 된다면
-512M
으로 입력하면 마지막 512MByte 크기 이상을 남기고 파티션이 설정된다. (섹터가 자동으로 정렬된다)
-
옵션을 입력할 수 없다면
만약 -
옵션을 입력할 수 없다면 다음과 같이 출력된다.
마지막 섹터 위치를 직접 계산해야 한다. 1개의 섹터는 Logical Sector의 크기로 계산하면 된다. 계산 공식은 아래와 같다.
여기에서 512MByte를 확보하고 싶고, 1섹터는 512Byte 이므로
{원하는 남은 공간 (섹터 크기)}
는 1048576
이다.
디스크의 마지막 섹터 위치가 490234718
이다. 따라서
489186142
가 마지막 섹터 위치가 되어야 한다.
하지만 성능 최적화를 위해 파티션 정렬 (Partition alignment)을 고려해야 한다. 스왑 파티션 (Swap partition)의 시작 섹터 위치가 정렬되어야 한다. 여기서 1MByte를 정렬 크기로 정했을 때, 2048Sector(1MByte/512Byte
)의 배수로 정해야 한다.
스왑 파티션 (Swap partition)이 될, 세 번째 파티션의 시작 섹터는 두 번째 파티션의 마지막 섹터여 +1
하면 된다.
스왑 파티션 (Swap partition)은 512MByte 보다 커야 하기 때문에 863Sector
를 빼면 된다.
아래와 같은 결과가 도출된다.
- 두 번째 파티션의 마지막 섹터: 489185280 - 1 = 489185279
- 세 번째 파티션의 시작 섹터: 489185280
- 세 번째 파티션의 마지막 섹터: 490234718
- 세 번째 파티션의 크기: 512MByte + 863Sector = (51210241024)Byte + (863*512)Byte = 536870912Byte + 441856Byte = 537312768
Command (m for help): n
Partition number (2-128, default 2): 2
First sector (1050624-490234718, default 1050624): 1050624
Last sector, +sectors or +size{K,M,G,T,P} (1050624-490234718, default 490234718): 489185279
Created a new partition 2 of type 'Linux filesystem' and of size 232.8 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
Command (m for help): t
Partition number (1,2, default 2): 2
Partition type (type L to list all types): 24
Changed type of partition 'Linux filesystem' to 'Linux root (x86-64)'.
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8C8A1B68-71C1-AE46-9161-8884F72BE345
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 489185279 488134656 232.8G Linux root (x86-64)
Filesystem/RAID signature on partition 1 will be wiped.
Filesystem/RAID signature on partition 2 will be wiped.
세 번째 파티션을 생성한다
Command (m for help): n
Partition number (3-128, default 3):
First sector (489185280-490234718, default 489185280): 489185280
Last sector, +sectors or +size{K,M,G,T,P} (489185280-490234718, default 490234718): 490234718
Created a new partition 3 of type 'Linux filesystem' and of size 512.4 MiB.
Command (m for help): t
Partition number (1-3, default 3): 3
Partition type (type L to list all types): 19
Changed type of partition 'Linux filesystem' to 'Linux swap'.
Command (m for help): p
Disk /dev/sda: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8C8A1B68-71C1-AE46-9161-8884F72BE345
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 489185279 488134656 232.8G Linux root (x86-64)
/dev/sda3 489185280 490234718 1049439 512.4M Linux swap
Filesystem/RAID signature on partition 1 will be wiped.
Filesystem/RAID signature on partition 2 will be wiped.