Create ext4 on the empty logical volume /dev/vgdata/lvdocs.
The target device has been verified.
Which command is appropriate?
mkfs.ext4 DEVICE creates ext4 metadata on the block device. It can overwrite existing content, so confirm the target and backups first.
Detailed explanation
mkfs.ext4 /dev/vgdata/lvdocsCorrect. mkfs.ext4 /dev/vgdata/lvdocs creates the filesystem.
mount /dev/vgdata/lvdocs /srv/docsIncorrect. mount attaches an existing filesystem and does not create ext4.
fsck.ext4 /dev/vgdata/lvdocsIncorrect. fsck.ext4 checks an existing filesystem.
mkswap /dev/vgdata/lvdocsIncorrect. mkswap creates swap metadata, not ext4.
Try it yourself
An example you can run in a temporary verification environment.
mkfs.ext4 -V 2>&1 | sed -n '1,3p'Expected result
mke2fsまたはext2fsライブラリのバージョンKey points
- mkfs.ext4 creates
- mount only attaches
- Existing data can be destroyed
Notes
- Environment: e2fsprogs 1.47 / バージョン表示のみ
- Prefer help or version output and a disposable device when testing storage commands.
- Formatting, repair, and mount changes can affect data or availability.
Foundation review
Place the operation
Creation, mounting, checking, and swap initialization are different operations.
Check the side effect
Confirm the target device before any command that writes a new filesystem.