partition recovery for a raspberry disk

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
Post Reply
Message
Author
tom1689494
Posts: 4
Joined: 18 Nov 2025, 12:33

partition recovery for a raspberry disk

#1 Post by tom1689494 »

hello,


First of all, thanks a lot for this forum and for any clue that could be provided as I'm all new to this utility and kind of issues.

The issue is on a raspberry disk which was created by the raspberry imager on a microSD card.
It used to display two main partitions:
bootfs
rootfs

The rootfs partition somehow got corrupted.
Now, when reading the card with a usb card reader on a different linux system, the first partition and its files are still readable but the second partition is not recognized and not even mountable any longer.

The objective is to recover this partition - and its files...

I followed the step by step document but I'm struggling to recover the partition as quick search and deep search don't find the expected partitioning.
Also, the raspberry partitions look a bit odd.

I created a new raspberry system with the raspberry imager to be able to compare. It's created on an sdcard with the same capacity and same manufacturer so it's expected to display the expected partitioning info...
Testdisk gives the following information "Bad relative sector" for the clean new disk using the default "intel" setting whereas the system does work (ie it boots correctly in a raspberry device and the filesystem is ok):

Code: Select all

Current partition structure:
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]

Bad relative sector.
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]

Bad relative sector.
No partition is bootable

Also, I don't understand the superblocks structure of the raspberry as it lists only "superblock 0", so it is unclear which superblock would have to be recovered when this step is reached:

here are the superblocks of the second partition of the clean new system:

Code: Select all

Ext2 superblock found at sector 21233664 (block=2654208, blocksize=4096)
  Linux                  260   0  1 60905  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  388   0  1 61033  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  644   0  1 61289  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  900   0  1 61545  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1156   0  1 61801  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1412   0  1 62057  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3460   0  1 64105  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3716   0  1 64361  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 6532   0  1 67177  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                10628   0  1 71273  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]

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

TestDisk exited normally.

So I've got two questions please:
  • 1. Would it be technically possible to copy the boot sector dump of the clean new system onto the corrupted system? What would be the steps? (PSB the boot sector dumps in the testdisk log for both a clean new raspberry and the corrupted one)
    2. assuming the partition info gets fixed, which superblock could be used for recovery? (PSB the superblocks analysis in the testdisk log for both a clean new raspberry and the corrupted one)

Here the testdisk log of the corrupted disk (the deeper search was skipped in this instance to focus on boot sector dump and superblocks):

Code: Select all

Tue Nov 18 10:25:08 2025
Command line: TestDisk

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org
OS: Linux, kernel 6.11.0-17-generic (#17~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 20 22:48:29 UTC 2) x86_64
Compiler: GCC 13.2
ext2fs lib: 1.47.0, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.4
/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
Warning: can't get size for Disk /dev/mapper/control - 0 B - 0 sectors, sector size=512
Warning: can't get size for Disk /dev/loop14 - 0 B - 0 sectors, sector size=512
Hard disk list
Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63, sector size=512 - Hitachi
Disk /dev/sdb - 7927 MB / 7560 MiB - 15482880 sectors, sector size=512, FW:PMAP
Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32, sector size=512 - Generic STORAGE DEVICE, FW:1404
Disk /dev/loop0 - 1773 MB / 1691 MiB - 3463936 sectors (RO), sector size=512
Disk /dev/loop1 - 548 MB / 522 MiB - 1070688 sectors (RO), sector size=512
Disk /dev/loop10 - 46 MB / 44 MiB - 91008 sectors (RO), sector size=512
Disk /dev/loop11 - 581 KB / 568 KiB - 1136 sectors (RO), sector size=512
Disk /dev/loop12 - 220 MB / 210 MiB - 430920 sectors (RO), sector size=512
Disk /dev/loop13 - 117 MB / 112 MiB - 230296 sectors (RO), sector size=512
Disk /dev/loop2 - 939 MB / 895 MiB - 1834296 sectors (RO), sector size=512
Disk /dev/loop3 - 4096 B - 8 sectors (RO), sector size=512
Disk /dev/loop4 - 77 MB / 73 MiB - 151328 sectors (RO), sector size=512
Disk /dev/loop5 - 96 MB / 91 MiB - 187776 sectors (RO), sector size=512
Disk /dev/loop6 - 541 MB / 516 MiB - 1056784 sectors (RO), sector size=512
Disk /dev/loop7 - 11 MB / 11 MiB - 22800 sectors (RO), sector size=512
Disk /dev/loop8 - 270 MB / 258 MiB - 528456 sectors (RO), sector size=512
Disk /dev/loop9 - 11 MB / 10 MiB - 22056 sectors (RO), sector size=512

Partition table type (auto): Intel
Disk /dev/sdc - 63 GB / 59 GiB - Generic STORAGE DEVICE
Partition table type: Intel

Analyse Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32
Geometry from i386 MBR: head=64 sector=32
BAD_RS LBA=8192 131072
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
BAD_RS LBA=532480 2095231
check_part_i386 failed for partition type 83
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
Current partition structure:
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]

Bad relative sector.
No ext2, JFS, Reiser, cramfs or XFS marker
 2 P Linux                  260   0  1 60905  63 32  124203008
 2 P Linux                  260   0  1 60905  63 32  124203008

Bad relative sector.
No partition is bootable
Backup partition structure
partition_save

search_part()
Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32
FAT32 at 4/0/1
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020

FAT32 at 4/0/1
FAT: cluster=2(0x2), pos=10264
FAT: cluster=4274(0x10b2), pos=27352
     FAT32                    4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Sat Jun 14 13:03:08 2025
     Linux                 2093   1  1 62739   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
This partition ends after the disk limits. (start=4286496, size=124203008, end=128489503, disk end=124735488)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Sat Jun 14 13:03:08 2025
     Linux                 2095   1  1 62741   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
This partition ends after the disk limits. (start=4290592, size=124203008, end=128493599, disk end=124735488)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Sat Jun 14 13:03:08 2025
     Linux                 2102   0  1 62747  63 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
This partition ends after the disk limits. (start=4304896, size=124203008, end=128507903, disk end=124735488)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=1/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Sat Jun 14 13:03:08 2025
     Linux                 2106   1  1 62752   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
This partition ends after the disk limits. (start=4313120, size=124203008, end=128516127, disk end=124735488)
     Linux Swap            3972   0  1  4071  63 16     204784
     SWAP2 version 1, pagesize=4096, 104 MB / 99 MiB
Search for partition aborted
Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32
Check the harddisk size: HD jumper settings, BIOS detection...
The harddisk (63 GB / 59 GiB) seems too small! (< 65 GB / 61 GiB)
The following partitions can't be recovered:
     Linux                 2093   1  1 62739   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
     Linux                 2095   1  1 62741   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
     Linux                 2102   0  1 62747  63 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
     Linux                 2106   1  1 62752   0 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB Recover, 63 GB / 59 GiB
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
Warning: the current number of heads per cylinder is 64 but the correct value may be 128.

Results
   * FAT32                    4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
   P Linux Swap            3972   0  1  4071  63 32     204800
     SWAP2 version 1, pagesize=4096, 104 MB / 100 MiB

Hint for advanced users: dmsetup may be used if you prefer to avoid rewriting the partition table for the moment:
echo "0 524288 linear /dev/sdc 8192" | dmsetup create test0
echo "0 204800 linear /dev/sdc 8134656" | dmsetup create test1

interface_write()
 1 * FAT32                    4   0  1   259  63 32     524288 [bootfs]
 2 P Linux Swap            3972   0  1  4071  63 32     204800
simulate write!

write_mbr_i386: starting...
write_all_log_i386: starting...
No extended partition

Interface Advanced
Geometry from i386 MBR: head=64 sector=32
BAD_RS LBA=8192 131072
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
BAD_RS LBA=532480 2095231
check_part_i386 failed for partition type 83
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
 2 P Linux                  260   0  1 60905  63 32  124203008

fat32_boot_sector
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
Boot sector
OK

Backup boot sector
OK

Second sectors (cluster information) are not identical.

A valid FAT Boot sector must be present in order to access
any data; even if the partition is not bootable.
Boot sector                        Backup boot sector
0000 eb58906d 6b66732e   .X.mkfs.  eb58906d 6b66732e   .X.mkfs.
0008 66617400 02042000   fat... .  66617400 02042000   fat... .
0010 02000000 00f80000   ........  02000000 00f80000   ........
0018 20004000 00000000    .@.....  20004000 00000000    .@.....
0020 00000800 fc030000   ........  00000800 fc030000   ........
0028 00000000 02000000   ........  00000000 02000000   ........
0030 01000600 00000000   ........  01000600 00000000   ........
0038 00000000 00000000   ........  00000000 00000000   ........
0040 800029a7 ba296262   ..)..)bb  800029a7 ba296262   ..)..)bb
0048 6f6f7466 73202020   ootfs     6f6f7466 73202020   ootfs   
0050 20204641 54333220     FAT32   20204641 54333220     FAT32 
0058 20200e1f be777cac     ...w|.  20200e1f be777cac     ...w|.
0060 22c0740b 56b40ebb   ".t.V...  22c0740b 56b40ebb   ".t.V...
0068 0700cd10 5eebf032   ....^..2  0700cd10 5eebf032   ....^..2
0070 e4cd16cd 19ebfe54   .......T  e4cd16cd 19ebfe54   .......T
0078 68697320 6973206e   his is n  68697320 6973206e   his is n
0080 6f742061 20626f6f   ot a boo  6f742061 20626f6f   ot a boo
0088 7461626c 65206469   table di  7461626c 65206469   table di
0090 736b2e20 20506c65   sk.  Ple  736b2e20 20506c65   sk.  Ple
0098 61736520 696e7365   ase inse  61736520 696e7365   ase inse
00A0 72742061 20626f6f   rt a boo  72742061 20626f6f   rt a boo
00A8 7461626c 6520666c   table fl  7461626c 6520666c   table fl
00B0 6f707079 20616e64   oppy and  6f707079 20616e64   oppy and
00B8 0d0a7072 65737320   ..press   0d0a7072 65737320   ..press 
00C0 616e7920 6b657920   any key   616e7920 6b657920   any key 
00C8 746f2074 72792061   to try a  746f2074 72792061   to try a
00D0 6761696e 202e2e2e   gain ...  6761696e 202e2e2e   gain ...
00D8 200d0a00 00000000    .......  200d0a00 00000000    .......
00E0 00000000 00000000   ........  00000000 00000000   ........
00E8 00000000 00000000   ........  00000000 00000000   ........
00F0 00000000 00000000   ........  00000000 00000000   ........
00F8 00000000 00000000   ........  00000000 00000000   ........
0100 00000000 00000000   ........  00000000 00000000   ........
0108 00000000 00000000   ........  00000000 00000000   ........
0110 00000000 00000000   ........  00000000 00000000   ........
0118 00000000 00000000   ........  00000000 00000000   ........
0120 00000000 00000000   ........  00000000 00000000   ........
0128 00000000 00000000   ........  00000000 00000000   ........
0130 00000000 00000000   ........  00000000 00000000   ........
0138 00000000 00000000   ........  00000000 00000000   ........
0140 00000000 00000000   ........  00000000 00000000   ........
0148 00000000 00000000   ........  00000000 00000000   ........
0150 00000000 00000000   ........  00000000 00000000   ........
0158 00000000 00000000   ........  00000000 00000000   ........
0160 00000000 00000000   ........  00000000 00000000   ........
0168 00000000 00000000   ........  00000000 00000000   ........
0170 00000000 00000000   ........  00000000 00000000   ........
0178 00000000 00000000   ........  00000000 00000000   ........
0180 00000000 00000000   ........  00000000 00000000   ........
0188 00000000 00000000   ........  00000000 00000000   ........
0190 00000000 00000000   ........  00000000 00000000   ........
0198 00000000 00000000   ........  00000000 00000000   ........
01A0 00000000 00000000   ........  00000000 00000000   ........
01A8 00000000 00000000   ........  00000000 00000000   ........
01B0 00000000 00000000   ........  00000000 00000000   ........
01B8 00000000 00000000   ........  00000000 00000000   ........
01C0 00000000 00000000   ........  00000000 00000000   ........
01C8 00000000 00000000   ........  00000000 00000000   ........
01D0 00000000 00000000   ........  00000000 00000000   ........
01D8 00000000 00000000   ........  00000000 00000000   ........
01E0 00000000 00000000   ........  00000000 00000000   ........
01E8 00000000 00000000   ........  00000000 00000000   ........
01F0 00000000 00000000   ........  00000000 00000000   ........
01F8 00000000 000055aa   ......U.  00000000 000055aa   ......U.
0200 52526141 00000000   RRaA....  00000000 00000000   ........
0208 00000000 00000000   ........  00000000 00000000   ........
0210 00000000 00000000   ........  00000000 00000000   ........
0218 00000000 00000000   ........  00000000 00000000   ........
0220 00000000 00000000   ........  00000000 00000000   ........
0228 00000000 00000000   ........  00000000 00000000   ........
0230 00000000 00000000   ........  00000000 00000000   ........
0238 00000000 00000000   ........  00000000 00000000   ........
0240 00000000 00000000   ........  00000000 00000000   ........
0248 00000000 00000000   ........  00000000 00000000   ........
0250 00000000 00000000   ........  00000000 00000000   ........
0258 00000000 00000000   ........  00000000 00000000   ........
0260 00000000 00000000   ........  00000000 00000000   ........
0268 00000000 00000000   ........  00000000 00000000   ........
0270 00000000 00000000   ........  00000000 00000000   ........
0278 00000000 00000000   ........  00000000 00000000   ........
0280 00000000 00000000   ........  00000000 00000000   ........
0288 00000000 00000000   ........  00000000 00000000   ........
0290 00000000 00000000   ........  00000000 00000000   ........
0298 00000000 00000000   ........  00000000 00000000   ........
02A0 00000000 00000000   ........  00000000 00000000   ........
02A8 00000000 00000000   ........  00000000 00000000   ........
02B0 00000000 00000000   ........  00000000 00000000   ........
02B8 00000000 00000000   ........  00000000 00000000   ........
02C0 00000000 00000000   ........  00000000 00000000   ........
02C8 00000000 00000000   ........  00000000 00000000   ........
02D0 00000000 00000000   ........  00000000 00000000   ........
02D8 00000000 00000000   ........  00000000 00000000   ........
02E0 00000000 00000000   ........  00000000 00000000   ........
02E8 00000000 00000000   ........  00000000 00000000   ........
02F0 00000000 00000000   ........  00000000 00000000   ........
02F8 00000000 00000000   ........  00000000 00000000   ........
0300 00000000 00000000   ........  00000000 00000000   ........
0308 00000000 00000000   ........  00000000 00000000   ........
0310 00000000 00000000   ........  00000000 00000000   ........
0318 00000000 00000000   ........  00000000 00000000   ........
0320 00000000 00000000   ........  00000000 00000000   ........
0328 00000000 00000000   ........  00000000 00000000   ........
0330 00000000 00000000   ........  00000000 00000000   ........
0338 00000000 00000000   ........  00000000 00000000   ........
0340 00000000 00000000   ........  00000000 00000000   ........
0348 00000000 00000000   ........  00000000 00000000   ........
0350 00000000 00000000   ........  00000000 00000000   ........
0358 00000000 00000000   ........  00000000 00000000   ........
0360 00000000 00000000   ........  00000000 00000000   ........
0368 00000000 00000000   ........  00000000 00000000   ........
0370 00000000 00000000   ........  00000000 00000000   ........
0378 00000000 00000000   ........  00000000 00000000   ........
0380 00000000 00000000   ........  00000000 00000000   ........
0388 00000000 00000000   ........  00000000 00000000   ........
0390 00000000 00000000   ........  00000000 00000000   ........
0398 00000000 00000000   ........  00000000 00000000   ........
03A0 00000000 00000000   ........  00000000 00000000   ........
03A8 00000000 00000000   ........  00000000 00000000   ........
03B0 00000000 00000000   ........  00000000 00000000   ........
03B8 00000000 00000000   ........  00000000 00000000   ........
03C0 00000000 00000000   ........  00000000 00000000   ........
03C8 00000000 00000000   ........  00000000 00000000   ........
03D0 00000000 00000000   ........  00000000 00000000   ........
03D8 00000000 00000000   ........  00000000 00000000   ........
03E0 00000000 72724161   ....rrAa  00000000 00000000   ........
03E8 b3c00100 04000000   ........  00000000 00000000   ........
03F0 00000000 00000000   ........  00000000 00000000   ........
03F8 00000000 000055aa   ......U.  00000000 00000000   ........
0400 00000000 00000000   ........  00000000 00000000   ........
0408 00000000 00000000   ........  00000000 00000000   ........
0410 00000000 00000000   ........  00000000 00000000   ........
0418 00000000 00000000   ........  00000000 00000000   ........
0420 00000000 00000000   ........  00000000 00000000   ........
0428 00000000 00000000   ........  00000000 00000000   ........
0430 00000000 00000000   ........  00000000 00000000   ........
0438 00000000 00000000   ........  00000000 00000000   ........
0440 00000000 00000000   ........  00000000 00000000   ........
0448 00000000 00000000   ........  00000000 00000000   ........
0450 00000000 00000000   ........  00000000 00000000   ........
0458 00000000 00000000   ........  00000000 00000000   ........
0460 00000000 00000000   ........  00000000 00000000   ........
0468 00000000 00000000   ........  00000000 00000000   ........
0470 00000000 00000000   ........  00000000 00000000   ........
0478 00000000 00000000   ........  00000000 00000000   ........
0480 00000000 00000000   ........  00000000 00000000   ........
0488 00000000 00000000   ........  00000000 00000000   ........
0490 00000000 00000000   ........  00000000 00000000   ........
0498 00000000 00000000   ........  00000000 00000000   ........
04A0 00000000 00000000   ........  00000000 00000000   ........
04A8 00000000 00000000   ........  00000000 00000000   ........
04B0 00000000 00000000   ........  00000000 00000000   ........
04B8 00000000 00000000   ........  00000000 00000000   ........
04C0 00000000 00000000   ........  00000000 00000000   ........
04C8 00000000 00000000   ........  00000000 00000000   ........
04D0 00000000 00000000   ........  00000000 00000000   ........
04D8 00000000 00000000   ........  00000000 00000000   ........
04E0 00000000 00000000   ........  00000000 00000000   ........
04E8 00000000 00000000   ........  00000000 00000000   ........
04F0 00000000 00000000   ........  00000000 00000000   ........
04F8 00000000 00000000   ........  00000000 00000000   ........
0500 00000000 00000000   ........  00000000 00000000   ........
0508 00000000 00000000   ........  00000000 00000000   ........
0510 00000000 00000000   ........  00000000 00000000   ........
0518 00000000 00000000   ........  00000000 00000000   ........
0520 00000000 00000000   ........  00000000 00000000   ........
0528 00000000 00000000   ........  00000000 00000000   ........
0530 00000000 00000000   ........  00000000 00000000   ........
0538 00000000 00000000   ........  00000000 00000000   ........
0540 00000000 00000000   ........  00000000 00000000   ........
0548 00000000 00000000   ........  00000000 00000000   ........
0550 00000000 00000000   ........  00000000 00000000   ........
0558 00000000 00000000   ........  00000000 00000000   ........
0560 00000000 00000000   ........  00000000 00000000   ........
0568 00000000 00000000   ........  00000000 00000000   ........
0570 00000000 00000000   ........  00000000 00000000   ........
0578 00000000 00000000   ........  00000000 00000000   ........
0580 00000000 00000000   ........  00000000 00000000   ........
0588 00000000 00000000   ........  00000000 00000000   ........
0590 00000000 00000000   ........  00000000 00000000   ........
0598 00000000 00000000   ........  00000000 00000000   ........
05A0 00000000 00000000   ........  00000000 00000000   ........
05A8 00000000 00000000   ........  00000000 00000000   ........
05B0 00000000 00000000   ........  00000000 00000000   ........
05B8 00000000 00000000   ........  00000000 00000000   ........
05C0 00000000 00000000   ........  00000000 00000000   ........
05C8 00000000 00000000   ........  00000000 00000000   ........
05D0 00000000 00000000   ........  00000000 00000000   ........
05D8 00000000 00000000   ........  00000000 00000000   ........
05E0 00000000 00000000   ........  00000000 00000000   ........
05E8 00000000 00000000   ........  00000000 00000000   ........
05F0 00000000 00000000   ........  00000000 00000000   ........
05F8 00000000 00000000   ........  00000000 00000000   ........

FAT32
sector_size  512 512
cluster_size 4 4
reserved     32 32
fats         2 2
dir_entries  0 0
sectors      0 0
media        F8 F8
fat_length   0 0
secs_track   32 32
heads        64 64
hidden       0 0
total_sect   524288 524288
fat32_length 1020 1020
flags        0000 0000
version      0.0  0.0
root_cluster 2 2
info_sector  1 1
backup_boot  6 6
free_count   114867 0
next_free    4 0

fat32_boot_sector
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
Boot sector
OK

Backup boot sector
OK

Second sectors (cluster information) are not identical.

A valid FAT Boot sector must be present in order to access
any data; even if the partition is not bootable.
search_superblock

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 262144 (block=32768, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 786432 (block=98304, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 1310720 (block=163840, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 1835008 (block=229376, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 2359296 (block=294912, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 6553600 (block=819200, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 7077888 (block=884736, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 12845056 (block=1605632, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 21233664 (block=2654208, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8128
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 04:18:42 2023
Last mount time:    Thu Jan  1 00:00:02 1970
Ext2 superblock found at sector 32768000 (block=4096000, blocksize=4096)
  Linux                  388   0  1 61033  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  644   0  1 61289  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  900   0  1 61545  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1156   0  1 61801  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1412   0  1 62057  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3460   0  1 64105  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3716   0  1 64361  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 6532   0  1 67177  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                10628   0  1 71273  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                16260   0  1 76905  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]

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

TestDisk exited normally.


Here the testdisk log of a clean new raspberry disk:

Code: Select all

Tue Nov 18 09:57:41 2025
Command line: TestDisk

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org
OS: Linux, kernel 6.11.0-17-generic (#17~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 20 22:48:29 UTC 2) x86_64
Compiler: GCC 13.2
ext2fs lib: 1.47.0, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.4
/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
Warning: can't get size for Disk /dev/mapper/control - 0 B - 0 sectors, sector size=512
Warning: can't get size for Disk /dev/loop14 - 0 B - 0 sectors, sector size=512
Hard disk list
Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63, sector size=512 - Hitachi
Disk /dev/sdb - 7927 MB / 7560 MiB - 15482880 sectors, sector size=512, FW:PMAP
Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32, sector size=512 - Mass Storage Device, FW:1.00
Disk /dev/loop0 - 1773 MB / 1691 MiB - 3463936 sectors (RO), sector size=512
Disk /dev/loop1 - 548 MB / 522 MiB - 1070688 sectors (RO), sector size=512
Disk /dev/loop10 - 46 MB / 44 MiB - 91008 sectors (RO), sector size=512
Disk /dev/loop11 - 581 KB / 568 KiB - 1136 sectors (RO), sector size=512
Disk /dev/loop12 - 220 MB / 210 MiB - 430920 sectors (RO), sector size=512
Disk /dev/loop13 - 117 MB / 112 MiB - 230296 sectors (RO), sector size=512
Disk /dev/loop2 - 939 MB / 895 MiB - 1834296 sectors (RO), sector size=512
Disk /dev/loop3 - 4096 B - 8 sectors (RO), sector size=512
Disk /dev/loop4 - 77 MB / 73 MiB - 151328 sectors (RO), sector size=512
Disk /dev/loop5 - 96 MB / 91 MiB - 187776 sectors (RO), sector size=512
Disk /dev/loop6 - 541 MB / 516 MiB - 1056784 sectors (RO), sector size=512
Disk /dev/loop7 - 11 MB / 11 MiB - 22800 sectors (RO), sector size=512
Disk /dev/loop8 - 270 MB / 258 MiB - 528456 sectors (RO), sector size=512
Disk /dev/loop9 - 11 MB / 10 MiB - 22056 sectors (RO), sector size=512

Partition table type (auto): Intel
Disk /dev/sdc - 63 GB / 59 GiB - Mass Storage Device
Partition table type: Intel

Analyse Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32
Geometry from i386 MBR: head=64 sector=32
BAD_RS LBA=8192 131072
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
BAD_RS LBA=532480 2095231
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
Current partition structure:
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]

Bad relative sector.
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]

Bad relative sector.
No partition is bootable

search_part()
Disk /dev/sdc - 63 GB / 59 GiB - CHS 60906 64 32
FAT32 at 4/0/1
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020

FAT32 at 4/0/1
FAT: cluster=2(0x2), pos=10264
FAT: cluster=327(0x147), pos=11564
     FAT32                    4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=13/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Tue Nov 18 09:02:07 2025
     Linux                  260   0  1 60905  63 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB, 63 GB / 59 GiB
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
Warning: the current number of heads per cylinder is 64 but the correct value may be 128.

Results
   * FAT32                    4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
   P Linux                  260   0  1 60905  63 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB, 63 GB / 59 GiB

Hint for advanced users: dmsetup may be used if you prefer to avoid rewriting the partition table for the moment:
echo "0 524288 linear /dev/sdc 8192" | dmsetup create test0
echo "0 124203008 linear /dev/sdc 532480" | dmsetup create test1

interface_write()
 1 * FAT32                    4   0  1   259  63 32     524288 [bootfs]
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]
simulate write!

write_mbr_i386: starting...
write_all_log_i386: starting...
No extended partition

Interface Advanced
Geometry from i386 MBR: head=64 sector=32
BAD_RS LBA=8192 131072
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
BAD_RS LBA=532480 2095231
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=8 nbr=4
get_geometry_from_list_part_aux head=16 nbr=4
get_geometry_from_list_part_aux head=32 nbr=4
get_geometry_from_list_part_aux head=64 nbr=4
get_geometry_from_list_part_aux head=128 nbr=4
get_geometry_from_list_part_aux head=255 nbr=1
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]
     ext4 blocksize=4096 Large_file Sparse_SB, 63 GB / 59 GiB

fat32_boot_sector
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
Boot sector
OK

Backup boot sector
OK

Second sectors (cluster information) are not identical.

A valid FAT Boot sector must be present in order to access
any data; even if the partition is not bootable.
Boot sector                        Backup boot sector
0000 eb58906d 6b66732e   .X.mkfs.  eb58906d 6b66732e   .X.mkfs.
0008 66617400 02042000   fat... .  66617400 02042000   fat... .
0010 02000000 00f80000   ........  02000000 00f80000   ........
0018 20004000 00000000    .@.....  20004000 00000000    .@.....
0020 00000800 fc030000   ........  00000800 fc030000   ........
0028 00000000 02000000   ........  00000000 02000000   ........
0030 01000600 00000000   ........  01000600 00000000   ........
0038 00000000 00000000   ........  00000000 00000000   ........
0040 800029a3 9e315a62   ..)..1Zb  800029a3 9e315a62   ..)..1Zb
0048 6f6f7466 73202020   ootfs     6f6f7466 73202020   ootfs   
0050 20204641 54333220     FAT32   20204641 54333220     FAT32 
0058 20200e1f be777cac     ...w|.  20200e1f be777cac     ...w|.
0060 22c0740b 56b40ebb   ".t.V...  22c0740b 56b40ebb   ".t.V...
0068 0700cd10 5eebf032   ....^..2  0700cd10 5eebf032   ....^..2
0070 e4cd16cd 19ebfe54   .......T  e4cd16cd 19ebfe54   .......T
0078 68697320 6973206e   his is n  68697320 6973206e   his is n
0080 6f742061 20626f6f   ot a boo  6f742061 20626f6f   ot a boo
0088 7461626c 65206469   table di  7461626c 65206469   table di
0090 736b2e20 20506c65   sk.  Ple  736b2e20 20506c65   sk.  Ple
0098 61736520 696e7365   ase inse  61736520 696e7365   ase inse
00A0 72742061 20626f6f   rt a boo  72742061 20626f6f   rt a boo
00A8 7461626c 6520666c   table fl  7461626c 6520666c   table fl
00B0 6f707079 20616e64   oppy and  6f707079 20616e64   oppy and
00B8 0d0a7072 65737320   ..press   0d0a7072 65737320   ..press 
00C0 616e7920 6b657920   any key   616e7920 6b657920   any key 
00C8 746f2074 72792061   to try a  746f2074 72792061   to try a
00D0 6761696e 202e2e2e   gain ...  6761696e 202e2e2e   gain ...
00D8 200d0a00 00000000    .......  200d0a00 00000000    .......
00E0 00000000 00000000   ........  00000000 00000000   ........
00E8 00000000 00000000   ........  00000000 00000000   ........
00F0 00000000 00000000   ........  00000000 00000000   ........
00F8 00000000 00000000   ........  00000000 00000000   ........
0100 00000000 00000000   ........  00000000 00000000   ........
0108 00000000 00000000   ........  00000000 00000000   ........
0110 00000000 00000000   ........  00000000 00000000   ........
0118 00000000 00000000   ........  00000000 00000000   ........
0120 00000000 00000000   ........  00000000 00000000   ........
0128 00000000 00000000   ........  00000000 00000000   ........
0130 00000000 00000000   ........  00000000 00000000   ........
0138 00000000 00000000   ........  00000000 00000000   ........
0140 00000000 00000000   ........  00000000 00000000   ........
0148 00000000 00000000   ........  00000000 00000000   ........
0150 00000000 00000000   ........  00000000 00000000   ........
0158 00000000 00000000   ........  00000000 00000000   ........
0160 00000000 00000000   ........  00000000 00000000   ........
0168 00000000 00000000   ........  00000000 00000000   ........
0170 00000000 00000000   ........  00000000 00000000   ........
0178 00000000 00000000   ........  00000000 00000000   ........
0180 00000000 00000000   ........  00000000 00000000   ........
0188 00000000 00000000   ........  00000000 00000000   ........
0190 00000000 00000000   ........  00000000 00000000   ........
0198 00000000 00000000   ........  00000000 00000000   ........
01A0 00000000 00000000   ........  00000000 00000000   ........
01A8 00000000 00000000   ........  00000000 00000000   ........
01B0 00000000 00000000   ........  00000000 00000000   ........
01B8 00000000 00000000   ........  00000000 00000000   ........
01C0 00000000 00000000   ........  00000000 00000000   ........
01C8 00000000 00000000   ........  00000000 00000000   ........
01D0 00000000 00000000   ........  00000000 00000000   ........
01D8 00000000 00000000   ........  00000000 00000000   ........
01E0 00000000 00000000   ........  00000000 00000000   ........
01E8 00000000 00000000   ........  00000000 00000000   ........
01F0 00000000 00000000   ........  00000000 00000000   ........
01F8 00000000 000055aa   ......U.  00000000 000055aa   ......U.
0200 52526141 00000000   RRaA....  00000000 00000000   ........
0208 00000000 00000000   ........  00000000 00000000   ........
0210 00000000 00000000   ........  00000000 00000000   ........
0218 00000000 00000000   ........  00000000 00000000   ........
0220 00000000 00000000   ........  00000000 00000000   ........
0228 00000000 00000000   ........  00000000 00000000   ........
0230 00000000 00000000   ........  00000000 00000000   ........
0238 00000000 00000000   ........  00000000 00000000   ........
0240 00000000 00000000   ........  00000000 00000000   ........
0248 00000000 00000000   ........  00000000 00000000   ........
0250 00000000 00000000   ........  00000000 00000000   ........
0258 00000000 00000000   ........  00000000 00000000   ........
0260 00000000 00000000   ........  00000000 00000000   ........
0268 00000000 00000000   ........  00000000 00000000   ........
0270 00000000 00000000   ........  00000000 00000000   ........
0278 00000000 00000000   ........  00000000 00000000   ........
0280 00000000 00000000   ........  00000000 00000000   ........
0288 00000000 00000000   ........  00000000 00000000   ........
0290 00000000 00000000   ........  00000000 00000000   ........
0298 00000000 00000000   ........  00000000 00000000   ........
02A0 00000000 00000000   ........  00000000 00000000   ........
02A8 00000000 00000000   ........  00000000 00000000   ........
02B0 00000000 00000000   ........  00000000 00000000   ........
02B8 00000000 00000000   ........  00000000 00000000   ........
02C0 00000000 00000000   ........  00000000 00000000   ........
02C8 00000000 00000000   ........  00000000 00000000   ........
02D0 00000000 00000000   ........  00000000 00000000   ........
02D8 00000000 00000000   ........  00000000 00000000   ........
02E0 00000000 00000000   ........  00000000 00000000   ........
02E8 00000000 00000000   ........  00000000 00000000   ........
02F0 00000000 00000000   ........  00000000 00000000   ........
02F8 00000000 00000000   ........  00000000 00000000   ........
0300 00000000 00000000   ........  00000000 00000000   ........
0308 00000000 00000000   ........  00000000 00000000   ........
0310 00000000 00000000   ........  00000000 00000000   ........
0318 00000000 00000000   ........  00000000 00000000   ........
0320 00000000 00000000   ........  00000000 00000000   ........
0328 00000000 00000000   ........  00000000 00000000   ........
0330 00000000 00000000   ........  00000000 00000000   ........
0338 00000000 00000000   ........  00000000 00000000   ........
0340 00000000 00000000   ........  00000000 00000000   ........
0348 00000000 00000000   ........  00000000 00000000   ........
0350 00000000 00000000   ........  00000000 00000000   ........
0358 00000000 00000000   ........  00000000 00000000   ........
0360 00000000 00000000   ........  00000000 00000000   ........
0368 00000000 00000000   ........  00000000 00000000   ........
0370 00000000 00000000   ........  00000000 00000000   ........
0378 00000000 00000000   ........  00000000 00000000   ........
0380 00000000 00000000   ........  00000000 00000000   ........
0388 00000000 00000000   ........  00000000 00000000   ........
0390 00000000 00000000   ........  00000000 00000000   ........
0398 00000000 00000000   ........  00000000 00000000   ........
03A0 00000000 00000000   ........  00000000 00000000   ........
03A8 00000000 00000000   ........  00000000 00000000   ........
03B0 00000000 00000000   ........  00000000 00000000   ........
03B8 00000000 00000000   ........  00000000 00000000   ........
03C0 00000000 00000000   ........  00000000 00000000   ........
03C8 00000000 00000000   ........  00000000 00000000   ........
03D0 00000000 00000000   ........  00000000 00000000   ........
03D8 00000000 00000000   ........  00000000 00000000   ........
03E0 00000000 72724161   ....rrAa  00000000 00000000   ........
03E8 559a0100 62010000   U...b...  00000000 00000000   ........
03F0 00000000 00000000   ........  00000000 00000000   ........
03F8 00000000 000055aa   ......U.  00000000 00000000   ........
0400 00000000 00000000   ........  00000000 00000000   ........
0408 00000000 00000000   ........  00000000 00000000   ........
0410 00000000 00000000   ........  00000000 00000000   ........
0418 00000000 00000000   ........  00000000 00000000   ........
0420 00000000 00000000   ........  00000000 00000000   ........
0428 00000000 00000000   ........  00000000 00000000   ........
0430 00000000 00000000   ........  00000000 00000000   ........
0438 00000000 00000000   ........  00000000 00000000   ........
0440 00000000 00000000   ........  00000000 00000000   ........
0448 00000000 00000000   ........  00000000 00000000   ........
0450 00000000 00000000   ........  00000000 00000000   ........
0458 00000000 00000000   ........  00000000 00000000   ........
0460 00000000 00000000   ........  00000000 00000000   ........
0468 00000000 00000000   ........  00000000 00000000   ........
0470 00000000 00000000   ........  00000000 00000000   ........
0478 00000000 00000000   ........  00000000 00000000   ........
0480 00000000 00000000   ........  00000000 00000000   ........
0488 00000000 00000000   ........  00000000 00000000   ........
0490 00000000 00000000   ........  00000000 00000000   ........
0498 00000000 00000000   ........  00000000 00000000   ........
04A0 00000000 00000000   ........  00000000 00000000   ........
04A8 00000000 00000000   ........  00000000 00000000   ........
04B0 00000000 00000000   ........  00000000 00000000   ........
04B8 00000000 00000000   ........  00000000 00000000   ........
04C0 00000000 00000000   ........  00000000 00000000   ........
04C8 00000000 00000000   ........  00000000 00000000   ........
04D0 00000000 00000000   ........  00000000 00000000   ........
04D8 00000000 00000000   ........  00000000 00000000   ........
04E0 00000000 00000000   ........  00000000 00000000   ........
04E8 00000000 00000000   ........  00000000 00000000   ........
04F0 00000000 00000000   ........  00000000 00000000   ........
04F8 00000000 00000000   ........  00000000 00000000   ........
0500 00000000 00000000   ........  00000000 00000000   ........
0508 00000000 00000000   ........  00000000 00000000   ........
0510 00000000 00000000   ........  00000000 00000000   ........
0518 00000000 00000000   ........  00000000 00000000   ........
0520 00000000 00000000   ........  00000000 00000000   ........
0528 00000000 00000000   ........  00000000 00000000   ........
0530 00000000 00000000   ........  00000000 00000000   ........
0538 00000000 00000000   ........  00000000 00000000   ........
0540 00000000 00000000   ........  00000000 00000000   ........
0548 00000000 00000000   ........  00000000 00000000   ........
0550 00000000 00000000   ........  00000000 00000000   ........
0558 00000000 00000000   ........  00000000 00000000   ........
0560 00000000 00000000   ........  00000000 00000000   ........
0568 00000000 00000000   ........  00000000 00000000   ........
0570 00000000 00000000   ........  00000000 00000000   ........
0578 00000000 00000000   ........  00000000 00000000   ........
0580 00000000 00000000   ........  00000000 00000000   ........
0588 00000000 00000000   ........  00000000 00000000   ........
0590 00000000 00000000   ........  00000000 00000000   ........
0598 00000000 00000000   ........  00000000 00000000   ........
05A0 00000000 00000000   ........  00000000 00000000   ........
05A8 00000000 00000000   ........  00000000 00000000   ........
05B0 00000000 00000000   ........  00000000 00000000   ........
05B8 00000000 00000000   ........  00000000 00000000   ........
05C0 00000000 00000000   ........  00000000 00000000   ........
05C8 00000000 00000000   ........  00000000 00000000   ........
05D0 00000000 00000000   ........  00000000 00000000   ........
05D8 00000000 00000000   ........  00000000 00000000   ........
05E0 00000000 00000000   ........  00000000 00000000   ........
05E8 00000000 00000000   ........  00000000 00000000   ........
05F0 00000000 00000000   ........  00000000 00000000   ........
05F8 00000000 00000000   ........  00000000 00000000   ........

FAT32
sector_size  512 512
cluster_size 4 4
reserved     32 32
fats         2 2
dir_entries  0 0
sectors      0 0
media        F8 F8
fat_length   0 0
secs_track   32 32
heads        64 64
hidden       0 0
total_sect   524288 524288
fat32_length 1020 1020
flags        0000 0000
version      0.0  0.0
root_cluster 2 2
info_sector  1 1
backup_boot  6 6
free_count   105045 0
next_free    354 0

fat32_boot_sector
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
FAT32 at 4/0/1
Info: size boot_sector 524288, partition 524288
FAT1 : 32-1051
FAT2 : 1052-2071
start_rootdir : 2072 root cluster : 2
Data : 2072-524287
sectors : 524288
cluster_size : 4
no_of_cluster : 130554 (2 - 130555)
fat_length 1020 calculated 1020
Boot sector
OK

Backup boot sector
OK

Second sectors (cluster information) are not identical.

A valid FAT Boot sector must be present in order to access
any data; even if the partition is not bootable.
search_superblock

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=13/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Tue Nov 18 09:02:07 2025
Ext2 superblock found at sector 2 (block=0, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 262144 (block=32768, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 786432 (block=98304, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 1310720 (block=163840, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 1835008 (block=229376, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 2359296 (block=294912, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 6553600 (block=819200, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 7077888 (block=884736, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 12845056 (block=1605632, blocksize=4096)

recover_EXT2: s_block_group_nr=0/473, s_mnt_count=4/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8160
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 15525376
recover_EXT2: part_size 124203008
Filesystem created: Tue Feb 21 02:00:03 2023
Last mount time:    Thu Jan  1 00:00:03 1970
Ext2 superblock found at sector 21233664 (block=2654208, blocksize=4096)
  Linux                  260   0  1 60905  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  388   0  1 61033  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  644   0  1 61289  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  900   0  1 61545  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1156   0  1 61801  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1412   0  1 62057  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3460   0  1 64105  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3716   0  1 64361  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 6532   0  1 67177  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                10628   0  1 71273  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]

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

TestDisk exited normally.

Thanks for your help :)
recuperation
Posts: 3089
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: partition recovery for a raspberry disk

#2 Post by recuperation »

tom1689494 wrote: 18 Nov 2025, 13:23 hello,


First of all, thanks a lot for this forum and for any clue that could be provided as I'm all new to this utility and kind of issues.

The issue is on a raspberry disk which was created by the raspberry imager on a microSD card.
It used to display two main partitions:
bootfs
rootfs
Hooray! You are one of the fews who describe what the system looked like before the incident happened.

The rootfs partition somehow got corrupted.
Now, when reading the card with a usb card reader on a different linux system, the first partition and its files are still readable but the second partition is not recognized and not even mountable any longer.

The objective is to recover this partition - and its files...
Thank you - very often do not write what they want to do.

I followed the step by step document
This one?
https://www.cgsecurity.org/wiki/TestDisk_Step_By_Step
Your new Raspby installation uses the ext4 file system - that is not described in this article.
but I'm struggling to recover the partition as quick search and deep search don't find the expected partitioning.
I never recovered an ext4 file system.

Also, the raspberry partitions look a bit odd.

I created a new raspberry system with the raspberry imager to be able to compare. It's created on an sdcard with the same capacity and same manufacturer so it's expected to display the expected partitioning info...
That is always a good strategy.
Testdisk gives the following information "Bad relative sector" for the clean new disk using the default "intel" setting whereas the system does work (ie it boots correctly in a raspberry device and the filesystem is ok):

Code: Select all

Current partition structure:
 1 P FAT32 LBA                4   0  1   259  63 32     524288 [bootfs]

Bad relative sector.
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]

Bad relative sector.
No partition is bootable
I would ignore this message as your clean install is running fine.


Also, I don't understand the superblocks structure of the raspberry as it lists only "superblock 0", so it is unclear which superblock would have to be recovered when this step is reached:
[/quoteThere is one superblock near the beginning of your rootfs-Partition. Its information has been backed up at different locations.

here are the superblocks of the second partition of the clean new system:

Code: Select all

Ext2 superblock found at sector 21233664 (block=2654208, blocksize=4096)
  Linux                  260   0  1 60905  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  388   0  1 61033  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  644   0  1 61289  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                  900   0  1 61545  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1156   0  1 61801  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 1412   0  1 62057  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3460   0  1 64105  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 3716   0  1 64361  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                 6532   0  1 67177  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]
  Linux                10628   0  1 71273  63 32  124203008 [rootfs]
superblock 0, blocksize=4096 [rootfs]

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

TestDisk exited normally.
The ones from the defective Micro Card seems to match your new installation.

So I've got two questions please:
  • 1. Would it be technically possible to copy the boot sector dump of the clean new system onto the corrupted system? What would be the steps? (PSB the boot sector dumps in the testdisk log for both a clean new raspberry and the corrupted one)
I don't understand what you mean exactly by "boot sector dump". For my understand an ext4 partition starts with a superblock at position 1024 (decimal).
You would have to manually copy the superblock from the running installation to the defective one, but this is a waste of time. Instead Linux can repair the superblock information.
  • 2. assuming the partition info gets fixed, which superblock could be used for recovery? (PSB the superblocks analysis in the testdisk log for both a clean new raspberry and the corrupted one)
Use ddrescue to clone your faulty micro SD card.
Load both log files (the good one and the bad one) into the free and open source Notepad++ editor. Run compare. Go to line 159:

The bad partition table:

Code: Select all

Results
   * FAT32                    4   0  1   259  63 32     524288 [bootfs]
     FAT32, blocksize=2048, 268 MB / 256 MiB
   P Linux Swap            3972   0  1  4071  63 32     204800
     SWAP2 version 1, pagesize=4096, 104 MB / 100 MiB
The good one:

Code: Select all

interface_write()
 1 * FAT32                    4   0  1   259  63 32     524288 [bootfs]
 2 P Linux                  260   0  1 60905  63 32  124203008 [rootfs]
Run TestDisk (use the current version, not the outdate version 7.1!), run the analysis, delete the Linux partition labeled rootfs and add a new Linux partition (partition 2 from the good table). Write the changes and rerun TestDisk.
Your rootfs most likely starts there. A correct entry is a necessary requirement for the command fsck.ext4 to work.
I am unsure about the correct value for the parameter -b in fsck.ext4 and will ask for help. :?
User avatar
cgrenier
Site Admin
Posts: 5443
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: partition recovery for a raspberry disk

#3 Post by cgrenier »

There should be no need to rewrite the partition with TestDisk.

With the partition unmounted, can you try "fsck.ext4 -a dev/sdc2" ?
If it failed, please paste the output. If it works, mount the filesystem and check if you can see your missing files.
Also check the lost+found/ directory, sometimes some files can be found here after a fsck.

I am using ~10 Raspberry Pi at work. After a few years, the SD cards may failed with the blocks that failed to retain data.
Our policy is to replace the SD card when random corruption starts to appear.
In your case, as you want to recover the data, if fsck.ext4 failed to repair the filesystem, try PhotoRec on the "Whole" space of the partition.
You will have to sort all the files, it's far from perfect but better than nothing.
Good luck
tom1689494
Posts: 4
Joined: 18 Nov 2025, 12:33

Re: partition recovery for a raspberry disk

#4 Post by tom1689494 »

hello,

thanks a lot for the clues! Was able to ddrescue the card and it completed without reading bad sectors.

fsck returns:

Code: Select all

fsck.ext4: Bad magic number in super-block while trying to open /dev/sdc2
/dev/sdc2: 
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>
does it list actual blocks (8193, 32768) existing on the card or is it a standard message of the command?
and what is the "magic number" about? didn't know harry potter was around there... ^^

thanks again,
recuperation
Posts: 3089
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: partition recovery for a raspberry disk

#5 Post by recuperation »

tom1689494 wrote: 22 Nov 2025, 00:29 hello,

thanks a lot for the clues! Was able to ddrescue the card and it completed without reading bad sectors.

fsck returns:

Code: Select all

fsck.ext4: Bad magic number in super-block while trying to open /dev/sdc2
/dev/sdc2: 
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>
does it list actual blocks (8193, 32768) existing on the card or is it a standard message of the command?
I don't know. Read the manual of the e2fsck command using
man e2fsck
or
info e2sck
I guess the info command might give more details - I am using Linux rarely.
If you are suffering from command line trauma, read here:
https://linux.die.net/man/8/e2fsck
to learn more!
and what is the "magic number" about? didn't know harry potter was around there... ^^
A magic number is a specific, constant byte or combination of bytes that serves as an ID.
It seems that the superblock has one.
You find 0x55AA for instance at the end of a MBR partition table.
tom1689494
Posts: 4
Joined: 18 Nov 2025, 12:33

Re: partition recovery for a raspberry disk

#6 Post by tom1689494 »

ok, I found another post with a similar message from fsck.ext4, so it looks like the standard output for this type of error.

thanks for the link to https://linux.die.net/man/8/fsck.ext4.

I listed the expected superblocks suggested by the page with the mke2fs command:

Code: Select all

ubuntu@ubuntu:~/Documents$ sudo mke2fs -n -b 4096 /dev/sdc2
mke2fs 1.47.0 (5-Feb-2023)
Creating filesystem with 15525376 4k blocks and 3883008 inodes
Filesystem UUID: 222b4f01-a5b7-4111-8284-ee0ac1fb6836
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424

I tried all these superblocks and e2fsck returns the same error for all of them:

Code: Select all

ubuntu@ubuntu:~/Documents$ sudo fsck.ext4 -p -b 32768 -B 4096 /dev/sdc2
fsck.ext4: Superblock checksum does not match superblock while trying to open /dev/sdc2
/dev/sdc2: 
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

But these blocks listed by mke2fs don't seem to match those listed by testdisk. So not sure they are correct ? And what could I do next?..
recuperation
Posts: 3089
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: partition recovery for a raspberry disk

#7 Post by recuperation »

After reading the comment of Christophe that there is no need to modify the partition table I noticed that my statement about the defective partition table was wrong - I looked at the wrong location in your log file - sorry! :? :roll: :oops:

I have no direct recovery ideas anymore.

Your error message stated:

Code: Select all

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.
As you stated that you were able to ddrescue without any indication of error,
the superblock should be readable.

To verify this assumption please run

Code: Select all

sudo xxd -s 32768 -l 1024 /dev/sdc2 > sbgood.txt
on the new SD card and

Code: Select all

sudo xxd -s 32768 -l 1024 /dev/sdc2 > sbbad.txt
on the bad SD card and post both files in the forum.
tom1689494
Posts: 4
Joined: 18 Nov 2025, 12:33

Re: partition recovery for a raspberry disk

#8 Post by tom1689494 »

hello,

here the hexdump for the corrupted card:

Code: Select all

00008000: 0880 0000 0880 0100 0880 0200 0880 0300  ................
00008010: 0880 0400 0880 0c00 0880 0d00 0880 1800  ................
00008020: 0880 2800 0880 3e00 0880 7900 0880 ab00  ..(...>...y.....
00008030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008210: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008220: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008230: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008240: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008250: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008260: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008270: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008280: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008290: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008300: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008310: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008320: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008330: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008340: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008350: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008360: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008370: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008380: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008390: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

here the hexdump for the new card:

Code: Select all

00008000: 0880 0000 0880 0100 0880 0200 0880 0300  ................
00008010: 0880 0400 0880 0c00 0880 0d00 0880 1800  ................
00008020: 0880 2800 0880 3e00 0880 7900 0880 ab00  ..(...>...y.....
00008030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000080f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000081f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008210: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008220: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008230: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008240: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008250: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008260: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008270: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008280: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008290: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000082f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008300: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008310: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008320: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008330: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008340: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008350: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008360: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008370: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008380: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00008390: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000083f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

they look the same to me, not sure if it's good news..?
Post Reply