05/12/2025 • 6 min
How to format a USB Drive using the terminal on Debian, Ubuntu, or derivatives
A practical guide on how to safely format a USB flash drive using the terminal on Ubuntu, Debian, and derivatives.
1) Identify the USB drive
First, list all block devices and identify which one is your USB drive.
lsblk -o NAME,LABEL,SIZE,RM,MODEL,TRAN2) Unmount the USB drive
Before formatting, make sure the USB drive is not mounted.
sudo umount /dev/sdc* # replace /dev/sdc with your device3) Clean existing signatures
Wipe old filesystem signatures so they don't confuse the system.
sudo wipefs -a /dev/sdcThen create a new partition that uses 100% of the space:
sudo parted -a optimal /dev/sdc mkpart primary fat32 0% 100%4) Format the USB drive
Format the new partition with FAT32 (good compatibility with most systems).
sudo mkfs.vfat -F 32 /dev/sdc15) Set a label (name) for the drive
Finally, give your USB drive a friendly label.
sudo fatlabel /dev/sdc1 PENDRIVE