Linux Administration
medium

Pregunta de Linux Administration #019e3987

Enunciado de la Pregunta
Linux Administration
#mkfs
#ext2
#default-filesystem
#filesystem-creation
Medio

Which type of filesystem is created by mkfs when it is executed with the block device name only and without any additional parameters?

A

ext2

Correcto
B

ext3

C

ext4

D

XFS

E

VFAT

Explicación Oficial / Explicaciones de la Comunidad

When mkfs is executed with only a block device name and no additional parameters, it creates an ext2 filesystem by default. This is because mkfs is a front-end that calls the appropriate filesystem-specific tool (e.g., mkfs.ext2, mkfs.ext3, mkfs.ext4, mkfs.xfs, mkfs.vfat) based on the -t option or the default. Without the -t option, the default filesystem type is ext2. This behavior is defined in the source code and documentation of mkfs.

How it Works

The mkfs command (short for "make filesystem") is a wrapper that invokes the correct filesystem builder. If no -t option is given, it defaults to ext2. This is a historical choice, as ext2 was the first widely used Linux filesystem. Modern systems often have mkfs aliased or symlinked to mkfs.ext4 in some distributions, but the standalone mkfs command without arguments still defaults to ext2.

Why the Correct Value is Right

The correct answer is ext2 because mkfs without any parameters creates an ext2 filesystem. This can be verified by running mkfs /dev/sdX and then using blkid or file -s /dev/sdX to see the filesystem type.

Why the Incorrect Values are Wrong

  • ext3: This is a journaling extension of ext2. To create an ext3 filesystem, you must explicitly use mkfs.ext3 or mkfs -t ext3. The default mkfs does not create ext3.
  • ext4: This is the successor to ext3 with larger filesystem support. It requires mkfs.ext4 or mkfs -t ext4.
  • XFS: This is a high-performance journaling filesystem. It requires mkfs.xfs or mkfs -t xfs.
  • VFAT: This is the FAT32 filesystem used for compatibility. It requires mkfs.vfat or mkfs -t vfat.