What Is Ubuntu Format Disk Command Line? How to Use It [Your 2023 Fresh Guide]

Updated by Daisy on Nov 29, 2022
Written by Tracy King
  | Computer Instruction

Ubuntu is a Debian-based Linux distribution. It is appropriate for internet of things (IoT) gadgets, servers, workstations, and cloud computing. The primary distinction between Ubuntu and Linux is that the latter is a Linux distribution, whereas Linux is a family of operating systems built on Unix.

ubuntu disk format command line

The Ubuntu format disk command line can read and write files on partitions using Windows formatting. These partitions are often formatted with NTFS, but FAT32 can also be used occasionally. On other devices, FAT16 will also be shown. 

You can format your drives using the Disks program that is bundled with Ubuntu. GParted can be used to format if the Disks tool is giving you issues or if your partition is corrupted. Additionally, GParted allows you to resize existing partitions, which enables you to use the free space on your drive to create a second partition. Let's read why we need the ubuntu format disk command line.

Why You Might Need Ubuntu Format Disk Command Line

To carry out various activities on the OS, Ubuntu provides both the Command Line Interface (CLI) and Graphical User Interface (GUI). CLI is the fundamental method for interacting with the processor and memory of a system; it allows you to carry out all of the operations that a GUI can. 

One of the most typical hardware operations is formatting a hard drive. If you add a new drive or partition to your Linux system, the drive must be formatted. Ubuntu Linux makes it simple with the GParted program, a graphical partition, and a format manager. Anyone may format a disc for usage in Linux, Windows, or both using GParted's simple interface.

In most cases, Ubuntu correctly recognizes your hard discs and "mounts" them so that you may access them from the file manager. Additionally, it typically recognizes and mounts any additional USB-connected devices you could plug in, such as a flash drive, a digital camera, an audio player, and an external hard drive.

There are, however, hiccups that arise from time to time that must resolve. To fix the issue, you'll need to open a command-line terminal and enter commands, potentially with the help of knowledgeable folks on the Ubuntu forums. 

Ubuntu can read and write files on partitions using Windows formatting. These partitions are often formatted with NTFS, but FAT32 can also be used occasionally. You can format your USB drive using a number of the programs included with Ubuntu Linux, and you can use the Terminal or the Disk Utility included with Ubuntu. In either scenario, formatting your USB device takes a few minutes.

Ubuntu uses ZFS as its default file system when handling containers. Additionally, it contains the sophisticated Raid-Z feature, which is better for recovering from a disc failure and more reliably distributes data. On ZFS, Ext4, BtrFS, or Reiser, this capability is not available.

How Do I Format a Drive with Ubuntu Format Disk Command Line

Fitting a USB device is relatively simple via the command line. Using the commands listed here, anyone may format a USB disc.

1. To prevent accidentally formatting another device, the USB drive must be accurately identified. Use Dash or the Ctrl+Alt+T keyboard shortcut to launch the Terminal application, then enter the following command:

df -h

output line

Our USB drive is identified as /dev/sdb1 in the output's final line.

2. To format the USB using the VFAT file system, use the following command:

sudo mkfs.vfat /dev/sdb1

You will use the location indicated by the df -h command's output.

3. Only unmounted USB drives can be formatted; otherwise, the following message will appear:


Because of this, kindly unmount the drive using the following command:

sudo umount /dev/sdb1

Your USB device will be correctly formatted when you execute the formatting command as a root user.


In this article, the Ubuntu format disk command line has been explained. You can format your drives using the Ubuntu-bundled Disks application. If you're having trouble using the Disks tool or your partition is damaged, you can format using GParted. If you like the post, share it and if you have any queries, comment below. 


If you still have some doubts, you can read the following answers to the questions. 

1. How do I format a Drive in Ubuntu?

  • Gather details about your new hard disc.
  • Partition Editor, commonly referred to as "GNOME Partition Editor," can be found by clicking "System," selecting "Administration," and like.
  • The disk's settings should be checked.
  • Based on the usage you anticipate, choose the drive format.
  • Press "Apply."

2. Can you format a disk from CMD in Ubuntu?

Windows has a tool called Diskpart that can be used from the command line to format a disc. Windows has a built-in tool called Diskpart.

3. What is the best Format for a disk in Ubuntu?

FAT32 is frequently advised for sharing between Ubuntu and Windows. However, NTFS also performs admirably.

Was This Page Helpful?


NEW Released


Get It

EaseUS Data Recovery Services

Request a free evaluation >>

EaseUS data recovery experts have uneaqualed expertise to repair disks/systems and salvage data from all devices like RAID, HDD, SSD, USB, etc.