Initialize the empty test partition /dev/sdb1 as a conventional Linux ext4 filesystem.
Create a filesystem, not a partition table.
Which command is appropriate?
mkfs.ext4 DEVICE creates ext4 superblock and filesystem structures. It overwrites existing filesystem data, so confirm the device.
Detailed explanation
fdisk -t ext4 /dev/sdb1Incorrect. fdisk edits partition tables rather than creating ext4 filesystems.
Incorrect. fdisk edits partition tables rather than creating ext4 filesystems.
mkswap /dev/sdb1Incorrect. mkswap creates swap metadata.
Incorrect. mkswap creates swap metadata.
mkfs.xfs /dev/sdb1Incorrect. mkfs.xfs creates XFS instead of ext4.
Incorrect. mkfs.xfs creates XFS instead of ext4.
mkfs.ext4 /dev/sdb1Correct. mkfs.ext4 /dev/sdb1 initializes an ext4 filesystem.
Correct. mkfs.ext4 /dev/sdb1 initializes an ext4 filesystem.
Try it yourself
An example you can run in a temporary verification environment.
mkfs.ext4 -VExpected result
mke2fsのバージョン情報。ファイルシステム作成は行わないKey points
- mkfs.ext4 creates ext4
- Usually target a partition
- Existing data is overwritten
Notes
- Environment: e2fsprogs 1.47
- 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.