Linux Commands Helper
💬 Your AI-powered Linux assistant
mkfs Command - Build a Linux Filesystem
The mkfs command is used to build a Linux filesystem on a device, usually a hard disk partition. It is a front-end to various filesystem-specific commands like mkfs.ext4, mkfs.xfs, etc.
Syntax
mkfs -t type [options] device
Examples
sudo mkfs.ext4 /dev/sdb1
Create an ext4 filesystem on /dev/sdb1.
sudo mkfs -t xfs /dev/sdc1
Create an XFS filesystem on /dev/sdc1.
Notes
- All data on the device will be lost when creating a new filesystem.
- Requires root privileges.
- Use
lsblk
orfdisk -l
to list available devices.