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.