Inspect the partition table, start positions, sizes, and types on /dev/sdb.
Display the list only; do not enter an interactive editor.
Which command is appropriate?
fdisk -l DEVICE reads and lists the partition table. It is distinct from commands that write a new table or filesystem.
Detailed explanation
fdisk -l /dev/sdbCorrect. fdisk -l /dev/sdb lists the device's partition table.
Correct. fdisk -l /dev/sdb lists the device's partition table.
mkfs /dev/sdbIncorrect. mkfs creates a filesystem and can overwrite data.
Incorrect. mkfs creates a filesystem and can overwrite data.
mkswap /dev/sdbIncorrect. mkswap initializes swap metadata.
Incorrect. mkswap initializes swap metadata.
parted /dev/sdb mklabel gptIncorrect. parted mklabel writes a new disk label.
Incorrect. parted mklabel writes a new disk label.
Try it yourself
An example you can run in a temporary verification environment.
fdisk -l /dev/sdbExpected result
対象デバイスのラベル形式とパーティション一覧。存在する検証用デバイスだけで実行するKey points
- -l means list
- No changes are made
- Specify the whole device
Notes
- Environment: util-linux fdisk 2.39以降
- 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.