0

I overclocked my raspberry pi 2 myself yesterday. However I also increased the sd_freq. Now after a reboot my microsdcard is mounted as read only. I have a laptop with linux installed where I can try to repair it.

Here is fsck:

fsck /dev/sdb6
fsck von util-linux 2.25.1
e2fsck 1.42.10 (18-May-2014)
fsck.ext2: Datei oder Verzeichnis nicht gefunden beim Versuch, /dev/sdb6 zu öffnen
Ist das Gerät möglicherweise nicht vorhanden?

That's german. The translation of that is:

File or directory not found. Failed to open /dev/sdb6
Does the device exist?

However if I run dmesg, I know that the laptop sees the microsdcard with errors:

    [ 2927.961523] JFS: nTxBlock = 8192, nTxLock = 65536
[ 2928.079252] ntfs: driver 2.1.31 [Flags: R/O MODULE].
[ 2928.297070] QNX4 filesystem 0.2.3 registered.
[ 2928.459834] raid6: mmxx1      346 MB/s
[ 2928.516455] raid6: mmxx2      679 MB/s
[ 2928.573186] raid6: sse1x1     114 MB/s
[ 2928.630046] raid6: sse1x2     191 MB/s
[ 2928.686624] raid6: sse2x1     175 MB/s
[ 2928.743233] raid6: sse2x2     343 MB/s
[ 2928.799919] raid6: int32x1    171 MB/s
[ 2928.856656] raid6: int32x2    240 MB/s
[ 2928.913079] raid6: int32x4    282 MB/s
[ 2928.969883] raid6: int32x8    269 MB/s
[ 2928.969891] raid6: using algorithm mmxx2 (679 MB/s)
[ 2928.969896] raid6: using ssse3x1 recovery algorithm
[ 2928.997412] xor: measuring software checksum speed
[ 2929.029731]    pIII_sse  :  4652.400 MB/sec
[ 2929.063063]    prefetch64-sse:  5186.400 MB/sec
[ 2929.063071] xor: using function: prefetch64-sse (5186.400 MB/sec)
[ 2929.319852] Btrfs loaded
[ 2929.678921] EXT4-fs (sda2): unable to read superblock
[ 2929.685504] EXT4-fs (sda2): unable to read superblock
[ 2929.692989] EXT4-fs (sda2): unable to read superblock
[ 2929.699864] FAT-fs (sda2): invalid media value (0x39)
[ 2929.699876] FAT-fs (sda2): Can't find a valid FAT filesystem
[ 2929.720715] XFS (sda2): Invalid superblock magic number
[ 2929.733631] FAT-fs (sda2): invalid media value (0x39)
[ 2929.733643] FAT-fs (sda2): Can't find a valid FAT filesystem
[ 2929.752486] MINIX-fs: unable to read superblock
[ 2929.789860] attempt to access beyond end of device
[ 2929.789873] sda2: rw=16, want=3, limit=2
[ 2929.789883] hfsplus: unable to find HFS+ superblock
[ 2929.798484] qnx4: no qnx4 filesystem (no root dir).
[ 2929.804082] ufs: You didn't specify the type of your ufs filesystem

mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...

>>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[ 2929.816251] hfs: can't find a HFS filesystem on dev sda2
[ 2932.646443] audit: type=1400 audit(1430243601.363:38): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/ntpd" pid=24052 comm="apparmor_parser"
[ 2947.369673] audit: type=1400 audit(1430243616.083:39): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/tcpdump" pid=27551 comm="apparmor_parser"
[ 2993.836057] EXT4-fs (sda2): unable to read superblock
[ 2993.842237] EXT4-fs (sda2): unable to read superblock
[ 2993.849180] EXT4-fs (sda2): unable to read superblock
[ 2993.856179] FAT-fs (sda2): invalid media value (0x39)
[ 2993.856192] FAT-fs (sda2): Can't find a valid FAT filesystem
[ 2993.876759] XFS (sda2): Invalid superblock magic number
[ 2993.890830] FAT-fs (sda2): invalid media value (0x39)
[ 2993.890849] FAT-fs (sda2): Can't find a valid FAT filesystem
[ 2993.907427] MINIX-fs: unable to read superblock
[ 2993.913828] attempt to access beyond end of device
[ 2993.913841] sda2: rw=16, want=3, limit=2
[ 2993.913851] hfsplus: unable to find HFS+ superblock
[ 2993.920820] qnx4: no qnx4 filesystem (no root dir).
[ 2993.926967] ufs: You didn't specify the type of your ufs filesystem

mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...

>>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[ 2993.940394] hfs: can't find a HFS filesystem on dev sda2
[ 3039.949647] audit: type=1400 audit(1430243708.663:40): apparmor="STATUS" operation="profile_replace" name="/usr/lib/cups/backend/cups-pdf" pid=5275 comm="apparmor_parser"
[ 3039.949668] audit: type=1400 audit(1430243708.663:41): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/cupsd" pid=5275 comm="apparmor_parser"
[ 3039.960604] audit: type=1400 audit(1430243708.676:42): apparmor="STATUS" operation="profile_replace" name="third_party" pid=5275 comm="apparmor_parser"
[ 9265.005906] usb 1-2: new high-speed USB device number 4 using ehci-pci
[ 9265.131405] usb 1-2: New USB device found, idVendor=058f, idProduct=6366
[ 9265.131425] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9265.131439] usb 1-2: Product: Mass Storage Device
[ 9265.131451] usb 1-2: Manufacturer: Generic
[ 9265.131463] usb 1-2: SerialNumber: 058F0O1111B1
[ 9265.405525] usb-storage 1-2:1.0: USB Mass Storage device detected
[ 9265.405824] scsi host2: usb-storage 1-2:1.0
[ 9265.406931] usbcore: registered new interface driver usb-storage
[ 9265.438871] usbcore: registered new interface driver uas
[ 9266.410221] scsi 2:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
[ 9266.411635] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 9266.892135] sd 2:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
[ 9266.893257] sd 2:0:0:0: [sdb] Write Protect is off
[ 9266.893273] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 9266.894373] sd 2:0:0:0: [sdb] No Caching mode page found
[ 9266.894385] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 9266.909425]  sdb: [CUMANA/ADFS] sdb1 [ADFS] sdb1
[ 9266.914006] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 9473.723355] usb 1-2: USB disconnect, device number 4
[ 9478.755845] usb 1-2: new high-speed USB device number 5 using ehci-pci
[ 9478.881334] usb 1-2: New USB device found, idVendor=058f, idProduct=6366
[ 9478.881353] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9478.881367] usb 1-2: Product: Mass Storage Device
[ 9478.881379] usb 1-2: Manufacturer: Generic
[ 9478.881391] usb 1-2: SerialNumber: 058F0O1111B1
[ 9478.883369] usb-storage 1-2:1.0: USB Mass Storage device detected
[ 9478.883796] scsi host3: usb-storage 1-2:1.0
[ 9479.886895] scsi 3:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
[ 9479.888376] sd 3:0:0:0: Attached scsi generic sg1 type 0
[ 9480.368965] sd 3:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
[ 9480.370089] sd 3:0:0:0: [sdb] Write Protect is off
[ 9480.370106] sd 3:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 9480.371325] sd 3:0:0:0: [sdb] No Caching mode page found
[ 9480.371342] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[ 9480.390116]  sdb: [CUMANA/ADFS] sdb1 [ADFS] sdb1
[ 9480.396934] sd 3:0:0:0: [sdb] Attached SCSI removable disk

Here are the partition details:

    fdisk -l

Disk /dev/sda: 149,1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000b890e

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 308406271 308404224 147,1G 83 Linux
/dev/sda2       308408318 312580095   4171778     2G  5 Extended
/dev/sda5       308408320 312580095   4171776     2G 82 Linux swap / Solaris

Disk /dev/sdb: 7,4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000a4ed9

Device     Boot    Start      End  Sectors   Size Id Type
/dev/sdb1           8192   242187   233996 114,3M  e W95 FAT16 (LBA)
/dev/sdb2         245760 15458303 15212544   7,3G 85 Linux extended
/dev/sdb3       15458304 15523839    65536    32M 83 Linux
/dev/sdb5         253952   376831   122880    60M  c W95 FAT32 (LBA)
/dev/sdb6         385024 15458303 15073280   7,2G 83 Linux

Partition table entries are not in disk order.

Gparted also says that there's a problem with superblock...

Trying deroberts suggestion:

mknod sdb6 b 8 22

This succeeded cause there was no error

Next:

e2fsck ./sdb6
e2fsck 1.42.10 (18-May-2014)
e2fsck: Kein passendes Gerät bzw. keine passende Adresse gefunden beim Versuch, ./sdb6 zu öffnen
Möglicherweise ist die Partition nicht vorhanden oder eine Swap-Partition?

Translation

No fitting device or no fitting address found while trying to open ./sdb6 Maybe the partition doesn't exist or it's a swap partition?
Braiam
  • 35,991

1 Answers1

0

The filesystem has gone likely read-only due to same damage, as you've guessed. fsck should fix it.

Since you care about your data, and it's a relatively small device, I recommend taking a full disk image first, with something like cp /dev/sdb /root/sdcard-backup.img or pv -pterb -s 7948206080 /dev/sdb > /root/sdcard-backup.img if you have pv.

When you tried to use another machine to run fsck, it failed to see the partitions. The kernel log actually leads to an explanation, though its buried and easy to miss:

[ 9480.368965] sd 3:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
⋮
[ 9480.390116]  sdb: [CUMANA/ADFS] sdb1 [ADFS] sdb1
[ 9480.396934] sd 3:0:0:0: [sdb] Attached SCSI removable disk

I've boldfaced it there. It turns out that Linux looks for CUMANA partition tables before DOS ones and, unfortunately, a CUMANA partition table signature is one byte different—so falsely detecting one is fairly common (1256 if the data is random). There was a kernel bug filed on the false detection; the solution from the kernel folks is, basically, that partition format shouldn't generally be enabled.

Your kernel, unfortunately, has CONFIG_ACORN_PARTITION_CUMANA enabled. You could switch to a different kernel that does not or recompile your kernel without that option. I've checked the Debian Jessie kernel does not enable that option—so using a Jessie kernel (one option is Debian Live), you should see the partitions and be able to fsck.

Once you've done that, your Raspberry Pi should boot again. Depending on the exact corruption some files may need replacing, of course.

derobert
  • 109,670