how to completely reformat a usb using fdisk?

31,960

fdisk manages partitions, but does not format or write data to the disk.

To format the disk, use mkfs

# FAT
mkfs.vfat /dev/sdxy # /dev/sdxy is your usb

# Or for ext4
mkfs.ext4 /dev/sdxy 

However, formatting does not overwrite your data, it just removes the pointers to where it is. To overwrite your data you actually need to write over it, use dd or a utility such as scrub

scrub /dev/sdxy

See also man scrub

Share:
31,960

Related videos on Youtube

user784637
Author by

user784637

Updated on September 18, 2022

Comments

  • user784637
    user784637 over 1 year

    I have a usb drive which I would like to put a linux distribution on but it already has some files on it on /dev/sdc1. Using fdisk, I deleted the first partition and wrote the changes. When I printed the table, the first partition was gone.

    Then I created a new partition (/dev/sdc1).

    However when I wrote these changes to the usb, the old files were still there. I followed these instructions after deleting the first partition http://www.zorge.net/?p=22

    Are there any commands in fdisk (I'm trying to get comfortable in fdisk, so no gparted for me) to completely wipe out all the information on a drive?