How to truly erase contents of USB drive?

2

I have a 2GB USB drive that had about 1.8GB of stored data on it. So I delete these files, and then I check the drive's properties, and I see it still has 1.8GB of data on it (only 0.2GB remaining)!

The file system doesn't see any files on it, but the drive is almost at full capacity. I previously had UNetbootin create a bootable USB drive out of this stick, so I'm wondering if that created some kind of "partition" or something on it that can't be erased through the file system.

I just want my 2GB back - don't care what I have to do to get it. I'm also not able to get to the store and buy another stick, if that was going to be someone's suggestion! Thanks in advance!

Edit - I'm on Linux Mint and/or Linux Ubuntu (I'm in front of 2 machines right now, so a solution for either of those OSes would suffice).

pnongrata

Posted 2012-08-31T16:03:34.763

Reputation: 2 212

Could you use Parted to repartition the USB drive?

– martineau – 2012-08-31T16:28:17.580

No unfortunately it doesn't look like its possible to do with Linux Mint :-/ – pnongrata – 2012-08-31T16:28:48.263

There's always fdisk.

– martineau – 2012-08-31T16:32:27.027

Thanks @martineau but unfortunately fdisk doesn't work either - please see my comment under m4573r's answer. – pnongrata – 2012-08-31T16:48:47.483

Answers

5

You can always format your drive. However I would verify that your "deleted" files are not in the recycle bin... In which case emptying it should solve your problem.

m4573r

Posted 2012-08-31T16:03:34.763

Reputation: 5 051

Thanks @m4573r (+1) - please see my edit regarding my OSes. On Windows it's nice - you can just right-click the USB stick and select "Format drive". What's the analog in Linux Land? – pnongrata – 2012-08-31T16:08:15.443

1Well it is quite easy to find guides on "How to format a disk on linux". The standard command line tool is fdisk /dev/your_device to repartition your disk, and mkfs -t ext3 /dev/your_device to recreate the (empty) filesystem on it. – m4573r – 2012-08-31T16:16:59.623

Thanks again @m4573r but I'm not having any luck with fdisk. When I type fdisk <my-drive> it outputs the following: "Command (m for help):". When I type "m" it gives me a whole list of options to choose from, none of which are for formatting the drive... – pnongrata – 2012-08-31T16:26:42.043

1Type p to list all the partitions on your drive.

Then d to delete them, one by one.

Then n to create a new one. Choose primary, and use the default values to span it across all your disk space.

After quitting and saving (key w), you'll have an empty drive, without a filesystem.

You can then use mkfs to rebuild it. – m4573r – 2012-08-31T17:05:56.067

2

For your partition issues you can try using GParted:

sudo apt-get install gparted
gksu gparted

Choose your device in the upper-right corner list. Then select Device -> Create partition table to create a partition table on the device. This will allow you to repartition the drive and should restore the entire capacity.

I'm unclear on whether you're wanting to overwrite, or securely erase previous data as well. In the case you are: Ubuntu has a command line utility shred which can overwrite previously stored data with random bits and bytes.

man shred

After using it you would have to repartition the device.

or you could also try the dd tool:

 1. Start the Disk Utility via System > Administration > Disk Utility
 2. Find your disk in the left panel, select it, and on the right find the device path (eg. /dev/sdb )
 3. Run the following command from a gnome-terminal (Applications > Accessories > Terminal):

    sudo dd if=/dev/zero of=/dev/sdb bs=1M

Joe Habadas

Posted 2012-08-31T16:03:34.763

Reputation: 161

1

You have several options here:

1) Reformat the USB drive

2) Use HP USB Disk Storage Format Tool to format the drive. (Very helpful tool!)

3) Or you can use Boot and Nuke. When you use Boot and Nuke, make sure you leave the USB stick plugged in. I would be very, very careful using this tool as if you select a wrong drive, you potentially can format your HDD instead of USB drive.

Good luck! Hope this helps!

George

Posted 2012-08-31T16:03:34.763

Reputation: 294

Thanks @George but HP USB Disk Storage Format Tools is a Windows application (see my update regarding Linux), and the link for Boot & Nuke doesn't work... – pnongrata – 2012-08-31T16:14:19.770

@zharvey I think the site might be down. The nuke and boot is probably your best choice, you'll still might have to reformat the USB afterwords, but it will, for sure, get ride everything you have on that USB. – George – 2012-08-31T16:47:59.573