• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Format Pendrive In Ubuntu Using Terminal

How To Format Pendrive In Ubuntu Using Terminal

By Sourabh / December 14, 2018 Category: How To, Ubuntu

How to format pendrive in Ubuntu using terminal? Commands to format pendrive in Linux Ubuntu command prompt. Unmount the USB drive before you begin to format it.

Find Device ID of USB Drive

Before you start formating the USB drive, you will need to know the device id of the USB drive. This drive id is used to format USB disk using terminal commands. To know the device id of the USB drive, run the command:

df -h

As you can see in the screenshot. The sdb3 is the device id of the USB drive.

format-usb-1

mkfs is a command used to format a block storage device with a specific filesystem. mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. The device argument is either the device name (e.g. /dev/hda1, /dev/sdb2), or a regular file that shall contain the filesystem. The size argument is the number of blocks to be used for the filesystem.

mkfs’s syntax is:

mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]

The items in square brackets are optional, and the only mandatory argument (i.e., input) is filesys. filesys is the name of a device file (i.e., a file that the system uses to implement access to a physical device), such as /dev/hda3.

Format USB Drive

Now unmount the USB device. Whenever any USB drive is attached to Ubuntu Linux system, it’s automatically mounted. While the USB device is mounted you cannot format it. So to format the USB drive, first unmount it using the following command:

sudo umount /dev/sdb3

Now format the USB drive. There are three filesystems options to format the USB drive.

Format USB with Extended File System (Ext) FileSystem

This is the most preferred filesystem from Linux Ubuntu Systems.

$ sudo mkfs.ext4 /dev/sdb3

Format USB with FAT (File Allocation Table) FileSystem


$ sudo mkfs.vfat /dev/sdb3

Format USB Format with NTFS (New Technology File System)


$ sudo mkfs.ntfs /dev/sdb3

Please note to change the USB device id in the above commands. I have used sdb3 which is device id of my USB drive.

Tags: Format a USB Pen Drive Using Terminal Commands, Format Usb Debian, Format Usb Terminal Linux, Format Usb Terminal Mac, Format Usb Terminal Ubuntu, Format Usb Terminal Ubuntu 14.04, Format Usb Terminal Ubuntu 14.10, Format Usb Terminal Ubuntu 15.04, Format Usb Terminal Ubuntu 15.10, Format Usb Terminal Ubuntu 16.04, Format Usb Terminal Ubuntu 16.10, How to Format a Pen Drive in Linux, How to Format a Pen Drive in Ubuntu, How To Format Pendrive In Linux Command Prompt, How To Format Pendrive In Ubuntu Using Terminal, How To Format Usb Drive In The Terminal, How To Format Usb In Linux Command Line, Linux Format Usb Drive Ext4, Linux Format Usb Drive Via Command Line, Linux Format Usb Drive Via Terminal, Linux Format Usb Fat32, Linux Format Usb Ntfs, Linux Format Usb Terminal, Mount Usb Terminal Linux, Mount Usb Terminal Ubuntu, Ubuntu 14.04 Format Usb Terminal, Ubuntu 14.10 Format Usb Terminal, Ubuntu 15.04 Format Usb Terminal, Ubuntu 15.10 Format Usb Terminal, Ubuntu 16.04 Format Usb Terminal, Ubuntu 16.10 Format Usb Terminal, Ubuntu Format Usb Drive Via Command Line, Ubuntu Format Usb Drive Via Terminal, Ubuntu Format Usb Terminal, Unmount Usb Terminal Linux, Unmount Usb Terminal Ubuntu, Xubuntu Format Usb

Primary Sidebar

Latest Posts

Clear History In Linux Terminal Permanently

How To Create Zip File In Ubuntu Terminal With Password

How To Check Difference Between Two Files In Linux Ubuntu

How To Check Kernel Installed Date In Linux Command Line

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap