Recovery ext4 partition and "read error"

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
alfcas
Posts: 3
Joined: 03 Jun 2016, 08:01

Recovery ext4 partition and "read error"

#1 Post by alfcas »

I have an HD on laptop Sony Vaio whith dual boot Linux Debian and Windows 8.1.
Afterwards the upgrade from Windows 8.1 to Windows 10, I'm not able to access in neither of two OS, I can only boot into Linux rescue mode
With Testdisk I can access to the data in Windows partition and Linux root partition, but not to the data in Linux home partition,
the error is: "Can't open filesystem. Filesystem seems damaged."
I also tried, without success, to repair the broken Ext4 Superblock with this guide: https://linuxexpresso.wordpress.com/201 ... in-ubuntu/

Any hypothesis about this incident? What's Windows 10 made to the partitions?
What can I do to access the data in the "Linux home partition" ?


In previous executions of TestDisk I recieved an error like this: "Read error at x/y/z (lba=n)"
Can I continue to use this HD in the future or should I buy a new one? There is a way to exclude a bad sector?


This is the content of testdisk.log (I was not able to attach as file, because error from forum)

Code: Select all



Fri Jun  3 09:42:56 2016
Command line: TestDisk

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 3.9.11 (#1 SMP Sat Jul 27 19:40:54 GMT-8 2013) i686
Compiler: GCC 4.4
Compilation date: 2015-04-18T13:03:42
ext2fs lib: 1.42.8, ntfs lib: libntfs-3g, reiserfs lib: 0.3.1-rc8, ewf lib: 20120504, curses lib: ncurses 5.7
/dev/sda: LBA, HPA, LBA48, DCO support
/dev/sda: size       1465149168 sectors
/dev/sda: user_max   1465149168 sectors
/dev/sda: native_max 1465149168 sectors
/dev/sda: dco        1465149168 sectors
Hard disk list
Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63, sector size=512 - ST750LM022 HN-M750MBB, S/N:S2UJJ9ED201467, FW:2AR10002
Disk /dev/sdb - 2040 MB / 1946 MiB - CHS 1020 63 62, sector size=512 - Myson SD/MMC/MS Reader, FW:1.00
Disk /dev/sdc - 15 GB / 14 GiB - CHS 14832 64 32, sector size=512 - KINGSTON DataTraveler 3.0, FW:1.01
Disk /dev/sdd - 500 GB / 465 GiB - CHS 60801 255 63, sector size=512 - ST500LM0 12 HN-M500MB, FW:2AR1

Partition table type (auto): EFI GPT
Disk /dev/sda - 750 GB / 698 GiB - ST750LM022 HN-M750MBB
Partition table type: EFI GPT

Interface Advanced
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=1465149167 (expected 1465149167) 
hdr_lba_start=34
hdr_lba_end=1465149134
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
check_part_gpt failed for partition
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 1 P Unknown                     2048     534527     532480 [EFI system partition]
 2 P Unknown                   534528    3553279    3018752 [Basic data partition]
 3 P EFI System               3553280    4085759     532480 [EFI system partition]
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 5 P MS Data                  4347904  321740082  317392179 [Basic data partition]
     NTFS, blocksize=4096, 162 GB / 151 GiB
 6 P Unknown                321740800  323452927    1712128
 7 P Unknown                323452928  368590847   45137920
 8 P Unknown                368590848  374450175    5859328
 9 P Linux Swap             374450176  390731775   16281600
10 P Unknown                390731776  391512063     780288
11 P Unknown                391512064 1408892927 1017380864
12 P Unknown               1408892928 1465147391   56254464 [Basic data partition]
gpt_change_part_type
Change partition type:
 1 P EFI System                  2048     534527     532480 [EFI system partition]
Change partition type:
 1 P Unknown                     2048     534527     532480 [EFI system partition]
New geometry
Disk /dev/sda - 750 GB / 698 GiB - CHS 11401 255 63 sector_size=4096

Interface Advanced
Bad GPT partition, invalid signature.
Trying alternate GPT

Interface Advanced
Bad GPT partition, invalid signature.
Trying alternate GPT
New geometry
Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63 sector_size=512

Interface Advanced
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=1465149167 (expected 1465256519)
hdr_lba_start=34
hdr_lba_end=1465149134
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
check_part_gpt failed for partition
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 1 P Unknown                     2048     534527     532480 [EFI system partition]
 2 P Unknown                   534528    3553279    3018752 [Basic data partition]
 3 P EFI System               3553280    4085759     532480 [EFI system partition]
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 5 P MS Data                  4347904  321740082  317392179 [Basic data partition]
     NTFS, blocksize=4096, 162 GB / 151 GiB
 6 P Unknown                321740800  323452927    1712128
 7 P Unknown                323452928  368590847   45137920
 8 P Unknown                368590848  374450175    5859328
 9 P Linux Swap             374450176  390731775   16281600
10 P Unknown                390731776  391512063     780288
11 P Unknown                391512064 1408892927 1017380864
12 P Unknown               1408892928 1465147391   56254464 [Basic data partition]

Analyse Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=1465149167 (expected 1465256519)
hdr_lba_start=34
hdr_lba_end=1465149134
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
check_part_gpt failed for partition
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
Current partition structure:
 1 P Unknown                     2048     534527     532480 [EFI system partition]
 2 P Unknown                   534528    3553279    3018752 [Basic data partition]
 3 P EFI System               3553280    4085759     532480 [EFI system partition]
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 5 P MS Data                  4347904  321740082  317392179 [Basic data partition]
 6 P Unknown                321740800  323452927    1712128
 7 P Unknown                323452928  368590847   45137920
 8 P Unknown                368590848  374450175    5859328
 9 P Linux Swap             374450176  390731775   16281600
10 P Unknown                390731776  391512063     780288
11 P Unknown                391512064 1408892927 1017380864
12 P Unknown               1408892928 1465147391   56254464 [Basic data partition]

search_part()
Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63
FAT32 at 0/32/33
FAT1 : 7166-7678
FAT2 : 7679-8191
start_rootdir : 8192 root cluster : 2
Data : 8192-532479
sectors : 532480
cluster_size : 8
no_of_cluster : 65536 (2 - 65537)
fat_length 513 calculated 513

FAT32 at 0/32/33
     MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=273678336, part_size=1545601024, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
FAT32 at 221/46/18
FAT1 : 8318-12350
FAT2 : 12351-16383
start_rootdir : 16384 root cluster : 2
Data : 16384-532479
sectors : 532480
cluster_size : 1
no_of_cluster : 516096 (2 - 516097)
fat_length 4033 calculated 4033
set_FAT_info: name from BS used

FAT32 at 221/46/18
     MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=2226126848, part_size=162504795648, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB

recover_EXT2: s_block_group_nr=0/172, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8064
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 5642240
recover_EXT2: part_size 45137920
     MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB

recover_EXT2: s_block_group_nr=0/22, s_mnt_count=445/4294967295, s_blocks_per_group=32768, s_inodes_per_group=7968
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 732416
recover_EXT2: part_size 5859328
     MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
     Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB

recover_EXT2: s_block_group_nr=0/47, s_mnt_count=4/4294967295, s_blocks_per_group=8192, s_inodes_per_group=2032
recover_EXT2: s_blocksize=1024
recover_EXT2: s_blocks_count 390144
recover_EXT2: part_size 780288
     MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
file_pread(4,16,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512065(24370/127/15)) read err: Input/output error
file_pread(4,14,buffer,391512066(24370/127/16)) read err: Input/output error
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB
Search for partition aborted

Results
   P MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
   P MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
   P MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB
   P MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB
   P MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
   P Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB
   P MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB

Hint for advanced users. dmsetup may be used if you prefer to avoid to rewrite the partition table for the moment:
echo "0 532480 linear /dev/sda 2048" | dmsetup create test0
echo "0 3018752 linear /dev/sda 534528" | dmsetup create test1
echo "0 532480 linear /dev/sda 3553280" | dmsetup create test2
echo "0 317392179 linear /dev/sda 4347904" | dmsetup create test3
echo "0 1712128 linear /dev/sda 320028673" | dmsetup create test4
echo "0 1712128 linear /dev/sda 321740800" | dmsetup create test5
echo "0 45137920 linear /dev/sda 323452928" | dmsetup create test6
echo "0 5859328 linear /dev/sda 368590848" | dmsetup create test7
echo "0 16281584 linear /dev/sda 374450176" | dmsetup create test8
echo "0 780288 linear /dev/sda 390731776" | dmsetup create test9
echo "0 56254464 linear /dev/sda 1352638465" | dmsetup create test10
echo "0 56254464 linear /dev/sda 1408892928" | dmsetup create test11

interface_write()
 1 P MS Data                     2048     534527     532480 [SONYSYS]
 2 P MS Data                   534528    3553279    3018752
 3 P MS Data                  3553280    4085759     532480 [NO NAME]
 4 P MS Data                323452928  368590847   45137920
 5 P MS Data                368590848  374450175    5859328
 6 P Linux Swap             374450176  390731759   16281584
 7 P MS Data                390731776  391512063     780288
simulate write!

Analyse Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=1465149167 (expected 1465256519)
hdr_lba_start=34
hdr_lba_end=1465149134
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
check_part_gpt failed for partition
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
Current partition structure:
 1 P Unknown                     2048     534527     532480 [EFI system partition]
 2 P Unknown                   534528    3553279    3018752 [Basic data partition]
 3 P EFI System               3553280    4085759     532480 [EFI system partition]
No FAT, NTFS, ext2, JFS, Reiser, cramfs or XFS marker
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 5 P MS Data                  4347904  321740082  317392179 [Basic data partition]
 6 P Unknown                321740800  323452927    1712128
 7 P Unknown                323452928  368590847   45137920
 8 P Unknown                368590848  374450175    5859328
 9 P Linux Swap             374450176  390731775   16281600
10 P Unknown                390731776  391512063     780288
11 P Unknown                391512064 1408892927 1017380864
12 P Unknown               1408892928 1465147391   56254464 [Basic data partition]

search_part()
Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63
FAT32 at 0/32/33
FAT1 : 7166-7678
FAT2 : 7679-8191
start_rootdir : 8192 root cluster : 2
Data : 8192-532479
sectors : 532480
cluster_size : 8
no_of_cluster : 65536 (2 - 65537)
fat_length 513 calculated 513

FAT32 at 0/32/33
     MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=273678336, part_size=1545601024, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
FAT32 at 221/46/18
FAT1 : 8318-12350
FAT2 : 12351-16383
start_rootdir : 16384 root cluster : 2
Data : 16384-532479
sectors : 532480
cluster_size : 1
no_of_cluster : 516096 (2 - 516097)
fat_length 4033 calculated 4033
set_FAT_info: name from BS used

FAT32 at 221/46/18
     MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=2226126848, part_size=162504795648, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB

recover_EXT2: s_block_group_nr=0/172, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8064
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 5642240
recover_EXT2: part_size 45137920
     MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB

recover_EXT2: s_block_group_nr=0/22, s_mnt_count=445/4294967295, s_blocks_per_group=32768, s_inodes_per_group=7968
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 732416
recover_EXT2: part_size 5859328
     MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
     Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB

recover_EXT2: s_block_group_nr=0/47, s_mnt_count=4/4294967295, s_blocks_per_group=8192, s_inodes_per_group=2032
recover_EXT2: s_blocksize=1024
recover_EXT2: s_blocks_count 390144
recover_EXT2: part_size 780288
     MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
file_pread(4,16,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512065(24370/127/15)) read err: Input/output error
file_pread(4,14,buffer,391512066(24370/127/16)) read err: Input/output error
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB
Search for partition aborted

Results
   P MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
   P MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
   P MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB
   P MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB
   P MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
   P Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB
   P MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB

Hint for advanced users. dmsetup may be used if you prefer to avoid to rewrite the partition table for the moment:
echo "0 532480 linear /dev/sda 2048" | dmsetup create test0
echo "0 3018752 linear /dev/sda 534528" | dmsetup create test1
echo "0 532480 linear /dev/sda 3553280" | dmsetup create test2
echo "0 317392179 linear /dev/sda 4347904" | dmsetup create test3
echo "0 1712128 linear /dev/sda 320028673" | dmsetup create test4
echo "0 1712128 linear /dev/sda 321740800" | dmsetup create test5
echo "0 45137920 linear /dev/sda 323452928" | dmsetup create test6
echo "0 5859328 linear /dev/sda 368590848" | dmsetup create test7
echo "0 16281584 linear /dev/sda 374450176" | dmsetup create test8
echo "0 780288 linear /dev/sda 390731776" | dmsetup create test9
echo "0 56254464 linear /dev/sda 1352638465" | dmsetup create test10
echo "0 56254464 linear /dev/sda 1408892928" | dmsetup create test11

interface_write()
 1 P MS Data                     2048     534527     532480 [SONYSYS]
 2 P MS Data                   534528    3553279    3018752
 3 P MS Data                  3553280    4085759     532480 [NO NAME]
 4 P MS Data                323452928  368590847   45137920
 5 P MS Data                368590848  374450175    5859328
 6 P Linux Swap             374450176  390731759   16281584
 7 P MS Data                390731776  391512063     780288

search_part()
Disk /dev/sda - 750 GB / 698 GiB - CHS 91208 255 63
FAT32 at 0/32/33
FAT1 : 7166-7678
FAT2 : 7679-8191
start_rootdir : 8192 root cluster : 2
Data : 8192-532479
sectors : 532480
cluster_size : 8
no_of_cluster : 65536 (2 - 65537)
fat_length 513 calculated 513

FAT32 at 0/32/33
     MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
FAT32 at 0/32/39
FAT1 : 7166-7678
FAT2 : 7679-8191
start_rootdir : 8192 root cluster : 2
Data : 8192-532479
sectors : 532480
cluster_size : 8
no_of_cluster : 65536 (2 - 65537)
fat_length 513 calculated 513
FAT differs, FAT sectors=496-512/513
set_FAT_info: name from BS used

FAT32 at 0/32/39
     MS Data                     2048     534527     532480 [NO NAME]
     FAT32, blocksize=4096, 272 MB / 260 MiB
FAT32 at 0/32/39
FAT1 : 7166-7678
FAT2 : 7679-8191
start_rootdir : 8192 root cluster : 2
Data : 8192-532479
sectors : 532480
cluster_size : 8
no_of_cluster : 65536 (2 - 65537)
fat_length 513 calculated 513
FAT differs, FAT sectors=496-512/513
set_FAT_info: name from BS used

FAT32 at 0/32/39
     MS Data                     2054     534533     532480 [NO NAME]
     FAT32, blocksize=4096, 272 MB / 260 MiB
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=273678336, part_size=1545601024, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 33/69/37
filesystem size           3018752
sectors_per_cluster       8
mft_lcn                   125781
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
FAT32 at 221/46/18
FAT1 : 8318-12350
FAT2 : 12351-16383
start_rootdir : 16384 root cluster : 2
Data : 16384-532479
sectors : 532480
cluster_size : 1
no_of_cluster : 516096 (2 - 516097)
fat_length 4033 calculated 4033
set_FAT_info: name from BS used

FAT32 at 221/46/18
     MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
NTFS part_offset=2226126848, part_size=162504795648, sector_size=512
NTFS partition cannot be added (part_offset<part_size).
NTFS at 270/164/23
filesystem size           317392179
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
NTFS at 20027/111/53
filesystem size           1712128
sectors_per_cluster       8
mft_lcn                   71338
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB

recover_EXT2: s_block_group_nr=0/172, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8064
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 5642240
recover_EXT2: part_size 45137920
     MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB

recover_EXT2: s_block_group_nr=0/22, s_mnt_count=445/4294967295, s_blocks_per_group=32768, s_inodes_per_group=7968
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 732416
recover_EXT2: part_size 5859328
     MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
     Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB

recover_EXT2: s_block_group_nr=0/47, s_mnt_count=4/4294967295, s_blocks_per_group=8192, s_inodes_per_group=2032
recover_EXT2: s_blocksize=1024
recover_EXT2: s_blocks_count 390144
recover_EXT2: part_size 780288
     MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
file_pread(4,16,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512064(24370/127/14)) read err: Input/output error
file_pread(4,1,buffer,391512065(24370/127/15)) read err: Input/output error
file_pread(4,14,buffer,391512066(24370/127/16)) read err: Input/output error
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
NTFS at 87699/134/52
filesystem size           56254464
sectors_per_cluster       8
mft_lcn                   786432
mftmirr_lcn               2
clusters_per_mft_record   -10
clusters_per_index_record 1
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB
Search for partition aborted

Results
     MS Data                     2048     534527     532480 [SONYSYS]
     FAT32, blocksize=4096, 272 MB / 260 MiB
     MS Data                     2054     534533     532480 [NO NAME]
     FAT32, blocksize=4096, 272 MB / 260 MiB
     MS Data                   534528    3553279    3018752
     NTFS, blocksize=4096, 1545 MB / 1474 MiB
   P MS Data                  3553280    4085759     532480 [NO NAME]
     FAT32, blocksize=512, 272 MB / 260 MiB
     MS Data                  4347904  321740082  317392179
     NTFS, blocksize=4096, 162 GB / 151 GiB
     MS Data                320028673  321740800    1712128
     NTFS found using backup sector, blocksize=4096, 876 MB / 836 MiB
     MS Data                321740800  323452927    1712128
     NTFS, blocksize=4096, 876 MB / 836 MiB
   P MS Data                323452928  368590847   45137920
     ext4 blocksize=4096 Large_file Sparse_SB, 23 GB / 21 GiB
   P MS Data                368590848  374450175    5859328
     ext4 blocksize=4096 Large_file Sparse_SB, 2999 MB / 2861 MiB
   P Linux Swap             374450176  390731759   16281584
     SWAP2 version 1, pagesize=4096, 8336 MB / 7949 MiB
   P MS Data                390731776  391512063     780288
     ext4 blocksize=1024 Sparse_SB, 399 MB / 381 MiB
     MS Data               1352638465 1408892928   56254464
     NTFS found using backup sector, blocksize=4096, 28 GB / 26 GiB
     MS Data               1408892928 1465147391   56254464
     NTFS, blocksize=4096, 28 GB / 26 GiB

Hint for advanced users. dmsetup may be used if you prefer to avoid to rewrite the partition table for the moment:
echo "0 532480 linear /dev/sda 2048" | dmsetup create test0
echo "0 532480 linear /dev/sda 2054" | dmsetup create test1
echo "0 3018752 linear /dev/sda 534528" | dmsetup create test2
echo "0 532480 linear /dev/sda 3553280" | dmsetup create test3
echo "0 317392179 linear /dev/sda 4347904" | dmsetup create test4
echo "0 1712128 linear /dev/sda 320028673" | dmsetup create test5
echo "0 1712128 linear /dev/sda 321740800" | dmsetup create test6
echo "0 45137920 linear /dev/sda 323452928" | dmsetup create test7
echo "0 5859328 linear /dev/sda 368590848" | dmsetup create test8
echo "0 16281584 linear /dev/sda 374450176" | dmsetup create test9
echo "0 780288 linear /dev/sda 390731776" | dmsetup create test10
echo "0 56254464 linear /dev/sda 1352638465" | dmsetup create test11
echo "0 56254464 linear /dev/sda 1408892928" | dmsetup create test12

interface_write()
 1 P MS Data                  3553280    4085759     532480 [NO NAME]
 2 P MS Data                323452928  368590847   45137920
 3 P MS Data                368590848  374450175    5859328
 4 P Linux Swap             374450176  390731759   16281584
 5 P MS Data                390731776  391512063     780288
simulate write!

Interface Advanced
hdr_size=92
hdr_lba_self=1
hdr_lba_alt=1465149167 (expected 1465256519)
hdr_lba_start=34
hdr_lba_end=1465149134
hdr_lba_table=2
hdr_entries=128
hdr_entsz=128
check_part_gpt failed for partition
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 1 P Unknown                     2048     534527     532480 [EFI system partition]
 2 P Unknown                   534528    3553279    3018752 [Basic data partition]
 3 P EFI System               3553280    4085759     532480 [EFI system partition]
 4 P MS Reserved              4085760    4347903     262144 [Microsoft reserved partition]
 5 P MS Data                  4347904  321740082  317392179 [Basic data partition]
     NTFS, blocksize=4096, 162 GB / 151 GiB
 6 P Unknown                321740800  323452927    1712128
 7 P Unknown                323452928  368590847   45137920
 8 P Unknown                368590848  374450175    5859328
 9 P Linux Swap             374450176  390731775   16281600
10 P Unknown                390731776  391512063     780288
11 P Unknown                391512064 1408892927 1017380864
12 P Unknown               1408892928 1465147391   56254464 [Basic data partition]
gpt_change_part_type
Change partition type:
12 P Linux Reserved        1408892928 1465147391   56254464 [Basic data partition]
Change partition type:
12 P ext4                  1408892928 1465147391   56254464 [Basic data partition]
search_superblock

12 P Linux Reserved        1408892928 1465147391   56254464 [Basic data partition]
Can't open filesystem. Filesystem seems damaged.
gpt_change_part_type
Change partition type:
11 P Linux Reserved         391512064 1408892927 1017380864
Change partition type:
11 P ext4                   391512064 1408892927 1017380864
file_pread(4,16,buffer,391512066(24370/127/16)) read err: Input/output error
file_pread(4,1,buffer,391512066(24370/127/16)) read err: Input/output error

11 P Linux Reserved         391512064 1408892927 1017380864
Can't open filesystem. Filesystem seems damaged.
file_pread(4,1,buffer,391512067(24370/127/17)) read err: Input/output error

11 P Linux Reserved         391512064 1408892927 1017380864
Can't open filesystem. Filesystem seems damaged.
gpt_change_part_type
Change partition type:
10 P Linux Reserved         390731776  391512063     780288
Change partition type:
10 P ext4                   390731776  391512063     780288
search_superblock

recover_EXT2: s_block_group_nr=0/47, s_mnt_count=4/4294967295, s_blocks_per_group=8192, s_inodes_per_group=2032
recover_EXT2: s_blocksize=1024
recover_EXT2: s_blocks_count 390144
recover_EXT2: part_size 780288
Ext2 superblock found at sector 2 (block=1, blocksize=1024)
  MS Data                390731776  391512063     780288
superblock 0, blocksize=1024 []

To repair the filesystem using alternate superblock, run
fsck.ext4 -p -b superblock -B blocksize device


dir_partition inode=2
10 P Linux Reserved         390731776  391512063     780288
Directory /
       2 drwxrwxrwt     0      0      1024 28-May-2015 00:38 .
       2 drwxrwxrwt     0      0      1024 28-May-2015 00:38 ..
      11 drwxrwxrwt     0      0      1024 28-May-2015 00:37 .XIM-unix
      12 drwxrwxrwt     0      0      1024 28-May-2015 00:37 .Test-unix
      13 drwx------     0      0      1024 28-May-2015 00:37 pulse-PKdhtXMmr18n
      14 -r--r--r--     0      0        11 28-May-2015 00:37 .X0-lock
      15 -rw-------  1000   1000       406 28-May-2015 00:37 .xfsm-ICE-58R7YX
      17 drwx------     0      0      1024  2-Oct-2015 22:47 lost+found
    2033 drwx------  1000   1000      1024 28-May-2015 00:37 gpg-IiF4jS
    2034 drwx------  1000   1000      1024                   orbit-blufox
    4065 drwx------  1000   1000      1024 28-May-2015 00:38 tracker-extract-files.1000
   65025 drwxrwxrwt     0      0      1024 28-May-2015 00:37 .X11-unix
   65026 drwxrwxrwt     0      0      1024 28-May-2015 00:37 .ICE-unix
   65027 drwxrwxrwt     0      0      1024 28-May-2015 00:37 .font-unix
   65028 drwx------     0      0      1024 28-May-2015 00:37 systemd-private-6f32816f25d044f9b4db145a652518da-systemd-timesyncd.service-3UfGbY
   65030 drwx------     0      0      1024 28-May-2015 00:37 systemd-private-6f32816f25d044f9b4db145a652518da-cups.service-3NZa3d
   65032 drwx------     0      0      1024 28-May-2015 00:38 systemd-private-6f32816f25d044f9b4db145a652518da-rtkit-daemon.service-Bp8iGG
   65035 drwx------  1000   1000      1024 28-May-2015 00:37 ssh-oCFWYC4DhZ3Q
gpt_change_part_type
Change partition type:
 8 P Linux Reserved         368590848  374450175    5859328
Change partition type:
 8 P ext4                   368590848  374450175    5859328


dir_partition inode=2
 8 P Linux Reserved         368590848  374450175    5859328
Directory /
       2 drwxr-xr-x     0      0      4096 18-May-2015 20:39 .
       2 drwxr-xr-x     0      0      4096 18-May-2015 20:39 ..
      11 drwx------     0      0     16384 15-May-2015 21:00 lost+found
      12 drwxr-xr-x     0      0      4096 24-Dec-2015 06:53 lib
      16 drwxr-xr-x     0      0      4096 14-Mar-2016 02:23 cache
     192 drwxr-xr-x     0      0      4096  1-Jun-2016 03:19 log
     194 drwxrwxrwt     0      0      4096  3-Jun-2016 09:07 tmp
     195 drwxr-xr-x     0      0      4096 15-May-2015 21:38 spool
     196 drwxr-xr-x     0      0      4096 26-Apr-2016 23:56 backups
     197 lrwxrwxrwx     0      0         9 15-May-2015 21:01 lock
     198 lrwxrwxrwx     0      0         4 15-May-2015 21:01 run
     199 drwxrwsr-x     0     50      4096 30-Nov-2014 13:37 local
     242 drwxr-xr-x     0      0      4096 15-May-2015 21:01 opt
     243 drwxrwsr-x     0      8      4096  1-Jun-2016 03:19 mail
    9227 drwxr-xr-x     0      0      4096 18-May-2015 20:39 games

dir_partition inode=16
 8 P Linux Reserved         368590848  374450175    5859328
Directory /cache
      16 drwxr-xr-x     0      0      4096 14-Mar-2016 02:23 .
       2 drwxr-xr-x     0      0      4096 18-May-2015 20:39 ..
      17 drwxr-xr-x     0      0      4096 26-Apr-2016 14:30 apt
     190 drwxr-xr-x     0      0      4096 26-Apr-2016 14:30 debconf
     209 drwx------     0      0      4096 28-Mar-2016 20:07 ldconfig
    1821 drwxrwx---     0      7      4096  1-Jun-2016 11:48 cups
    1174 drwxr-sr-x     6      0      4096  1-Jun-2016 00:06 man
    6948 drwxr-xr-x     0      0      4096 15-May-2015 21:28 PackageKit
     149 drwx--x--x     0      0      4096 18-May-2015 20:42 lightdm
    1851 drwxr-xr-x     0      0      4096 15-May-2015 21:43 dictionaries-common
    5704 drwxr-xr-x     0      0      4096 15-May-2015 21:39 cracklib
    7825 drwxr-xr-x     0      0      4096 24-Nov-2015 13:27 fontconfig
    8167 drwxr-xr-x     0      0      4096  1-Oct-2014 19:16 realmd
X  15950 drwxr-xr-x     0      0      4096  3-Sep-2015 01:24 fonts.dpkg-new
   15950 drwxr-xr-x     0      0      4096  3-Sep-2015 01:24 fonts
    8714 d---------     0      0      4096 14-Mar-2016 02:23 system-tools-backends
Directory /
       2 drwxr-xr-x     0      0      4096 18-May-2015 20:39 .
       2 drwxr-xr-x     0      0      4096 18-May-2015 20:39 ..
      11 drwx------     0      0     16384 15-May-2015 21:00 lost+found
      12 drwxr-xr-x     0      0      4096 24-Dec-2015 06:53 lib
      16 drwxr-xr-x     0      0      4096 14-Mar-2016 02:23 cache
     192 drwxr-xr-x     0      0      4096  1-Jun-2016 03:19 log
     194 drwxrwxrwt     0      0      4096  3-Jun-2016 09:07 tmp
     195 drwxr-xr-x     0      0      4096 15-May-2015 21:38 spool
     196 drwxr-xr-x     0      0      4096 26-Apr-2016 23:56 backups
     197 lrwxrwxrwx     0      0         9 15-May-2015 21:01 lock
     198 lrwxrwxrwx     0      0         4 15-May-2015 21:01 run
     199 drwxrwsr-x     0     50      4096 30-Nov-2014 13:37 local
     242 drwxr-xr-x     0      0      4096 15-May-2015 21:01 opt
     243 drwxrwsr-x     0      8      4096  1-Jun-2016 03:19 mail
    9227 drwxr-xr-x     0      0      4096 18-May-2015 20:39 games

TestDisk exited normally.

Thank you for you time.

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Recovery ext4 partition and "read error"

#2 Post by cgrenier »

Due to the bad sectors, it's better to get a new disk.
Under Linux, you can use gnu ddrescue to clone the bad disk to a new one. Once it's done, remove the bad disk and try to recover your data from the clone.
Good luck

alfcas
Posts: 3
Joined: 03 Jun 2016, 08:01

Re: Recovery ext4 partition and "read error"

#3 Post by alfcas »

Finally I cloned the broken partition (not whole disk) with ddrescue.
In order to mount this file as file system I need to know the offset of where the partition start (correct ?)
I tried those ways:
- mmls image_file -b
- file -s image_file
- fdisk -ul

No success.
Please lead me. I'm going mad.

alfcas
Posts: 3
Joined: 03 Jun 2016, 08:01

Re: Recovery ext4 partition and "read error"

#4 Post by alfcas »

I solved the problem.
As I Understand the problem was strictly related to the file-system.
As reported in the man of mkfs.ext4, the following command option is last-ditch recovery method.
1) mkfs.ext4 -S <device>
2) fsck.ext4 <device>
3) run testdisk
4) advanced option
5) select the type of the partition
6) superblock
7) list
THE FILES APPEARED !!! :D

I try also to repair definitively the file-system with this command, but without success.
fsck.ext4 -p -b superblock -B blocksize device

Thank you Testdisk

Locked