LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 11-02-2009, 05:18 AM   #1
Niraj Kulkarni
Member
 
Registered: May 2008
Posts: 47

Rep: Reputation: 15
HOWTO handle Bad Block in mass storage device


Hi,
* I am implementing mass storage device on a test board.
* It contains NAND flash.
* Using corresponding "udc driver" and "g_file_storage" I could make my test board enumerate as mass storage device on my Linux machine.
* my 16 MB pen drive (test board) is now ready for read/write.

But there are some Bad Blocks on the NAND.Hence copy is not complete.
Although on Linux machine there is no error message.

Now , what is there in a normal pen drive which manages the Bad Block or what am I missing so that such Bad Blocks are managed.

Please guide.

Here is the error I get on my test board :

mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5664
Buffer I/O error on device mtdblock2, logical block 708
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5672
Buffer I/O error on device mtdblock2, logical block 709
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5680
Buffer I/O error on device mtdblock2, logical block 710
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5688
Buffer I/O error on device mtdblock2, logical block 711
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5696
Buffer I/O error on device mtdblock2, logical block 712
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5704
10860,1
 
Old 11-03-2009, 01:13 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
In mass-market USB storage devices there is a controller that abstracts out of the memory structure. It tries to distribute writes and work aroud bad blocks. Under some workloads it spoils things, though.

Many filesystems are capable to get a list of bad blocks during formatting and just not use them.

Also there are special filesystems that are designed for raw access to flash memory. They make better use of it than USB pen drive controllers..

From your description I cannot fully understand what goes on where. You have your test board with an embedded Linux installation on it as a USB "client" device and a Linux computer as a host? Do you check for device errors in the driver on the test board? Do you return any errors to host?
 
Old 11-03-2009, 03:59 AM   #3
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
It sounds like the embedded kernel is missing a module it needs to manage bad blocks, or the embedded controller is bad. And I second the opinion that using a usb flash drive controller on a small system is kludgy.
 
Old 11-05-2009, 01:39 AM   #4
Niraj Kulkarni
Member
 
Registered: May 2008
Posts: 47

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by raskin View Post
In mass-market USB storage devices there is a controller that abstracts out of the memory structure. It tries to distribute writes and work aroud bad blocks. Under some workloads it spoils things, though.

Many filesystems are capable to get a list of bad blocks during formatting and just not use them.

Also there are special filesystems that are designed for raw access to flash memory. They make better use of it than USB pen drive controllers..

From your description I cannot fully understand what goes on where. You have your test board with an embedded Linux installation on it as a USB "client" device and a Linux computer as a host? Do you check for device errors in the driver on the test board? Do you return any errors to host?
Thanks ,
I my case there will not be any Filesystem coming into picture.
In that case , does it mean that I will have to write some code which will
take care of bad block. As my processor builtin "device controller" does not do it.For eg.
If PC (host) wants to write packets A,B,C to sector num 1 , 2, 3
Normally "device controller driver" and "g_file_storage" will write one to one i.e A on 1 , B on 2 , C on 3.
Now if sector 2 is bad: THen by some means this will happen
A on 1 , B on 3 (as 2 is bad), C on 4.
So there must be some map as to when ever Host wants to read "B" , it should be read from sector "3" and not "2".
Is there any code which does all this maping thing.
Niraj
 
  


Reply

Tags
block, device, mass, storage


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 Mass Storage not mount 'Buffer I/O error on device sde, logical block 0' limdel Linux - Hardware 4 06-19-2009 11:35 AM
how to get the device ID of a USB mass storage device ebinjose Linux - Embedded & Single-board computer 1 10-30-2008 06:58 AM
USB Mass storage Device purefan Linux - Hardware 15 06-06-2005 02:56 PM
MP3 player (USB mass storage) not mountable anymore, no block-oriented device the who Slackware 8 09-07-2004 06:55 PM
Usb mass storage device laguna Linux - Hardware 4 08-12-2002 03:16 AM


All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
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