how to repair a corrupted USB flash drive
how to repair a corrupted USB flash drive
When you accidentally corrupt a USB flash drive, you can try this. It happened to me, so i googled for a solution. I got rid of it, because no solution worked for me. But buying a new one is a last resort. Try this low-level solution before giving up. The advice below is from Ubuntu forum.
Repairing a corrupt USB drive
It seems that no-one gave you much low level advice. The GUI tools work fine when everything is working properly, but once things go wrong, you need the command line tools, so that you can see the error messages.
So, plug the drive in. Now run dmesg:
$ sudo dmesg
Note the device name e.g. sdb
(If your machine has one hard disk, it will be sda)
Confirm what is going on by looking at /dev:
$ ls /dev
You should see /dev/sda and /dev/sdb. Partitions on sda will show up as sda1, sda2 and so on.
Now run fdisk and delete whatever partitions it sees on the USB disk:
$ sudo fdisk /dev/sdb
Type p to list the partitions. Use d (repeatedly) to delete all of them, then use n to make one new primary partition. Use t to rename the partition type to c (FAT32). Finally use w to write the partition table and exit.
The device is now partitioned, but still unformatted. Use the mkfs.vfat command to create a file system on the partition you created and give it a meaningful label:
$ sudo mkfs.vfat -n USBDISK /dev/sdb1
The device is now formatted and ready for use.
Unplug it and replug it and the desktop system should offer to mount it for you as /media/USBDISK.
OR :
You can try this :
sudo mkfs -t vfat -I /dev/sdc
(your flash drive could be sdb, sdc, sdd, sde, etc. sda is for the internal drive. This command line will make a vfat file system on a Debian-based system, such as MintPup. sudo is for administrative rights).
OR :
You can try this :
This command dd if=/dev/zero of=/dev/sda will fill a hard drive with 0's allowing it to be re-partitioned and formatted. Type it in and edit the last part to match the usb drive.
If you cannot partition and format after this then as someone has already said 'bin it and get another one'.
The forum offered some obvious tricks, such as using GParted, but sometimes you need a command-line tool for a low-level solution.
And sometimes, you just buy another one, or try to have a refund.
I suspect my Lexar 64G USB Flash Drive was faulty to start with, because i used GParted two or three times to reformat the drive, in order to make it writable again. A virus could be responsible.
Repairing a corrupt USB drive
It seems that no-one gave you much low level advice. The GUI tools work fine when everything is working properly, but once things go wrong, you need the command line tools, so that you can see the error messages.
So, plug the drive in. Now run dmesg:
$ sudo dmesg
Note the device name e.g. sdb
(If your machine has one hard disk, it will be sda)
Confirm what is going on by looking at /dev:
$ ls /dev
You should see /dev/sda and /dev/sdb. Partitions on sda will show up as sda1, sda2 and so on.
Now run fdisk and delete whatever partitions it sees on the USB disk:
$ sudo fdisk /dev/sdb
Type p to list the partitions. Use d (repeatedly) to delete all of them, then use n to make one new primary partition. Use t to rename the partition type to c (FAT32). Finally use w to write the partition table and exit.
The device is now partitioned, but still unformatted. Use the mkfs.vfat command to create a file system on the partition you created and give it a meaningful label:
$ sudo mkfs.vfat -n USBDISK /dev/sdb1
The device is now formatted and ready for use.
Unplug it and replug it and the desktop system should offer to mount it for you as /media/USBDISK.
OR :
You can try this :
sudo mkfs -t vfat -I /dev/sdc
(your flash drive could be sdb, sdc, sdd, sde, etc. sda is for the internal drive. This command line will make a vfat file system on a Debian-based system, such as MintPup. sudo is for administrative rights).
OR :
You can try this :
This command dd if=/dev/zero of=/dev/sda will fill a hard drive with 0's allowing it to be re-partitioned and formatted. Type it in and edit the last part to match the usb drive.
If you cannot partition and format after this then as someone has already said 'bin it and get another one'.
The forum offered some obvious tricks, such as using GParted, but sometimes you need a command-line tool for a low-level solution.
And sometimes, you just buy another one, or try to have a refund.
I suspect my Lexar 64G USB Flash Drive was faulty to start with, because i used GParted two or three times to reformat the drive, in order to make it writable again. A virus could be responsible.
Hi, labbe5.
I sympathize.
But it wouldn't have happened running Puppy live from a DVD-R, which
can last 100 years, apparently, and saving what needs to be saved to a
regular HD, which will last you a good 10 years if you take proper care of it.
How much did you buy your faulty 64G USB for? What a waste...
Hoop-la aside, that flash technology is not mature yet.
BFN.
musher0
I sympathize.
But it wouldn't have happened running Puppy live from a DVD-R, which
can last 100 years, apparently, and saving what needs to be saved to a
regular HD, which will last you a good 10 years if you take proper care of it.
How much did you buy your faulty 64G USB for? What a waste...
Hoop-la aside, that flash technology is not mature yet.
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Have you come across a drive that doesn't get detected at all.
When ever my Windows user friend have USB disk trouble, they give me their corrupted drives and sd cards to dd them out and salvage them.
But I have come across 2 which don't get detected.
I have kept them separate in case I come up with something.
Ohh and I always advice them to test newly bought drives with h2testw on windows.
And on linux see this old discussion of f3..
http://www.murga-linux.com/puppy/viewtopic.php?t=94692
I have sent one usb drive back because it was fake 32Gb (it was of 8Gb).
And it also gives general idea of read and write speeds.
Although I would advise against using dd on newly bought usb as I have read somewhere that it destroys manufacturer's settings.
I don't know much about that.
But for salvaging an old device is ok I think with dd.
Thanks for your post.
Have fun.
When ever my Windows user friend have USB disk trouble, they give me their corrupted drives and sd cards to dd them out and salvage them.
But I have come across 2 which don't get detected.
I have kept them separate in case I come up with something.
Ohh and I always advice them to test newly bought drives with h2testw on windows.
And on linux see this old discussion of f3..
http://www.murga-linux.com/puppy/viewtopic.php?t=94692
I have sent one usb drive back because it was fake 32Gb (it was of 8Gb).
And it also gives general idea of read and write speeds.
Although I would advise against using dd on newly bought usb as I have read somewhere that it destroys manufacturer's settings.
I don't know much about that.
But for salvaging an old device is ok I think with dd.
Thanks for your post.
Have fun.
Dr UFD
Still Googling, i did find something useful on a blog : https://ardamis.com/2009/07/02/usb-driv ... -capacity/
I have a Kingston DataTraveler 100 G3 16GB that stopped working after trying to put windows-to-go on it. I tried pretty much every method people mention for fixing it. The HP tool didn’t work, any command line stuff didn’t work. It showed as having no media in disk manager.
The tool that endorphin3 mentioned worked with the restore button! Thank you so much for that!
Here’s the tool :http://www.pqigroup.com/soft_in.aspx?mn ... 245&nid=58
In retrospect, i should have kept this USB Flash Drive. I would have tried this app, called Dr UFD. It's not mentionned if this tool is a freeware. You need a Windows installation to benefit from it, or you may try Wine. Somehow, it is a last resort app to salvage a buggy USB flash drive.
Other links are offered on the blog, that may lead to a solution, if you have this kind of problem.
I have a Kingston DataTraveler 100 G3 16GB that stopped working after trying to put windows-to-go on it. I tried pretty much every method people mention for fixing it. The HP tool didn’t work, any command line stuff didn’t work. It showed as having no media in disk manager.
The tool that endorphin3 mentioned worked with the restore button! Thank you so much for that!
Here’s the tool :http://www.pqigroup.com/soft_in.aspx?mn ... 245&nid=58
In retrospect, i should have kept this USB Flash Drive. I would have tried this app, called Dr UFD. It's not mentionned if this tool is a freeware. You need a Windows installation to benefit from it, or you may try Wine. Somehow, it is a last resort app to salvage a buggy USB flash drive.
Other links are offered on the blog, that may lead to a solution, if you have this kind of problem.
The best place for repairing UFD (USB Flash Drives)
http://www.usbdev.ru/
Unfortunately (some situations not solved under Linux) only working under XP or maybe windows 7.
Have a nice try!
http://www.usbdev.ru/
Unfortunately (some situations not solved under Linux) only working under XP or maybe windows 7.
Have a nice try!
I agree - h2testw is a great tool and every usb drive should be tested with it to ensure that the stick offers as much ram as it says on the label. I once lost a lot of data because the stick said 8GB but the RAM chip inside was actually only 2GB. It was designed with a hacked controller that would overwrite older files to make it appear as if it could swallow 8GB of data. When I tried to access the information on the stick later most of it was gone.drunkjedi wrote: I always advice them to test newly bought drives with h2testw on windows..
I wish there was a linux equivalent of h2testw. It's a great program.
My view of troublesome usb sticks is - don't try to recover them with fancy tools - if something isn't working right just chuck the stick away. I had a microSD card that would start corrupting data after 5 minutes of use on Linux, but performed perfectly on Windows each time I took it back to the supplier for a refund. Because it would not fail on Windows they refused me a refund so I took the stick back home and used a hammer to solve the problem. Never gave me any trouble on Linux again.
I posted a link to f3 software in previous post.greengeek wrote:I wish there was a linux equivalent of h2testw. It's a great program
It does check the usb in same way as h2testw but on Linux.
Check it out.
http://www.murga-linux.com/puppy/viewtopic.php?t=94692 go to this link for details.
labbe5,
In Your how to.
You can delete sudo in all the console commands.
Puppy is running as root.
Sudo just says to run the command as root.
In Your how to.
You can delete sudo in all the console commands.
Puppy is running as root.
Sudo just says to run the command as root.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected
YaPI(any iso installer)
When I was a kid I wanted to be older.... This is not what I expected
YaPI(any iso installer)
Yah labbe5, theres a problem with large USB sticks. They come formatted as 'exfat', vfat WILL NOT solve. That 64Gb stick probably has to be reformatted as 'exfat'... nothing else M$ strikes again.
Linux user #498913 "Some people need to reimagine their thinking."
"Zuckerberg: a large city inhabited by mentally challenged people."
"Zuckerberg: a large city inhabited by mentally challenged people."
Repairing usb sticks and sdhc
Hi
Just thought that I would add my experiences to this topic. I do keep an old copy of Windows Vista for only one purpose and that is to use two Windows only utilities to "fix" usb sticks and sdhc cards. After trying dd, gparted, etc sometimes the usb stick or more likely an sdhc is still not right and it is then that I use these facilities. I have even had dead devices that work after using them! In the case of sdhc cards the association that controls them keeps the details secret to protect the DRM features and only allow Windows and Apple programmes to exist. The usb programme is one written by HP and has become the standard for usb sticks.
I think these sites will get you copies if you need them.
http://ccm.net/download/download-127-hp ... ormat-tool
https://www.sdcard.org
Hope this helps and I wish there were direct equivalents in Linux
peterw
Just thought that I would add my experiences to this topic. I do keep an old copy of Windows Vista for only one purpose and that is to use two Windows only utilities to "fix" usb sticks and sdhc cards. After trying dd, gparted, etc sometimes the usb stick or more likely an sdhc is still not right and it is then that I use these facilities. I have even had dead devices that work after using them! In the case of sdhc cards the association that controls them keeps the details secret to protect the DRM features and only allow Windows and Apple programmes to exist. The usb programme is one written by HP and has become the standard for usb sticks.
I think these sites will get you copies if you need them.
http://ccm.net/download/download-127-hp ... ormat-tool
https://www.sdcard.org
Hope this helps and I wish there were direct equivalents in Linux
peterw
Thanks dj - that helped me confirm my bogus usb stick:drunkjedi wrote:I posted a link to f3 software in previous post.
http://www.murga-linux.com/puppy/viewtopic.php?t=94692
Code: Select all
Free space: 15.61 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... OK!
Creating file 3.h2w ... OK!
Creating file 4.h2w ... OK!
Creating file 5.h2w ... OK!
Creating file 6.h2w ... OK!
Creating file 7.h2w ... OK!
Creating file 8.h2w ... OK!
Creating file 9.h2w ... OK!
Creating file 10.h2w ... OK!
Creating file 11.h2w ... OK!
Creating file 12.h2w ... OK!
Creating file 13.h2w ... OK!
Creating file 14.h2w ... OK!
Creating file 15.h2w ... OK!
Creating file 16.h2w ... OK!
Free space: 0.00 Byte
Average writing speed: 3.21 MB/s
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 1841704/ 205806/ 0/ 49642
Validating file 3.h2w ... 0/ 1721652/ 0/ 375500
Validating file 4.h2w ... 0/ 1749034/ 0/ 348118
Validating file 5.h2w ... 0/ 1760931/ 0/ 336221
Validating file 6.h2w ... 0/ 1768064/ 0/ 329088
Validating file 7.h2w ... 0/ 1769973/ 0/ 327179
Validating file 8.h2w ... 0/ 1771809/ 0/ 325343
Validating file 9.h2w ... 0/ 1773838/ 0/ 323314
Validating file 10.h2w ... 0/ 1773785/ 0/ 323367
Validating file 11.h2w ... 0/ 1775044/ 0/ 322108
Validating file 12.h2w ... 0/ 1773289/ 0/ 323863
Validating file 13.h2w ... 0/ 1773519/ 0/ 323633
Validating file 14.h2w ... 0/ 1773479/ 0/ 323673
Validating file 15.h2w ... 0/ 1775418/ 0/ 321734
Validating file 16.h2w ... 0/ 1080306/ 0/ 196350
Data OK: 1.88 GB (3938856 sectors)
Data LOST: 13.73 GB (28795080 sectors)
Corrupted: 11.56 GB (24245947 sectors)
Slightly changed: 0.00 Byte (0 sectors)
Overwritten: 2.17 GB (4549133 sectors)
Average reading speed: 5.88 MB/s