Create a new GPT disk label on the disposable test disk /dev/sdb.
Use GNU Parted non-interactively.
Which command is appropriate?
parted DEVICE mklabel gpt creates a new GPT disk label. It can destroy an existing table and data, so verify the target first.
Detailed explanation
parted /dev/sdb print gptIncorrect. print displays the current table and does not create a label.
Incorrect. print displays the current table and does not create a label.
parted /dev/sdb mkfs gptIncorrect. mkfs is for filesystems, not a Parted disk label operation.
Incorrect. mkfs is for filesystems, not a Parted disk label operation.
parted /dev/sdb mklabel gptCorrect. parted /dev/sdb mklabel gpt creates the new GPT label.
Correct. parted /dev/sdb mklabel gpt creates the new GPT label.
parted /dev/sdb mkswap gptIncorrect. mkswap initializes swap rather than a partition table.
Incorrect. mkswap initializes swap rather than a partition table.
Try it yourself
An example you can run in a temporary verification environment.
parted --help | grep -E 'mklabel|mktable'Expected result
パーティションテーブル作成コマンドの説明。デバイス変更は行わないKey points
- mklabel creates the disk label
- gpt is the label type
- Existing data may be destroyed
Notes
- Environment: GNU Parted 3.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.