How to Format Disk Partitions in Linux

April 21, 2026 / Tutorial

Formatting a disk partition in Linux is a common task when setting up a new drive, reinstalling an operating system, or preparing storage for specific use cases. It removes existing data from the partition and prepares it with a file system so it can be used efficiently.

This guide explains how to identify, prepare safely, and format disk partitions using commonly used Linux file systems.

Prerequisites

Before formatting a disk partition, ensure you have the following:

  • Root or sudo access to the Linux system
  • Basic understanding of Linux terminal commands
  • Correct identification of the disk to avoid data loss
  • Backup of important data from the partition (formatting erases everything)

It is very important to double-check the disk name before proceeding, as selecting the wrong partition can lead to permanent data loss.

Checking the Partitions

Before formatting, you must identify available disk partitions in your system.

You can list all connected disks and partitions using commands like:

  • lsblk – Displays block devices in a tree format
  • fdisk -l – Shows detailed information about all disks and partitions

These commands help you understand which disk is which, along with its size, mount point, and partition structure. Once identified, note down the correct partition name (for example, /dev/sdb1).

Formatting Disk Partition in Linux

To format a partition, Linux provides multiple tools depending on the file system you want to use. The most commonly used command is mkfs (make file system).

General syntax:

mkfs.[filesystem] /dev/partition_name

For example, to format a partition:

mkfs.ext4 /dev/sdb1

This command will erase all existing data and create a fresh file system on the selected partition.

Formatting Disk Partition with ext4 File System

The ext4 file system is one of the most widely used file systems in Linux due to its stability and performance.

To format a partition with ext4:

mkfs.ext4 /dev/sdb1

Why use ext4?

  • Highly stable and reliable for Linux systems
  • Supports large file sizes and partitions
  • Offers better performance compared to older file systems

After formatting, the partition can be mounted and used for storing Linux data, applications, or system files.

Formatting Disk Partition with FAT32 File System

The FAT32 file system is commonly used for external storage devices like USB drives and shared storage between different operating systems.

To format a partition with FAT32:

mkfs.vfat -F 32 /dev/sdb1

Key points about FAT32:

  • Compatible with Windows, Linux, and macOS
  • Best for removable storage devices
  • Has a file size limit (maximum 4GB per file)

FAT32 is ideal when you need cross-platform compatibility.

Formatting Disk Partition with NTFS File System

The NTFS file system is widely used in Windows environments, but is also supported in Linux.

To format a partition with NTFS:

mkfs.ntfs /dev/sdb1

Why use NTFS?

  • Supports large files and storage volumes
  • Commonly used in Windows systems
  • Good choice for dual-boot or shared environments

To use NTFS in Linux, you may need to install additional utilities like ntfs-3g.

Conclusion

Formatting disk partitions in Linux is a straightforward process when done carefully. By correctly identifying your disk and choosing the appropriate file system, ext4 for Linux, FAT32 for compatibility, or NTFS for Windows integration, you can efficiently prepare storage for different needs.

Always ensure you have backups and double-check the partition before formatting, as the process permanently removes all existing data.

Explore Linux Hosting solutions to efficiently manage servers, improve performance, and ensure secure, reliable hosting for all your applications.