What formatting a drive means and why you'd do it
Formatting a drive in Linux means erasing everything on it and preparing it to store new data. The operating system writes a file system — a structure that organizes how files are stored and found — onto the blank drive. After formatting, the drive is ready to use but empty.
You format a drive when you want to reuse an old one, when you're setting up a new external drive, or when you're preparing a drive to dual-boot Linux alongside another operating system. Formatting destroys all existing data, so you should back up anything you want to keep before you start.
Key Takeaways
- Identify your drive using lsblk or fdisk -l before you format anything, because formatting the wrong drive will destroy data you need.
- The most common file systems for Linux are ext4 (for internal drives) and exFAT (for external drives you might share with Windows or Mac).
- You can format a drive using the graphical tool Disks (built into most Linux desktops) or the command line with mkfs commands.
- Formatting takes seconds to minutes depending on drive size, but you should not unplug the drive or shut down your computer while it is running.
Identify your drive before you do anything
The most dangerous step in formatting is choosing the right drive. If you format the wrong one, you will lose data permanently. Open a terminal and run lsblk to see all connected drives and their sizes. The output shows device names like /dev/sda, /dev/sdb, and /dev/nvme0n1, along with how much space each one holds.
Match the size shown in lsblk to the drive you actually want to format. If you are formatting an external drive, unplug everything except that drive first, then run lsblk again to see what new device appears. This removes any chance of formatting your main system drive by mistake.
Write down the device name — for example, /dev/sdb — before you move forward. You will need it in the next steps.
Choose a file system for your drive
A file system is the format that organizes data on the drive. Different file systems work better for different purposes. ext4 is the standard for Linux internal drives and external drives you will use only with Linux. It handles large files well and is reliable for long-term storage.
exFAT is better if you plan to use the drive with Windows or Mac computers as well as Linux. It is not as robust as ext4 for Linux-only use, but it works across operating systems without extra software. NTFS (Windows format) also works in Linux, though it is less common for new drives.
For most people formatting an external drive: use exFAT if you share it with other computers, and ext4 if it stays with Linux. For an internal drive in a Linux system: use ext4.
Format using the Disks graphical tool
Most Linux desktops include a built-in tool called Disks (sometimes called GNOME Disks or Disk Utility). Open it from your applications menu. The left panel shows all connected drives. Click the drive you identified earlier — double-check the size to make sure it is the right one.
Click the menu button (three horizontal lines) in the top right, then select "Format Disk". A dialog box appears asking what file system you want. Choose ext4 for Linux-only use or exFAT for cross-platform use. You can also give the drive a name (called a label) that will appear when you plug it in.
Click "Start Formatting". The tool will warn you that all data will be erased. Confirm, and the format will complete in seconds to a few minutes depending on drive size. When it finishes, the drive is ready to use.
Format using the command line with mkfs
If you prefer the terminal or Disks is not available, you can format using the mkfs command. First, unmount the drive if it is currently mounted by running sudo umount /dev/sdX, replacing sdX with your actual device name (for example, sdb).
To format as ext4, run sudo mkfs.ext4 /dev/sdX. To format as exFAT, run sudo mkfs.exfat /dev/sdX. The system will ask you to confirm by typing "yes". The format will complete in seconds to a few minutes.
After formatting, you can mount the drive again by running sudo mount /dev/sdX /mnt or by unplugging and replugging it. The drive will appear in your file manager ready to use.
What to do if formatting fails or gets stuck
If the format hangs or appears frozen, do not force-shut down your computer. Wait at least five minutes — large drives can take longer than expected. If it is genuinely stuck, press Ctrl+C in the terminal to cancel the command, then try again.
If you get a "device is busy" error, the drive is still mounted. Run sudo umount /dev/sdX and try formatting again. If you get a "permission denied" error, make sure you included sudo at the start of the command.
If the drive does not appear in lsblk at all, it may not be recognized by your system. Try a different USB cable or port. If it still does not show up, the drive itself may be failing.
Frequently Asked Questions
Can I format just part of a drive instead of the whole thing?
Yes, but it requires partitioning, which is more complex than a full format. Most people format the entire drive. If you need multiple partitions, use the Disks tool and look for the partition options, or use fdisk or parted from the command line.
What happens if I format the wrong drive?
All data on that drive is permanently erased. This is why identifying the drive by size before you start is critical. If you realize when ready after formatting, some data recovery tools may help, but recovery is not may provide and can be expensive.
Do I need to format a new external drive before using it?
New drives usually come pre-formatted, so you can use them right away. You only need to reformat if you want to change the file system (for example, from NTFS to exFAT) or if you want to erase old data and start fresh.
How long does formatting take?
Most drives format in seconds to a few minutes. Very large drives (multiple terabytes) may take longer. Do not unplug the drive or shut down your computer while formatting is in progress.
