Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
match a defect hadd disc sector to a logical volume
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3706
Location: Hamburg

PostPosted: Sat Sep 30, 2017 8:43 am    Post subject: match a defect hadd disc sector to a logical volume Reply with quote

I do wonder if how to link these information
Code:
Sep 30 04:00:50 mr-fox kernel: [204681.608435] ata1.00: exception Emask 0x0 SAct 0x3fffe00 SErr 0x0 action 0x0
Sep 30 04:00:50 mr-fox kernel: [204681.608438] ata1.00: irq_stat 0x40000008
Sep 30 04:00:50 mr-fox kernel: [204681.608441] ata1.00: failed command: READ FPDMA QUEUED
Sep 30 04:00:50 mr-fox kernel: [204681.608446] ata1.00: cmd 60/08:48:00:27:b0/00:00:fd:00:00/40 tag 9 ncq dma 4096 in
Sep 30 04:00:50 mr-fox kernel: [204681.608446]          res 41/40:08:00:27:b0/00:00:fd:00:00/00 Emask 0x409 (media error) <F>
Sep 30 04:00:50 mr-fox kernel: [204681.608448] ata1.00: status: { DRDY ERR }
Sep 30 04:00:50 mr-fox kernel: [204681.608449] ata1.00: error: { UNC }
Sep 30 04:00:50 mr-fox kernel: [204681.650337] ata1.00: configured for UDMA/133
Sep 30 04:00:50 mr-fox kernel: [204681.650367] sd 0:0:0:0: [sda] tag#9 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Sep 30 04:00:50 mr-fox kernel: [204681.650370] sd 0:0:0:0: [sda] tag#9 Sense Key : Medium Error [current]
Sep 30 04:00:50 mr-fox kernel: [204681.650373] sd 0:0:0:0: [sda] tag#9 Add. Sense: Unrecovered read error - auto reallocate failed
Sep 30 04:00:50 mr-fox kernel: [204681.650377] sd 0:0:0:0: [sda] tag#9 CDB: Read(16) 88 00 00 00 00 00 fd b0 27 00 00 00 00 08 00 00
Sep 30 04:00:50 mr-fox kernel: [204681.650380] print_req_error: I/O error, dev sda, sector 4256179968
Sep 30 04:00:50 mr-fox kernel: [204681.650416] ata1: EH complete
Sep 30 08:08:17 mr-fox kernel: [219528.685520] ata1.00: exception Emask 0x0 SAct 0x1f000 SErr 0x0 action 0x0
Sep 30 08:08:17 mr-fox kernel: [219528.685521] ata1.00: irq_stat 0x40000008
Sep 30 08:08:17 mr-fox kernel: [219528.685524] ata1.00: failed command: READ FPDMA QUEUED
Sep 30 08:08:17 mr-fox kernel: [219528.685527] ata1.00: cmd 60/08:60:00:27:b0/00:00:fd:00:00/40 tag 12 ncq dma 4096 in
Sep 30 08:08:17 mr-fox kernel: [219528.685527]          res 41/40:08:00:27:b0/00:00:fd:00:00/00 Emask 0x409 (media error) <F>
Sep 30 08:08:17 mr-fox kernel: [219528.685528] ata1.00: status: { DRDY ERR }
Sep 30 08:08:17 mr-fox kernel: [219528.685529] ata1.00: error: { UNC }
Sep 30 08:08:17 mr-fox kernel: [219528.712999] ata1.00: configured for UDMA/133
Sep 30 08:08:17 mr-fox kernel: [219528.713028] sd 0:0:0:0: [sda] tag#12 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Sep 30 08:08:17 mr-fox kernel: [219528.713032] sd 0:0:0:0: [sda] tag#12 Sense Key : Medium Error [current]
Sep 30 08:08:17 mr-fox kernel: [219528.713034] sd 0:0:0:0: [sda] tag#12 Add. Sense: Unrecovered read error - auto reallocate failed
Sep 30 08:08:17 mr-fox kernel: [219528.713039] sd 0:0:0:0: [sda] tag#12 CDB: Read(16) 88 00 00 00 00 00 fd b0 27 00 00 00 00 08 00 00
Sep 30 08:08:17 mr-fox kernel: [219528.713041] print_req_error: I/O error, dev sda, sector 4256179968
Sep 30 08:08:17 mr-fox kernel: [219528.713071] ata1: EH complete
to the logical volume which contains that bad sectors ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43753
Location: 56N 3W

PostPosted: Sat Sep 30, 2017 9:51 am    Post subject: Reply with quote

toralf,

Code:
sudo /sbin/lvdisplay -m
will tell where the physical extents are. For example,
Code:
  --- Logical volume ---
  LV Path                /dev/vg/distfiles
  LV Name                distfiles
  VG Name                vg
  LV UUID                9kooid-V9xw-nQxX-nWfc-1sN8-BnmL-Nl9GNT
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 1
  LV Size                120.00 GiB
  Current LE             30720
  Segments               4
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     768
  Block device           253:6
   
  --- Segments ---
  Logical extents 0 to 7679:
    Type      linear
    Physical volume   /dev/md127
    Physical extents   26368 to 34047
   
  Logical extents 7680 to 15359:
    Type      linear
    Physical volume   /dev/md127
    Physical extents   327936 to 335615
   
  Logical extents 15360 to 23039:
    Type      linear
    Physical volume   /dev/md127
    Physical extents   343680 to 351359
   
  Logical extents 23040 to 30719:
    Type      linear
    Physical volume   /dev/md127
    Physical extents   479872 to 487551


Physical extents are usually 4MiB, unless you changed it and count from the start (approx) of the physical volume they are located on. There is some LVM meta data around somewhere but I'm not sure where.

Code:
sudo /sbin/pvdisplay -m
shows your physical extent mapping and physical extent size.

Your
Code:
 I/O error, dev sda, sector 4256179968
counts 512B sectors starting at sector 0 at the start of the drive.

You can also dd logical volumes to /dev/null and see where it fails with the same error but that's a bit of a blunt instrument.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3706
Location: Hamburg

PostPosted: Sat Sep 30, 2017 12:37 pm    Post subject: Reply with quote

ah, cool, so
Code:
 expr 4256179968 / 2 / 1024 / 4
gives me the 4MB block number - which is indeed at that logical volume which is suspicious in my mind. Thx !
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43753
Location: 56N 3W

PostPosted: Sat Sep 30, 2017 3:09 pm    Post subject: Reply with quote

toralf,

Don't forget the offset from the start of the disk to the start of the physical volume.
That could be 1MiB if the PV starts on the first partition.
It can be a lot more if it starts further down the volume.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3706
Location: Hamburg

PostPosted: Sat Sep 30, 2017 3:39 pm    Post subject: Reply with quote

NeddySeagoon wrote:
toralf,

Don't forget the offset from the start of the disk to the start of the physical volume.
That could be 1MiB if the PV starts on the first partition.
It can be a lot more if it starts further down the volume.

Yeah, thx. My plan :
I do have 2 x 2.3 TB in 1 VG having 2 LV spawning over 2 physical disks. Fortunately the 2 bad sectors are near together. So with deleting the affected LV, creating 3 new LVs, where the middle has about 40-50 K extends each having 4 MB == 200 GB all bad sectors should belong to that LV. Then I'll delete the 1st and the 3rd LV and create a new LV with the size of the former two LVs.
By that I should handle that bad sector problem I hope.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43753
Location: 56N 3W

PostPosted: Sat Sep 30, 2017 4:48 pm    Post subject: Reply with quote

toralf,

You can force a write to the bad sectors, as long as you don't care about the lost data.
The write will either succeed to the currently unreadable physical sector, or the drive will find that it can't write there either, and remap the failed sector.

Unreadable sectors are supposed to be remapped before they become unreadable.
Code:
smartctl -a /dev/<dying_drive>
may be useful too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
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