The best way to Format Storage Drives Utilizing the Linux Terminal

A storage device is an integral part of your computer hardware and your computer in general. Storage devices are used to store processed data in many different forms. The most common include external or internal hard drives, flash disks, CDs, etc.

This guide will show you how to format a storage device directly from the Linux terminal.

How to participate

When you format a storage device, you are essentially erasing any data or information stored on that device, rather than restoring it to the factory settings. Possible reasons for this include removing malware, improving performance, or removing sensitive data before giving the storage device to someone else.

note: Always use caution when formatting drives to avoid losing important information.

If you want to participate, the best way to practice is with a USB stick. Note that the steps are the same for other storage devices as well. Just make sure to backup your data before formatting the device.


Connect your USB stick to your PC. Most Linux desktops automatically mount your storage device as soon as you plug it into your computer.

If for some reason the device does not mount automatically, here's how to mount the drive in Linux.

Your USB flash drive will be listed in the file menu or on the desktop, depending on your desktop environment. Most Debian-based distributions like Ubuntu list the drive in the file menu.

Get the properties of your storage device

Before you can proceed with formatting your storage device, it is important that you can list and obtain the properties of the connected devices on your PC so that you can format the correct storage device.

Open the terminal from the application menu or from the shortcut Ctrl + Alt + T. In the terminal, run the following df command:

df -h

The command lists all of the storage devices available on your system. the -H Option lists the storage devices in a human readable format.

Most Linux distributions automatically mount external storage devices such as USB flash drives under the /Media/ Directory.

Here the storage device to be formatted is mounted in the directory / media / mwiza / CORSAIR, where CORSAIR is the label of the storage device.

Some other important properties are:

  • The physical mount address of the storage device, / dev / sda1 in this case.

  • The size of the drive, including the available free space and the amount used, both in percent and in gigabytes.

  • Last but not least, the directory in which the USB stick is mounted; / media / mwiza in this case.

Formatting your storage device

When your storage device is mounted on your system, Linux assumes that the drive is of a fixed size and format. For optimal formatting efficiency, it is important that you unmount your storage device first.

To unmount the storage device, you can do this ummount Command as below.

sudo umount / dev / sda1

note: In this case, / dev / sda1 is the physical address at which the storage device to be formatted is mounted. Make sure you have the correct mount point of your device on your system.

To format your storage device, use the mkfs (create filesystem) Command. The mkfs command creates a file system on a storage device according to the specified options.

sudo mkfs.vfat -n & # 39; MUO & # 39; -I / dev / sda1

The above command will format the specified drive using the FAT32 file format. You can also specify the new name or label for the USB flash drive. In this case it will MUO and the mount point of the physical address / dev / sda1. The FAT32 file system is compatible with all common operating systems.

Aside from the FAT32 file system, other file system formats that you can use to format your storage device are ext, Minix, MS-DOS, etc.

When formatting is complete, physically disconnect the storage device from your computer, and then reconnect it. The system will mount your newly formatted drive with the name you specified in the command.

You can also check the name of the storage device by typing the df -h Command.

Formatting an external drive on other operating systems

This guide examined how to use an external storage device on Linux with the. format mkfs Command. As with anything Linux-related, there are many other command-line tools for formatting storage devices. You can even use the GUI if you want.

If you're using a different operating system such as Windows, you have the option to graphically format your internal or external storage devices.

How to format a USB drive (and why you need to)

Formatting a USB drive is easy. Our guide explains the easiest and fastest ways to format a USB drive on a Windows computer.

Continue reading

About the author

Mwiza Kumwenda
(37 published articles)

Mwiza is a professional developer of software and writes extensively on Linux and front-end programming. Some of his interests include history, economics, politics, and enterprise architecture.

By Mwiza Kumwenda

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive deals!

Click here to subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *