Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a 8gb memory stick pro duo that is refusing to format or be read correctly. While deleting a file off of it from my Playstation Portable, the battery got accidentally knocked out. Now, nothing is able to read it. I get this message when i try to format it:

Error creating file system: 
helper exited with exit code 1: helper failed with:
mkfs.vfat: failed whilst writing FAT
mkfs.vfat 3.0.9 (31 Jan 2010)

Two methods for reading off the stick are by inserting it directly into the computer or by putting it in my playstation and connecting to it through a wire. When I use the latter method and attempt to open it, I can see a bunch of files with random symbols as names (forum isn't allowing me to post a screenshot). Anyone know how I can fix this? Be specific with instructions, especially ones that involve terminal because I am new to Linux.
Thanks in advance.

share|improve this question
    
copy in a link to a screenshot and someone can edit it in please. –  Rinzwind Aug 19 '11 at 21:03
    
question: instructions on completely removing all data are allowed (ie. as in reformatting). There is not need to try and restore all the files? –  Rinzwind Aug 19 '11 at 21:11
add comment

2 Answers

With the stick connected to the PC try to give the following command (and if the rest of my answer is not helpful) add the output to your question:

sudo fdisk -l

Search for the device name of this 8 Gb stick. Let's assume it is sdc1 do a:

cd / 
sudo umount -l /dev/sdc1 
sudo swapoff /dev/sdc1 
sudo sfdisk -R /dev/sdc
  • 1st command is to make sure you are not cd'd into the USB stick. Could be cd /tmp/ if you want.
  • 2nd command is an unharmful un-mounting.
  • Execution of the 2nd and 3rd command might get you error messages.

Regarding the last command:

  • sfdisk is a partition table manipulator.
  • The last command will make the kernel re-read the partition table and should not end up in an error. It is important that does not give any error and if it does add it to your question. A typical error that it could show is: device busy for revalidation (usage = 2).

If need be:

cat /proc/partitions
sudo sfdisk -uM -s /dev/sdc
sudo sfdisk -uM -s /dev/sdc1

should each report the filesize if you are in doubt of the actual device name. The 1st one will also show other partitions so you can also use this as an alternative to the 2nd command (sudo fdisk -l). Or as confirmation you are doing it correctly :)

Up to here it is all undoable.

If you do not get any errors type in:

sudo sfdisk /dev/sdc <<EOF 
,, c 
EOF

This will totally kill the partition table so be careful to type it correctly. If you decide to copy/paste this do not copy/paste this as one block but do each line seperately.

Next is a reread of the partition table:

sudo sfdisk -R /dev/sdc1

And this command should start formatting it:

sudo mkfs.vfat sudo -c -F 32 -n LABEL -v /dev/sdc1
  • I have ofcourse not tested this but I am fairly sure I made no typos :)
  • And again: this -will- delete any contents on the USB flash drive.
share|improve this answer
add comment

I've seen memory sticks that wont format after having ISO9660 images on them, whatfixed it for me was writing zeros first.

dd if=/dev/zero of=/dev/the-device bs=512

let it run for a minute or so, then ctrl-z to stop it

then try formatting again.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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