Help regaining lost space on usb stick

Associate
Joined
9 Dec 2002
Posts
1,565
Location
Somerset
Been messing about installing linux from a 4 gig usb stick. Only problem is now the stick reports as only having 364meg free ( even from a format ) Under disk management it shows as having 364 free and 3.44gb unallocated, but it wont let me delete or use the unallocated partition.
So how can I fit this ?
 
Ah, it may be dead. I've lost a few to messing around with partitions.

Boot back into linux, not running from the usb stick. Check which it is using sudo blkid or an equivalent, you probably want /dev/sdb1 but it depends what else is in your system. Or load gparted, that'll tell you.

Open a root terminal

dd if=/dev/zero of=/dev/sdX bs=4k conv=sync,noerror

It'll write zeros all over the entire drive. X must match your system, and you don't want /dev/sdX# but /dev/sdX. Your data is well gone by this point btw. Now open gparted, and after it finishes scanning you should see a 4gb unallocated space in which to make your partition.

You can append bs=512k,count=1 to the command above if you like, but I think its best to be thorough

If staying with windows, I don't know any way to do something equivalent. Any form of unix is likely to have dd available, even osx might do

Good luck
 
Used OSX diskmanager and used security erase to write zeros over the stick. Sorted now.
Thanks JonJ678 for the advice.
 
Back
Top Bottom