Memory stick not formatting?
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.
Solution 1:
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 becd /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.