ddrescue map file bad sectors position counting

If hdd failed and image recovered by ddrescue, might be necessary to know the failed sectors positions.
For example hdd failed and recover by ddrescue /dev/sdd /dev/null /root/1tb.log –force
log
its content:

# Rescue Logfile. Created by GNU ddrescue version 1.19
# Command line: ddrescue /dev/sdd /dev/null /root/1tb-hitachibad.log –force
# Start time: 2017-02-02 11:42:02
# Current time: 2017-02-02 14:13:53
# Finished
# current_pos current_status
0xE8C25C2C00 +
# pos size status
0x00000000 0xE8C25C2000 +

0xE8C25C2000 0x00001000 –
0xE8C25C3000 0x1E7F3000 +

status “-” tells bad data.
what does the 0xE8C25C2000 mean?
this is the byte position in hex.

if you need dec the formula is such:
we need to convert per byte to dec

0xE8= (dec)232
0xC2= (dec)194 …

0x00*256^0+0x20*256^1+0x5C*256^2+0xC2*256^3+0xE8*256^4=
0*256^0+32*256^1+92*256^2+194*256^3+232*256^4=
0+8192+6029312+3254779904+996432412672=
999693230080(byte)

256(or 0xFF, or from 0 to 255) is multiplier for hundreds in HEX, like 100 in Decimal.
So, byte 999693230080 is a start of faulty byte with length (0x1000 = 0x00*256^0+0x10*256^1 = 4096) bytes.
Faulty sector can be calculated with dividing it by 512 or 4096 (depends on hard drive)

This entry was posted in Administration, hardware, Linux/Unix. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *