3

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?

7

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.