Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 05 May 2016, 06:33
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
how to repair a corrupted USB flash drive
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
labbe5

Joined: 13 Nov 2013
Posts: 455
Location: Canada

PostPosted: Tue 01 Dec 2015, 11:50    Post subject:  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.
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 7434
Location: Gatineau (Qc), Canada

PostPosted: Tue 01 Dec 2015, 12:59    Post subject:  

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

_________________
musher0
~~~~~~~~~~
"The greatest of minds are the ones that never close." | "Les plus grands esprits sont ceux qui ne se ferment jamais."
(starhawk, Resident Philosopher | philosophe en résidence) Wink
Back to top
View user's profile Send private message Visit poster's website 
drunkjedi


Joined: 24 May 2015
Posts: 156

PostPosted: Tue 01 Dec 2015, 13:20    Post subject:  

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.
Back to top
View user's profile Send private message 
labbe5

Joined: 13 Nov 2013
Posts: 455
Location: Canada

PostPosted: Tue 01 Dec 2015, 14:39    Post subject: Dr UFD  

Still Googling, i did find something useful on a blog : https://ardamis.com/2009/07/02/usb-drive-unusable-unformattable-and-reporting-0-bytes-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?mnuid=1416&modid=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.
Back to top
View user's profile Send private message 
d4p


Joined: 12 Mar 2007
Posts: 422

PostPosted: Thu 10 Dec 2015, 13:36    Post subject:  

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!
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 3725
Location: New Zealand

PostPosted: Thu 10 Dec 2015, 14:32    Post subject:  

drunkjedi wrote:
I always advice them to test newly bought drives with h2testw on windows..
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.

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.
Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 156

PostPosted: Thu 10 Dec 2015, 14:39    Post subject:  

greengeek wrote:
I wish there was a linux equivalent of h2testw. It's a great program
I posted a link to f3 software in previous post.
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.
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 7426
Location: Charleston S.C. USA

PostPosted: Thu 10 Dec 2015, 16:36    Post subject:  

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.

_________________
I have found, in trying to help people, that 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 Shocked
Back to top
View user's profile Send private message 
8Geee


Joined: 12 May 2008
Posts: 767
Location: N.E. USA

PostPosted: Thu 10 Dec 2015, 22:45    Post subject:  

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 Twisted Evil M$ strikes again.
_________________
Linux user #498913
Back to top
View user's profile Send private message 
peterw

Joined: 19 Jul 2006
Posts: 126
Location: UK

PostPosted: Fri 11 Dec 2015, 04:26    Post subject: Repairing usb sticks and sdhc
Subject description: Sometimes it is easier to give up and use Windows programmes
 

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-usb-disk-storage-format-tool

https://www.sdcard.org

Hope this helps and I wish there were direct equivalents in Linux

peterw
Back to top
View user's profile Send private message 
rokytnji


Joined: 20 Jan 2009
Posts: 2094
Location: Pecos/ Texas

PostPosted: Fri 11 Dec 2015, 14:14    Post subject:  

Deleted, off topic. Sorry.
_________________
Linux Training More More Accepting Death is the only way to stay alive.

Last edited by rokytnji on Fri 11 Dec 2015, 22:22; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
greengeek

Joined: 20 Jul 2010
Posts: 3725
Location: New Zealand

PostPosted: Fri 11 Dec 2015, 14:52    Post subject:  

drunkjedi wrote:
I posted a link to f3 software in previous post.
http://www.murga-linux.com/puppy/viewtopic.php?t=94692

Thanks dj - that helped me confirm my bogus usb stick:

Code:
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


The website blurb for "f3" discusses the use of f3probe and f3fix to correct some problems but those features did not seem to be available in the pet. I will post more on the other thread.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0710s ][ Queries: 11 (0.0073s) ][ GZIP on ]