fdisk コマンド:MBR パーティションの作成と削除、fdisk -l での確認方法
fdisk コマンドは、ディスクのパーティションテーブルを確認し、パーティションを作成したり削除したりする Linux のコマンドです。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 を入力するとタイプ番号の一覧がすべて表示されます。Linux サーバーでよく使う番号とエイリアスは下のとおりで、エイリアスは [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 · ディスク
Linux blkid コマンド | UUID と GUID の違い
ブロックデバイスのファイルシステムの種類と UUID を出力する blkid の使い方と、UUID と GUID の違いです。
Linux · ディスク
Linux dd コマンド
ディスクやパーティションをコピーしたり、イメージファイルを作成したりする dd コマンドの使い方です。
ℹ️ 提携について
当サイトのコンテンツにはアフィリエイトリンクが含まれています。訪問者がこのリンクを通じて商品やサービスを購入すると、当サイトは販売元から手数料を受け取ります。この過程において、購入者が支払う金額(イベント割引適用で金額が下がります↓)は上昇しません。掲載されている価格・割引・在庫情報は作成時点のものであり、実際とは異なる場合がありますので、ご購入前に販売元にて最終確認をお願いいたします。商品の選定および評価は独自の基準に基づいて行われており、手数料の支払いの有無は紹介順や評価内容に影響を与えません。