5

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.

2
  • copy in a link to a screenshot and someone can edit it in please.
    – Rinzwind
    Aug 19, 2011 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, 2011 at 21:11

3 Answers 3

3

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 -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.
3
  • 2
    sfdisk no longer provides the -R or --re-read option, use sudo blockdev --rereadpt /dev/sdc1 instead. Source: serverfault.com/a/534591
    – McGiogen
    Aug 21, 2019 at 11:36
  • 1
    I think last command is wrong... isn't there a sudo too many? Anyway, when I try to kill the partition table of my 160GB 2.5 HDD, it says: sfdisk: no se puede abrir /dev/sde: Error de entrada/salida. Should I throw it to trash? It has no data inside...
    – Mario Mey
    Oct 5, 2021 at 12:00
  • 1
    @MarioMey good catch :-) 10 years is a new record
    – Rinzwind
    Oct 5, 2021 at 13:35
0

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.

0

I had the same problem before. I used the following command and it worked:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .