0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux][command] パーティション作成_fdisk, gdisk, parted, MBR, GPT

Last updated at Posted at 2025-02-02

パーティションとは

  • HDD(またはSSD)は「パーティション」と呼ばれる論理的な空間に分割して利用する
  • ディスク全体をひとつの領域とする場合にも、全容量を割り当てたひとつのパーティションを作る必要がある

パーティション管理とは

  • ハードディスク全体のパーティションの情報をパーティションテーブルと呼ぶ
  • パーティションテーブルの管理方式は従来のMBR(Master Boot Record)と新しいGPT(GUID Partition Table)の2種類がある

MBRの特徴

  • 基本パーティション:4個
  • 容量:2.2TB
  • パーティション操作:fdiskコマンド、partedコマンド
  • 起動用システムファームウェア:BIOS
  • ブートローダー:GRUB Legacy, GRUB 2

GPTの特徴

  • 基本パーティション:128個
  • 容量:9.4ZB(9.4x1000x1000x1000TB)
  • パーティション操作:gdiskコマンド、partedコマンド
  • 起動用システムファームウェア:UEFI
  • ブートローダー:GRUB Legacy, GRUB 2

fdisk/gdiskコマンド

$ fdisk/gdisk デバイス名

or

デバイスのパーティションテーブルを確認する
$ fdisk/gdisk -l デバイス名
$ Command (m for help): l
// 使用可能なパーティションタイプの一覧を表示

$ Command (m for help): n
// 新しいパーティションを作成
サブコマンド 英語の由来 説明
なし コマンドプロンプトを表示し、対話的な操作を開始
m menu (help) ヘルプメニューを表示
l list partition types 使用可能なパーティションタイプの一覧を表示
n new partition 新しいパーティションを作成
d delete partition 既存のパーティションを削除
p print partition table 現在のパーティションテーブルを表示
t type パーティションのタイプを変更
w write changes 変更を保存してに終了
q quit 変更を保存せずに終了

partedコマンド

$ parted デバイス名

または

$ parted デバイス名 [-s サブコマンド]
サブコマンド 英語の由来 説明
なし コマンドプロンプトを表示し、対話的な操作を開始
help help 使用可能なコマンドの一覧を表示します。
print
P
print partition table パーティションテーブルを表示します。
mklabel make label 新しいディスクラベルを作成します(例:gptmsdos)。
mkpart make partition 新しいパーティションを作成します。
rm remove partition 既存のパーティションを削除します。
resizepart resize partition 既存のパーティションをリサイズします。
quit
q
quit 対話モードを終了します。

Ping-t

fdisk

parted

その他

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?