Linux · Flashcard

Which command creates an ext4 filesystem on a partition?

  • A`mkfs.ext4 /dev/sda1`, which builds new inode tables and superblocks
  • B`badblocks /dev/sda1`, which scans the media for unreadable sectors
  • C`e2label /dev/sda1 data`, which only renames an existing filesystem
  • D`mkswap /dev/sda1`, which prepares the partition as swap space

Why this is the answer

mkfs.ext4 (or mkfs -t ext4) lays down fresh metadata and destroys whatever was there — the reason it warns when the device is mounted. badblocks tests the media underneath, e2label only renames a filesystem that already exists, and mkswap does initialise the partition, but as swap rather than as a mountable filesystem.

Official docs
Study in Gnoseed →