LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 10-19-2007, 12:07 PM   #1
mazzo
Member
 
Registered: Jun 2003
Location: Thames Valley, UK
Distribution: RedHat 7.3 & 9 Ubuntu, Puppy Linux, Ubuntu and CentOS
Posts: 135

Rep: Reputation: 15
USB memory stick - badblocks - how to format?


Hi

I recently got errors on my 1G memory stick. I checked using a badblocks -w test which picked up over 73M ofbad blocks.

What I want to know is if there is a way to format the stick so that it locks out the bad blocks. Unfortunately I haven't worked out how to do it and everytime I use mkfs.vfat -c it doesn't block them.
 
Old 10-20-2007, 10:34 AM   #2
Peacedog
Guru
 
Registered: Sep 2003
Location: Danville, VA
Distribution: Slackware, Windows, FreeBSD, OpenBSD, Mac OS X
Posts: 5,292

Rep: Reputation: 167Reputation: 167
Hi mazzo, You could try
Code:
dosfsck
Good luck. ;-)
 
Old 10-20-2007, 12:17 PM   #3
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
There is also a dos utility that can be run from a CD or Floppy called "SpinRite" that isolates bad sectors while re-mapping the data contained in those sectors to spare sectors. This is handy when working on storage mediums with data you don't want to loose. I've never tried it on a flash drive, but because it works on hard drives and floppy disks, I would think it would work on flash drives also.
Flash drives did not exist when it was designed, and it is not highly used anymore as modern hard drives have the ability to remap bad sectors on their own compared to older drives that could not.

Last edited by Junior Hacker; 10-20-2007 at 12:19 PM.
 
Old 10-20-2007, 12:39 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Spinrite is a great program but for $80, might as well get a new pendrive. It is probably at the end of it's life anyway. Since you don't know for sure if SpinRite would work on pendrives.

If you mount a pendrive, make sure you use the "noatime" and "flush" options.

Check the manpage for the dosfsck program mentioned above. It may have an option to map bad sectors when formatting. Also look at the mtools programs. This assumes that the filesystem is a FAT type.

I don't know if you can run badblocks directly on a pen drive. Pen drives may work differently then hard drives or floppys.
I think the driver has to read a larger segment then you may by writing to, write the changes to the buffer, erase the segment and rewrite it. A tool like badblocks & SpinRite may exercise the read/erase/write cycle too much shortening the life of the device.
 
Old 10-28-2008, 06:05 AM   #5
borosspet
LQ Newbie
 
Registered: Oct 2008
Location: Hungary
Distribution: UHU-Linux 2.1
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
I don't know if you can run badblocks directly on a pen drive. Pen drives may work differently then hard drives or floppys.
I think the driver has to read a larger segment then you may by writing to, write the changes to the buffer, erase the segment and rewrite it. A tool like badblocks & SpinRite may exercise the read/erase/write cycle too much shortening the life of the device.
Yes of course, it works on USB sticks too, i tried it. However, my problem is a little bit more problematic:
My stick has some untrustable sectors, the data copied to them becomes damaged almost immediately; but neither fsck, neither badblocks, neither Windows fsck programs (chkdsk, scandisk, ndd) cannot find any problematic block.

Is there a thorough badblock tester for hdd/fdd/usb drives (which operates like memtest86+ for memory modules), which tests more times and very thoroughly the drives, to find not only the real bad, but the just untrustable (sometimes looks like bad, sometimes looks like good) sectors too?

Boross Péter
Hungary

Last edited by borosspet; 10-28-2008 at 07:14 AM.
 
Old 10-28-2008, 08:39 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,865

Rep: Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739
Not an expert on Flash memory but they have their own built in bad block / error detection system sometimes known wear leveling. jschiwal is correct that flash memory must erase an entire block to modify a single cell. I also agree that regular hard disk drive utilities may not work. The drive may just be broken and not sure if there is any decent repair software.
 
Old 10-29-2008, 12:26 AM   #7
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Quote:
Originally Posted by borosspet View Post
Is there a thorough badblock tester for hdd/fdd/usb drives (which operates like memtest86+ for memory modules), which tests more times and very thoroughly the drives, to find not only the real bad, but the just untrustable (sometimes looks like bad, sometimes looks like good) sectors too?

Boross Péter
Hungary
Look up SpinRite.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*** USB external hard drive and USB memory stick linux_2007_ Linux - General 1 07-17-2007 04:20 PM
SD card & USB stick format chaos JohnKFT Slackware 5 10-04-2006 06:31 PM
USB memory, Compact Flash, Memory Stick energiza Linux - Hardware 2 08-22-2006 09:29 PM
Missing memory in USB stick, flash memory, removable hd etc bamboo_spider Linux - Newbie 3 06-14-2006 05:39 PM
USB Memory Stick freddie_leaf Slackware 15 11-09-2004 01:41 AM


All times are GMT -5. The time now is 02:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration