How to format USB in Arch Linux/Ubuntu from command line

Connect your USB disk to your computer and run this command to know where it is mounted

sudo fdisk -l

To be able to format it, you need to unmount it using this command

sudo umount /dev/sdc1

You can format your USB disk using mkfs

# FAT
sudo mkfs.vfat -n 'device name' -I /dev/sdc1

# NTFS
sudo mkfs.ntfs -I /dev/sdc1

# EXT4
sudo mkfs.ext4 -n  -I /dev/sdc1

You can also use following commands to completely wipe out the whole USB flash drive

# use shred
sudo shred /dev/sdc1

# or dd
sudo dd if=/dev/zero of=/dev/sdc1
comments powered by Disqus