Create or edit the GPT partition table on /dev/sdb interactively.
Use a GPT-aware fdisk-style tool.
Which command is appropriate?
gdisk DEVICE is an interactive partition editor for GPT. Changes are not committed to disk until explicitly written.
Detailed explanation
mkfs.gpt /dev/sdbIncorrect. There is no general mkfs.gpt filesystem command for this task.
Incorrect. There is no general mkfs.gpt filesystem command for this task.
gdisk /dev/sdbCorrect. gdisk /dev/sdb opens the GPT partition editor.
Correct. gdisk /dev/sdb opens the GPT partition editor.
mkswap /dev/sdbIncorrect. mkswap initializes swap space.
Incorrect. mkswap initializes swap space.
mkfs.ext4 /dev/sdbIncorrect. mkfs.ext4 creates an ext4 filesystem, not a partition table.
Incorrect. mkfs.ext4 creates an ext4 filesystem, not a partition table.
Try it yourself
An example you can run in a temporary verification environment.
gdisk -l /dev/sdbExpected result
対象デバイスのGPT情報。存在する検証用デバイスだけで実行するKey points
- gdisk handles GPT
- It is interactive
- Review before writing
Notes
- Environment: GPT fdisk 1.0.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.