LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-15-2008, 05:15 PM   #1
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Rep: Reputation: 30
Anyway to limit the amount of sectors the kernel tries to access?


I have a flash drive that died on me.
The data was backed up already but I want it to live again.

What happened was it was in a (windows) computer that suddenly turned off, and when I plugged it back in to a functional computer, it said it was 4GB when it really was 1GB.

On windows, the FAT32 partition already on there shows up at about 1GB, and 3GB free space.

On linux, the partitions never show up. For some reason the kernel tries to access the "fake" sectors and then causes all sorts of IO errors, so it can't get to the MBR (I think).

the output of sfdisk:
Code:
sfdisk -l /dev/sdb

Disk /dev/sdb: 4064 cylinders, 64 heads, 32 sectors/track
read: Input/output error

sfdisk: read error on /dev/sdb - cannot read sector 0
 /dev/sdb: unrecognized partition table type
No partitions found
I think I can fix this poor drive, by using sfdisk to fix the number of cylinders or something, but first I need the kernel to stop trying to access the higher sectors

dmesg:

Code:
usb 6-1: new high speed USB device using ehci_hcd and address 8
usb 6-1: configuration #1 chosen from 1 choice
scsi7 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 8
usb-storage: waiting for device to settle before scanning
usb 6-2: new high speed USB device using ehci_hcd and address 9
usb 6-2: configuration #1 chosen from 1 choice
scsi8 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 9
usb-storage: waiting for device to settle before scanning
usb 6-1: reset high speed USB device using ehci_hcd and address 8
scsi 7:0:0:0: Direct-Access     I-Stick2 IntelligentStick 0.00 PQ: 0 ANSI: 2
sd 7:0:0:0: [sdb] 8323072 512-byte hardware sectors (4261 MB)
sd 7:0:0:0: [sdb] Write Protect is off
sd 7:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 7:0:0:0: [sdb] Assuming drive cache: write through
sd 7:0:0:0: [sdb] 8323072 512-byte hardware sectors (4261 MB)
sd 7:0:0:0: [sdb] Write Protect is off
sd 7:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 7:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1 sdb2
sd 7:0:0:0: [sdb] Attached SCSI removable disk
sd 7:0:0:0: Attached scsi generic sg2 type 0
usb-storage: device scan complete
end_request: I/O error, dev sdb, sector 8321532
printk: 650 messages suppressed.
Buffer I/O error on device sdb2, logical block 3164736
Buffer I/O error on device sdb2, logical block 3164737
Buffer I/O error on device sdb2, logical block 3164738
Buffer I/O error on device sdb2, logical block 3164739
end_request: I/O error, dev sdb, sector 8321532
Buffer I/O error on device sdb2, logical block 3164736
end_request: I/O error, dev sdb, sector 8321534
Buffer I/O error on device sdb2, logical block 3164737
Buffer I/O error on device sdb2, logical block 3164738
Buffer I/O error on device sdb2, logical block 3164739
end_request: I/O error, dev sdb, sector 1991871
Buffer I/O error on device sdb1, logical block 1991808
Buffer I/O error on device sdb1, logical block 1991809
end_request: I/O error, dev sdb, sector 1991871
end_request: I/O error, dev sdb, sector 1991872
end_request: I/O error, dev sdb, sector 1991871
end_request: I/O error, dev sdb, sector 1991872
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1991991
end_request: I/O error, dev sdb, sector 1991992
end_request: I/O error, dev sdb, sector 1992047
end_request: I/O error, dev sdb, sector 1992048
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 1992055
end_request: I/O error, dev sdb, sector 1992056
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 8321532
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 63
end_request: I/O error, dev sdb, sector 64
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321604
end_request: I/O error, dev sdb, sector 8321606
end_request: I/O error, dev sdb, sector 8321652
end_request: I/O error, dev sdb, sector 8321654
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 8321532
end_request: I/O error, dev sdb, sector 8321532
end_request: I/O error, dev sdb, sector 8321534
end_request: I/O error, dev sdb, sector 8321532
end_request: I/O error, dev sdb, sector 8321534
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321604
end_request: I/O error, dev sdb, sector 8321606
end_request: I/O error, dev sdb, sector 8321652
end_request: I/O error, dev sdb, sector 8321654
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 8321668
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 1992060
end_request: I/O error, dev sdb, sector 1992062
end_request: I/O error, dev sdb, sector 0
end_request: I/O error, dev sdb, sector 8
end_request: I/O error, dev sdb, sector 0
end_request: I/O error, dev sdb, sector 0
end_request: I/O error, dev sdb, sector 0
end_request: I/O error, dev sdb, sector 0
end_request: I/O error, dev sdb, sector 0

Last edited by lambchops468; 05-15-2008 at 05:24 PM.
 
Old 05-15-2008, 07:44 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,492
Blog Entries: 54

Rep: Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908
I'd rather try a full, destructive format combined with badblocks.
 
Old 05-15-2008, 09:38 PM   #3
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by unSpawn View Post
I'd rather try a full, destructive format combined with badblocks.
I'm doing that now; will that allow me to restore my flash drive to its actual capacity of 1GB (even if an extra 3 Gb is nice but not realistic )
 
Old 05-16-2008, 05:56 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,492
Blog Entries: 54

Rep: Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908
'dd if=/dev/zero of=/dev/sticklocation', then partitioning and formatting it should get your stick working again. If there's no malfunction then, yes, you should get full usable size.
 
Old 05-16-2008, 02:20 PM   #5
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by unSpawn View Post
'dd if=/dev/zero of=/dev/sticklocation', then partitioning and formatting it should get your stick working again. If there's no malfunction then, yes, you should get full usable size.
I can't write (IO errors)

however, bad blocks works...]

perhaps I should add more information I forgot to include.
Windows XP can write/read the drive just like normal, the parititon is 1 Gig, but it still sees 3Gigs extra.

Linux however, cannot write or read, leading me to think that if I prevented the kernel from accessing the higher up sectors, everything would be a-ok and I could reset the partition table and use dd, etc.

Last edited by lambchops468; 05-16-2008 at 05:17 PM.
 
Old 05-17-2008, 06:51 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,492
Blog Entries: 54

Rep: Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908Reputation: 2908
Hmm. AFAIK you can not deny the kernel from "accessing the higher up sectors" because that's not how things work. (Well you can, but that's HPA/DCO territory and that should not apply here.)

For fixed disks the Cylinder, Head Sector standard describes how a disk should be addressed in terms of hardware. Of course a Flash or USB stick device doesn't posess any physical CHS characteristics so partitioning software kind of wiggles values in a way that maximises but not exceeds the expected maximum storage capacity. Depending on the disks characteristics and formatting you end up with a device that has a Master Boot Record, a Partition Table (also containing Logical Block Addressing values if applicable) and a FAT(32) partition (which holds a Boot Record (which holds a Disk Parameter Block) one or two File Allocation Tables and the Root Directory). The PT holds the records for each partition: start "cylinder", end "cylinder", size in sectors, active flag and filesystem type ("/dev/sdb: unrecognized partition table type").

On device activation Linux (the kernel) looks for suitable block device drivers and does the low level handshaking with the device. This starts with looking at the block device itself ("usb-storage: device scan complete"), the MBR (if it needs to do something with it) then scanning the PT ("I/O error, dev sdb, sector n") to present available partitions to higher level kernel layers ("Buffer I/O error on device sdb2"). In terms of standards, protocols, compliance, Mcrsft Wndws is far more lenient, forgiving, than GNU/Linux ever will become (which definately is a Good Thing), and so Mcrsft Wndws being able to read slightly wonky disk layouts does not come as a surprise at all. Linux will not accept out of bounds values so if for instance in the PT a partitions amount of sectors exceeds what is "logical" for that partition given the start and end "cylinder" it will not accept add_disk() to proceed. Proceeding regardless would be comparable with trying to move a disks "head" beyond the partitions or even physical boundaries. AFAIK the same I/O errors show with read() or writes on already mounted filesystems where corruption makes one block point to a phantom block beyond the disks capacity. (Anyone want to correct me: BMG.)


Heh. All of this probably wasn't necessary to tell you the PT is corrupted, and maybe I should just revisit the OP and ask about the circumstances the disk died in in the first place. Maybe sloppy Mcrsft Wndws even has its purpose if it does allow you to delete PT records from there...
 
Old 05-17-2008, 12:57 PM   #7
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Original Poster
Rep: Reputation: 30
I've given up
I've bought a new 2GB flash drive.
I did erase the flash drive in windows using the windows dd port, but that didn't fix the hardware sector problems.
There is no sfdisk port for windows, so I've given up, and I can't find a windows tool that changes hardware geometry (Windows feels like a straitjacket...)

The problem is in the drive's actual hardware or whatever CHS numbers, not in the partition table (that doesn't exist anymore since the drive has been zeroed out up to its limit). It still reads the incorrect number of cylinders.

Last edited by lambchops468; 05-17-2008 at 03:52 PM.
 
  


Reply

Tags
drive, flash, sectors, usb


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
How do I limit the amount of processes a user can run? houler Slackware 26 04-04-2005 08:02 PM
Is it possible to limit the amount of characters on members' profile? Mega Man X LQ Suggestions & Feedback 9 05-16-2004 01:46 PM
limit the amount of bandwidth used by certain protocols chrisfirestar Linux - Networking 4 03-22-2004 09:12 PM
Limit the amount of login attempts to machine jester_69 Linux - Security 4 10-14-2003 02:35 PM
Limit amount of emails on server ganninu Linux - Networking 7 07-30-2003 11:21 AM


All times are GMT -5. The time now is 10:56 AM.

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