fdisk 명령어: MBR 파티션 생성과 삭제, fdisk -l 확인 방법

fdisk 명령어는 디스크의 파티션 표를 확인하고 파티션을 만들거나 지우는 리눅스 명령어입니다. 1 GiB 연습용 이미지 파일에 MBR 파티션 표를 만들어 주 파티션 둘과 확장 파티션, 그 안의 논리 파티션 둘을 나눈 뒤 w로 저장했고, fdisk -l로 다섯 개 파티션이 기록된 것을 확인했습니다.
아래 서버 디스크의 fdisk -l 출력은 디스크 이름과 크기, 모델, 식별자를 바꾼 예시 값이고, fdisk 첫 화면의 util-linux 2.37 뒤 패치 번호와 작업 폴더 /root/work도 예시 값입니다. 파티션을 만들고 지우고 저장하는 명령은 모두 truncate로 만든 연습용 이미지 파일에서 실행했습니다.
1️⃣ fdisk 명령어 기본 사용법과 fdisk -l 파티션 확인
fdisk는 두 가지 꼴로 실행합니다. -l을 붙이면 디스크와 파티션 목록만 출력하고 끝납니다. -l 없이 장치 이름을 주면 파티션을 고치는 대화형 화면이 열립니다.
인자 없이 fdisk -l을 실행하면 서버에 연결된 디스크를 모두 출력합니다.
fdisk -lDisk /dev/nvme0n1: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: Example Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 6F1C2A90-3B7E-4D52-9A1E-2C8B5D0F7E41
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 4095 2048 1M BIOS boot
/dev/nvme0n1p2 4096 413695 409600 200M EFI System
/dev/nvme0n1p3 413696 2510847 2097152 1G Linux filesystem
/dev/nvme0n1p4 2510848 83886046 81375199 38.8G Linux filesystem첫 줄은 디스크 이름과 전체 크기, 섹터 수이고, [Disklabel type] 줄이 파티션 표 형식입니다. 이 디스크는 [gpt]였고, MBR 파티션 표는 [dos]로 나옵니다. GPT 디스크는 gdisk 명령어로도 파티션을 나눌 수 있습니다. 이 글은 MBR(dos) 파티션 표를 기준으로 진행합니다.
파티션 목록의 칸마다 뜻은 아래 표와 같습니다. GPT 디스크의 목록에는 [Boot]와 [Id] 칸이 없었습니다.
| 칸 | 뜻 |
|---|---|
| Device | 파티션 장치 이름. 디스크 이름 뒤에 파티션 번호가 붙음(nvme 디스크는 p1처럼 p 뒤에 번호) |
| Boot | 부팅 플래그가 켜진 파티션에 * 표시. MBR(dos) 파티션 표에만 있는 칸 |
| Start · End | 파티션이 시작하고 끝나는 섹터 번호 |
| Sectors | 파티션의 섹터 수. 섹터 크기 512바이트를 곱하면 바이트 크기 |
| Size | 읽기 쉬운 단위로 바꾼 크기 |
| Id | 파티션 형식 번호(16진수). MBR(dos) 파티션 표에만 있는 칸 |
| Type | 파티션 형식 이름 |
연습용 이미지는 truncate로 1 GiB 크기의 빈 파일을 만든 것입니다. fdisk는 장치 이름 대신 파일 경로도 받으므로 실제 디스크를 건드리지 않고 같은 화면으로 연습할 수 있습니다.
truncate -s 1G /root/work/disk.imgfdisk -l /root/work/disk.imgDisk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes아직 파티션 표가 없는 파일이라 디스크 정보 네 줄만 나왔습니다.
🔲 fdisk 명령어 옵션
| 옵션 | 복사 | 설명 |
|---|---|---|
| -l, --list | 디스크와 파티션 목록만 출력하고 끝냄 | |
| -o, --outputlist | 칸 이름을 쉼표로 이어 적어 원하는 칸만 출력 |
| 옵션 | 복사 | 설명 |
|---|---|---|
| -b, --sector-sizesectorsize | 디스크의 섹터 크기를 지정. 값은 512, 1024, 2048, 4096 | |
| -B, --protect-boot | 새 파티션 표를 만들 때 디스크 첫 섹터의 앞부분을 지우지 않음. GPT와 MBR에서 지원 | |
| -c, --compatibility[=mode] | 호환 모드를 dos 또는 nondos로 지정. 기본값은 nondos | |
| -h, --help | 도움말을 출력하고 종료 | |
| -L, --color[=when] | 출력에 색을 넣음. when은 auto, never, always | |
| -x, --list-details | --list와 같지만 더 자세한 정보를 출력 | |
| --lock[=mode] | 장치나 파일에 배타적 BSD 잠금을 사용. mode는 yes, no, nonblock | |
| -n, --noauto-pt | 빈 장치에 기본 파티션 표를 자동으로 만들지 않음 | |
| -s, --getsz | 블록 장치의 크기를 512바이트 섹터 수로 출력. 사용 중단(blockdev 권장) | |
| -t, --typetype | 지정한 형식의 파티션 표만 지원하고 나머지 형식은 지원하지 않음 | |
| -u, --units[=unit] | 파티션 표를 출력할 때 크기를 sectors 또는 cylinders 단위로 표시. 기본값은 sectors | |
| -C, --cylindersnumber | 디스크의 실린더 수를 지정 | |
| -H, --headsnumber | 디스크의 헤드 수를 지정. 물리 헤드 수와 별개로 파티션 표에 쓰는 값이며 255나 16이 적당 | |
| -S, --sectorsnumber | 트랙당 섹터 수를 지정. 적당한 값은 63 | |
| -w, --wipewhen | 장치에서 파일 시스템, RAID, 파티션 표 서명을 지움. when은 auto, never, always | |
| -W, --wipe-partitionswhen | 새로 만든 파티션에서 파일 시스템, RAID, 파티션 표 서명을 지움. when은 auto, never, always | |
| -V, --version | 버전 정보를 출력하고 종료 |
2️⃣ fdisk 파티션 생성과 논리 파티션
파티션을 만들려면 -l 없이 경로만 주고 대화형 화면을 엽니다.
fdisk /root/work/disk.imgWelcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf638ab13.파티션 표가 없는 파일이라 fdisk가 새 DOS(MBR) 파티션 표를 메모리에 만들었습니다. 안내 문구대로 여기서 바꾼 내용은 w로 저장하기 전까지 디스크에 기록되지 않습니다.
[Command (m for help):] 물음에 글자 하나를 입력해 작업을 고릅니다. m을 입력하면 명령 목록이 나옵니다.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
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
u change display/entry units
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이 글에서 사용한 명령은 아래 표와 같습니다.
| 명령 | 하는 일 |
|---|---|
| m | 명령 목록 출력 |
| p | 지금 파티션 표 출력 |
| n | 새 파티션 만들기 |
| d | 파티션 지우기 |
| t | 파티션 형식 번호 바꾸기 |
| a | 부팅 플래그 켜기·끄기 |
| l | 형식 번호 목록 출력 |
| F | 파티션이 없는 빈 공간 출력 |
| o | 빈 DOS(MBR) 파티션 표를 새로 만들기 |
| w | 바꾼 내용을 디스크에 기록하고 끝내기 |
| q | 바꾼 내용을 버리고 끝내기 |
n으로 첫 파티션을 만들었습니다. 주 파티션(p)과 번호 1을 고르고, 첫 섹터는 Enter로 기본값을 받은 뒤 마지막 섹터 자리에 +300M을 넣어 300 MiB로 정했습니다.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-2097151, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151, default 2097151): +300M
Created a new partition 1 of type 'Linux' and of size 300 MiB.첫 섹터 기본값 2048은 1 MiB(2048 × 512바이트) 위치입니다. fdisk 매뉴얼은 기본값과 +300M 같은 크기 지정 값이 장치 특성에 맞춰 정렬되므로 기본값을 따르기를 권합니다.
같은 방법으로 200 MiB짜리 주 파티션 2를 만들고, 남은 공간 전체는 확장 파티션 3으로 잡았습니다. 마지막 섹터를 Enter로 넘기면 남은 공간 끝까지 사용합니다.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (616448-2097151, default 616448):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (616448-2097151, default 2097151): +200M
Created a new partition 2 of type 'Linux' and of size 200 MiB.Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (3,4, default 3): 3
First sector (1026048-2097151, default 1026048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-2097151, default 2097151):
Created a new partition 3 of type 'Extended' and of size 523 MiB.MBR 파티션 표에는 주 파티션을 네 개까지만 기록할 수 있습니다. 그보다 많이 나누려면 한 자리를 확장 파티션으로 만들고 그 안에 논리 파티션을 만듭니다. 논리 파티션 번호는 5부터 시작합니다.
확장 파티션이 남은 공간을 모두 차지하고 있어, n을 입력하자 fdisk가 종류를 묻지 않고 논리 파티션 5를 바로 추가했습니다. 100 MiB짜리 5에 이어 남은 공간으로 6을 만들자, 빈 섹터가 없어 7은 만들어지지 않았습니다.
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (1028096-2097151, default 1028096):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1028096-2097151, default 2097151): +100M
Created a new partition 5 of type 'Linux' and of size 100 MiB.Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 6
First sector (1234944-2097151, default 1234944):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1234944-2097151, default 2097151):
Created a new partition 6 of type 'Linux' and of size 421 MiB.Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 7
No free sectors available.p로 나눈 결과를 확인했습니다. 확장 파티션 3(Id 5)은 논리 파티션 5와 6을 담는 구간이라 [Start]와 [End] 범위가 둘을 감쌉니다.
Command (m for help): p
Disk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 2048 616447 614400 300M 83 Linux
/root/work/disk.img2 616448 1026047 409600 200M 83 Linux
/root/work/disk.img3 1026048 2097151 1071104 523M 5 Extended
/root/work/disk.img5 1028096 1232895 204800 100M 83 Linux
/root/work/disk.img6 1234944 2097151 862208 421M 83 Linux확인한 뒤 w를 입력해 파티션 표를 이미지 파일에 기록했습니다.
Command (m for help): w
The partition table has been altered.
Syncing disks.[Syncing disks.]까지 나온 뒤 fdisk가 끝나고 셸 프롬프트로 돌아왔습니다.
3️⃣ fdisk w 저장과 q 취소
fdisk에서 바꾼 내용은 메모리에만 있다가 w를 입력하는 순간 디스크에 기록됩니다. w로 저장한 이미지를 fdisk -l로 다시 보자 다섯 개 파티션이 그대로 나왔습니다.
fdisk -l /root/work/disk.imgDisk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 2048 616447 614400 300M 83 Linux
/root/work/disk.img2 616448 1026047 409600 200M 83 Linux
/root/work/disk.img3 1026048 2097151 1071104 523M 5 Extended
/root/work/disk.img5 1028096 1232895 204800 100M 83 Linux
/root/work/disk.img6 1234944 2097151 862208 421M 83 Linuxq는 바꾼 내용을 버리고 끝냅니다. 파티션 2를 d로 지우고 p로 목록에서 빠진 것을 본 뒤 q로 끝냈습니다.
fdisk /root/work/disk.imgWelcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1-3,5,6, default 6): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 2048 616447 614400 300M 83 Linux
/root/work/disk.img3 1026048 2097151 1071104 523M 5 Extended
/root/work/disk.img5 1028096 1232895 204800 100M 83 Linux
/root/work/disk.img6 1234944 2097151 862208 421M 83 Linux
Command (m for help): qq로 끝낸 뒤 목록을 다시 보자 지웠던 파티션 2가 그대로 남아 있었습니다.
fdisk -l /root/work/disk.imgDisk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 2048 616447 614400 300M 83 Linux
/root/work/disk.img2 616448 1026047 409600 200M 83 Linux
/root/work/disk.img3 1026048 2097151 1071104 523M 5 Extended
/root/work/disk.img5 1028096 1232895 204800 100M 83 Linux
/root/work/disk.img6 1234944 2097151 862208 421M 83 Linux실제 디스크에서 w를 입력하면 그 디스크의 파티션 표가 바로 바뀝니다. 그래서 저장하기 전에 fdisk -l로 장치 이름과 크기를 한 번 더 확인합니다.
4️⃣ fdisk 파티션 타입 변경과 삭제
새 파티션은 형식 번호 83(Linux)으로 만들어집니다. 스왑이나 LVM으로 사용할 파티션은 t로 형식 번호를 바꿉니다. 파티션 2는 82로, 6은 8e로 바꿨습니다.
fdisk /root/work/disk.imgWelcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): t
Partition number (1-3,5,6, default 6): 2
Hex code or alias (type L to list all): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.Command (m for help): t
Partition number (1-3,5,6, default 6): 6
Hex code or alias (type L to list all): 8e
Changed type of partition 'Linux' to 'Linux LVM'.l을 입력하면 형식 번호 전체 목록이 나옵니다. 리눅스 서버에서 자주 사용하는 번호와 별칭은 아래와 같고, 별칭은 [Hex code or alias] 물음에 번호 대신 입력할 수 있습니다.
| 번호 | 형식 · 별칭 |
|---|---|
| 83 | Linux · 별칭 linux. 새 파티션의 기본 형식 |
| 82 | Linux swap / Solaris · 별칭 swap |
| 8e | Linux LVM · 별칭 lvm |
| 5 | Extended · 별칭 extended. 논리 파티션을 담는 확장 파티션 |
| fd | Linux raid autodetect · 별칭 raid |
| ef | EFI (FAT-12/16/32) · 별칭 uefi |
a는 파티션의 부팅 플래그를 켜고 끕니다. 1번에 켠 뒤 p로 보자 1번 [Boot] 칸에 *가 붙었고, 2번과 6번의 [Id]와 [Type]도 바뀌어 있었습니다. 이 결과는 w로 저장했습니다.
Command (m for help): a
Partition number (1-3,5,6, default 6): 1
The bootable flag on partition 1 is enabled now.Command (m for help): p
Disk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 * 2048 616447 614400 300M 83 Linux
/root/work/disk.img2 616448 1026047 409600 200M 82 Linux swap / Solaris
/root/work/disk.img3 1026048 2097151 1071104 523M 5 Extended
/root/work/disk.img5 1028096 1232895 204800 100M 83 Linux
/root/work/disk.img6 1234944 2097151 862208 421M 8e Linux LVM
Command (m for help): w
The partition table has been altered.
Syncing disks.d는 파티션을 지웁니다. 저장한 이미지를 fdisk로 다시 열어 없는 번호 9를 넣자 [Value out of range.] 문구가 나오고 번호를 다시 물었습니다. 확장 파티션 3을 지우자 안에 있던 논리 파티션 5와 6도 함께 사라졌습니다.
fdisk /root/work/disk.imgWelcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1-3,5,6, default 6): 9
Value out of range.
Partition number (1-3,5,6, default 6): 3
Partition 3 has been deleted.
Command (m for help): p
Disk /root/work/disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf638ab13
Device Boot Start End Sectors Size Id Type
/root/work/disk.img1 * 2048 616447 614400 300M 83 Linux
/root/work/disk.img2 616448 1026047 409600 200M 82 Linux swap / Solaris이 삭제는 p로 결과만 확인하고 q로 끝내 저장하지 않았습니다.
🔲 fdisk 명령어 시뮬레이터
아래 시뮬레이터에서 연습용 이미지 disk.img에 fdisk를 직접 입력할 수 있습니다. fdisk disk.img로 열어 n으로 파티션을 나누고, w로 저장한 뒤 fdisk -l disk.img로 결과를 확인합니다.
5️⃣ fdisk 명령어 실무 예시
🔲 fdisk 파티션 생성과 삭제 예시
새 디스크에 파티션을 나누는 순서대로 진행했습니다. truncate로 3 GiB 이미지 disk.img를 새로 만들어 사용했습니다. fdisk를 실행해 o로 빈 MBR 파티션 표를 만든 뒤 n으로 주 파티션 둘을 만들었고, 마지막 섹터 자리에 +1G와 +500M을 입력했습니다.
truncate -s 3G disk.imgfdisk disk.imgCommand (m for help): o
Created a new DOS disklabel with disk identifier 0x2dcf4156.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-6291455, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-6291455, default 6291455): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2099200-6291455, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-6291455, default 6291455): +500M
Created a new partition 2 of type 'Linux' and of size 500 MiB.w를 입력하기 전에 p로 목록을 보고, 1 GiB와 500 MiB 파티션이 입력한 크기대로 나온 것을 확인한 뒤 저장했습니다.
Command (m for help): p
Disk disk.img: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2dcf4156
Device Boot Start End Sectors Size Id Type
disk.img1 2048 2099199 2097152 1G 83 Linux
disk.img2 2099200 3123199 1024000 500M 83 Linux
Command (m for help): w
The partition table has been altered.
Syncing disks.삭제는 fdisk를 다시 실행해 d에 2를 입력하고, p로 1번 파티션만 남은 것을 확인한 뒤 w로 저장했습니다.
fdisk disk.imgCommand (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): p
Disk disk.img: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2dcf4156
Device Boot Start End Sectors Size Id Type
disk.img1 2048 2099199 2097152 1G 83 Linux
Command (m for help): w
The partition table has been altered.
Syncing disks.🔲 fdisk 사용 시 자주 하는 실수
처음 사용할 때 하기 쉬운 실수는 w 대신 q로 종료하는 경우입니다. n으로 500 MiB 파티션을 다시 추가하고 p 목록에서 2번 파티션까지 확인한 다음 q로 종료해 보니, fdisk -l에는 1번 파티션만 나왔습니다.
fdisk -l disk.imgDisk disk.img: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2dcf4156
Device Boot Start End Sectors Size Id Type
disk.img1 2048 2099199 2097152 1G 83 Linux다른 디스크를 지정하는 실수는 작업 전에 fdisk -l로 크기와 식별자를 먼저 확인해 방지할 수 있습니다. 2 GiB 파티션 하나를 만든 5 GiB 이미지 backup.img와 함께 출력해 보니, [Disk backup.img: 5 GiB] 줄과 [Disk identifier: 0xd201d03b] 줄로 disk.img와 구분할 수 있었습니다.
fdisk -l disk.img backup.imgDisk disk.img: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2dcf4156
Device Boot Start End Sectors Size Id Type
disk.img1 2048 2099199 2097152 1G 83 Linux
Disk backup.img: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd201d03b
Device Boot Start End Sectors Size Id Type
backup.img1 2048 4196351 4194304 2G 83 Linux🔲 fdisk -l 출력 변화 확인
o로 파티션 표를 만들고 w로 저장한 뒤에는 fdisk -l 출력에 [Disklabel type: dos] 줄과 [Disk identifier: 0x2dcf4156] 줄이 추가되었습니다. 식별자는 o를 입력했을 때 [Created a new DOS disklabel with disk identifier 0x2dcf4156.] 줄에 나온 값과 같았습니다.
이 목록에서는 1번 파티션의 [End] 2099199 바로 다음 섹터인 2099200에서 2번 파티션이 시작했습니다. 2번을 삭제한 뒤에는 목록이 disk.img1 한 줄로 줄었습니다.
n과 d, w, q 같은 명령은 fdisk 명령어 시뮬레이터에서 직접 입력해 볼 수 있습니다.
🔢 FAQ & 추천 콘텐츠
Linux · 디스크
스왑 메모리(Swap Memory) 설정: 파티션&파일 2가지 방식 | swapon, mkswap 명령어
디스크 공간을 메모리처럼 사용하는 스왑을 파티션과 파일 두 가지 방식으로 만들고 mkswap, swapon으로 활성화하는 방법입니다.
Linux · 디스크
리눅스 blkid 명령어 | UUID와 GUID 차이
블록 장치의 파일 시스템 유형과 UUID를 출력하는 blkid 사용법과 UUID, GUID의 차이입니다.
Linux · 디스크
리눅스 dd 명령어
디스크와 파티션을 복사하거나 이미지 파일을 만드는 dd 명령어 사용법입니다.
ℹ️ 제휴 안내
본 사이트의 콘텐츠에는 제휴 링크가 포함되어 있습니다. 방문자가 이 링크를 통해 상품 또는 서비스를 구매하면 본 사이트는 판매처로부터 수수료를 지급받습니다. 이 과정에서 구매자가 지불하는 금액(이벤트 할인 시 금액이 내려갑니다↓)은 오르지 않습니다. 게시된 가격·할인·재고 정보는 작성 시점 기준이며 실제와 다를 수 있으므로, 구매 전 판매처에서 최종 확인하시기 바랍니다. 상품 선정과 평가는 자체 기준에 따라 작성되며, 수수료 지급 여부가 소개 순서나 평가 내용에 영향을 주지 않습니다.