- lsblkand check the mount point, e.g.,- /dev/sdawhich might have different partitions like- /dev/sda1etc
- sudo umount /dev/sda*. Use- sudo umount -l /dev/sda*if something refuses to unmount
- sudo fdisk /dev/sdato delete all partitions one-by-one:- Press pto print the current partitions
- Press dto delete each partition (repeat for all).
- Press wto write changes and exit.
- HINT: just keep doing duntil you getno partitions remaining to be deleted, then dowand exit.
 
- Press 
- sudo parted /dev/sda mklabel gptto create a new GPT partition table
- sudo parted -a optimal /dev/sda mkpart primary 0% 100%creates a new parition (- /dev/sda1)
- Format the partition (/dev/sda1) with your preferred file system (belowUSB_DRIVEis just the assigned name, anything works):- sudo mkfs.exfat -n USB_DRIVE /dev/sda1for exFAT (Best for universal use); Works on Windows, Mac, Linux
- sudo mkfs.ntfs -f -L USB_DRIVE /dev/sda1for NTFS; Originally only for Windows, but now with- ntfs-3g, also works on Linux
- sudo mkfs.vfat -F 32 -n USB_DRIVE /dev/sda1for FAT32; Works everywhere but has a 4GB file size limit
- sudo mkfs.ext4 -L USB_DRIVE /dev/sda1for ext4; Linux-only
 
- Safely eject and remove.
          Last active
          January 31, 2025 00:30 
        
      - 
      
- 
        Save sadanand1120/c7c7c0c247bd937c5a2201a4a4a623fc to your computer and use it in GitHub Desktop. 
    Steps to cleanly format a usb/ssd to any filesystem (ext4, ntfs, exfat, fat32) on Ubuntu
  
        
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment