Creating Filesystems
100%

The Filesystem · Lesson 5

Creating Filesystems

Learn how to verify a block-device target and create a filesystem with format-specific tools.

Creating a filesystem writes new allocation and metadata structures to a block device. It is a destructive initialization step, not merely a label change. Use only disposable storage for practice and maintain a tested backup before formatting a device that ever held valuable data.

Understanding `mkfs`

mkfs is commonly a front end that dispatches to a filesystem-specific program such as mkfs.ext4, mkfs.xfs, or mkfs.btrfs. A generic command has this form:

$ sudo mkfs -t ext4 /dev/VERIFIED-PARTITION

The placeholder must be replaced only after verification. Equivalent format-specific syntax is commonly:

$ sudo mkfs.ext4 /dev/VERIFIED-PARTITION

Supported options, defaults, feature sets, and overwrite prompts differ between implementations. Read the local manual for the exact formatter rather than assuming all mkfs back ends behave alike.

What does mkfs -t ext4 TARGET request?

Verify Every Storage Layer

Before formatting, identify the target by model, serial, size, topology, persistent link, and intended role:

$ lsblk -o NAME,PATH,TYPE,SIZE,MODEL,SERIAL,FSTYPE,UUID,MOUNTPOINTS
$ findmnt --real
$ sudo wipefs --no-act /dev/VERIFIED-PARTITION

wipefs --no-act reports recognized signatures without erasing them. Also check swap, LVM, RAID, encryption, virtual-machine, container, and application use. A device can be active even when MOUNTPOINTS is empty.

Unmount or deactivate every relevant layer through its own tool. Recheck identity immediately before the formatter because enumeration names can change.

What does wipefs --no-act TARGET provide in this workflow?

Select the Filesystem Deliberately

Choose a type supported by the distribution, boot environment, backup tooling, repair tooling, and workload. Consider required limits, snapshots, checksums, quotas, encryption layering, growth or shrink behavior, and cross-platform access.

Do not select a format solely because it is popular. For example, ext4, XFS, and Btrfs have different operational features and recovery procedures. A removable interoperability device may require another format with different Unix permission semantics.

Which is a sound basis for selecting a filesystem type?

Labels, UUIDs, and Verification

Formatters normally generate a filesystem UUID and can often set a human-readable label. Use labels that are unique enough for the environment, and ensure cloned filesystems do not retain conflicting identifiers when mounted together.

After successful creation, inspect without mounting:

$ lsblk -f /dev/VERIFIED-PARTITION
$ sudo blkid /dev/VERIFIED-PARTITION

Record the UUID for later mount configuration. Creating a filesystem does not mount it, create application directories, populate backups, or make it persistent across boot.

What remains a separate step after a filesystem is created?

Lesson complete

You finished Creating Filesystems

You can now describe filesystem creation as a verified destructive operation.

  • Treat mkfs as a dispatcher to format-specific tooling.

  • Verify persistent identity, signatures, and every active consumer.

  • Select a filesystem using support and recovery requirements.

  • Inspect generated type, label, and UUID before mounting.

Keep your learning progress

Create a free account to save this lesson and continue learning on any device.

Create a free account
Next Lesson
Back to The Filesystem