meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
datarecovery:lvm [2023/01/27 07:45] – created niziakdatarecovery:lvm [2023/01/28 18:52] (current) niziak
Line 10: Line 10:
 <code bash> <code bash>
 journalctl | grep 'dev sda, sector' | cut -d ' ' -f 12 | sort | uniq journalctl | grep 'dev sda, sector' | cut -d ' ' -f 12 | sort | uniq
 +
 +82053408
 +85981440
 +85981536
 +85981544
 +85981552
 +85981560
 +85981568
 +85981696
 +85981704
 +85981712
 +85981720
 +85981728
 +85981736
 +85981744
 +85981752
 +85984832
 +85984840
 +85984848
 +85984856
 +85984864
 +85984872
 +85984880
 +85984888
 +85984896
 +85984904
 +85984928
 +
 </code> </code>
  
Line 19: Line 47:
   40 51 08 a0 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006a0 = 85984928   40 51 08 a0 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006a0 = 85984928
   40 51 80 80 06 20 e5  Error: UNC 128 sectors at LBA = 0x05200680 = 85984896   40 51 80 80 06 20 e5  Error: UNC 128 sectors at LBA = 0x05200680 = 85984896
 +</code>
 +
 +<code bash>
 +Disk /dev/sda: 111,79 GiB, 120034123776 bytes, 234441648 sectors
 +Disk model: KINGSTON SA400S3
 +Units: sectors of 1 * 512 = 512 bytes
 +Sector size (logical/physical): 512 bytes / 512 bytes
 +I/O size (minimum/optimal): 512 bytes / 512 bytes
 +Disklabel type: gpt
 +Disk identifier: 711FEF16-FBD0-45BB-BA56-52B93B733D8E
 +
 +Device       Start       End   Sectors   Size Type
 +/dev/sda1       34      2047      2014  1007K BIOS boot
 +/dev/sda2     2048   1050623   1048576   512M EFI System
 +/dev/sda3  1050624 234441614 233390991 111,3G Linux LVM
 +</code>
 +
 +Calculate LVM position for bad sector ''85984896'' by substract Start section
 +85984896 - 1050624 = 84934272
 +
 +Get PE size <code bash>pvdisplay /dev/sda3</code>, it is 4M, so 4096.
 +
 +LBA block (secotr) size is 512, so each PE takes 8192 sectors.
 +
 +
 +The same information you can found in:
 +<code bash>
 +# cat /etc/lvm/backup/pve | grep extent_size
 + extent_size = 8192 # 4 Megabytes
 +# cat /etc/lvm/backup/pve | grep pe_start
 + pe_start = 2048
 +</code>
 +
 +<code bash>
 +echo 84934272 / 8192 | bc
 +10367
 +</code>
 +
 +Region is used by thin provisioning:
 +
 +pvdisplay -v -m
 +
 +  Physical extent 8128 to 24425:
 +    Logical volume /dev/pve/data_tdata
 +    Logical extents 0 to 16297
 +
 +
 +!!! DONT KNOW HOW TO REMAP LVM SECTORS
 +
 +
 +lvcreate -l1 pve -n bb85984896 /dev/sda3:10367
 +
 +
 +===== Zeroing sectors =====
 +
 +Confirm that sector read fails:
 +
 +<code bash>
 +dd if=/dev/sda of=/tmp/dump.raw bs=512 count=1 skip=85981696
 +hdparm --read-sector 85981696 /dev/sda
 +hdparm --write-sector 85981696 --yes-i-know-what-i-am-doing  /dev/sda
 +</code>
 +
 +
 +
 +  40 51 08 b8 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006b8 = 85984952..85984959
 +  40 51 08 b0 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006b0 = 85984944..85984951
 +  40 51 08 a8 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006a8 = 85984936..85984943
 +  40 51 08 a0 06 20 e5  Error: UNC 8 sectors at LBA = 0x052006a0 = 85984928..85984935
 +  40 51 80 80 06 20 e5  Error: UNC 128 sectors at LBA = 0x05200680 = 85984896  to 85985023
 +
 +<code bash>
 +for i in {85984896..85985023}; do echo $i; hdparm --write-sector $i --yes-i-know-what-i-am-doing  /dev/sda; don
 </code> </code>