Inspect partition numbers, start/end sectors, and type codes on GPT disk /dev/sdb.
Do not modify the partition table.
Which command is appropriate?
gdisk -l DEVICE displays GPT information and the partition list without entering an editing session.
Detailed explanation
gdisk -l /dev/sdbCorrect. gdisk -l /dev/sdb lists the GPT partition table read-only.
mkfs.ext4 /dev/sdbIncorrect. mkfs creates a filesystem and can destroy existing data.
mount /dev/sdb /mntIncorrect. mount attaches a filesystem and does not inspect GPT layout.
pvcreate /dev/sdbIncorrect. pvcreate initializes an LVM physical volume and changes state.
Try it yourself
An example you can run in a temporary verification environment.
gdisk -? 2>&1 | sed -n '1,12p'Expected result
-lでパーティションテーブルを一覧表示する旨を含むヘルプKey points
- gdisk handles GPT
- -l lists information
- Confirm the disk before any write operation
Notes
- Environment: GPT fdisk 1.x / ヘルプ表示のみ
- Use read-only inspection or a disposable disk when learning storage commands.
- Partition and LVM writes can destroy data; verify the target before running them.
Foundation review
Place the operation
Partition-table inspection is separate from filesystem creation, mounting, and PV initialization.
Check the side effect
Verify the device name and existing data before any command that writes metadata.