Sd-Card

如何修復超頻的microsdcard?

  • May 1, 2015

我昨天自己超頻了我的樹莓派 2。但是我也增加了 sd_freq。現在重新啟動後,我的 microsdcard 被安裝為只讀。我有一台安裝了 linux 的筆記型電腦,我可以嘗試修復它。

這是 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?

那是德語。它的翻譯是:

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

但是,如果我執行dmesg,我知道筆記型電腦看到 microsdcard 有錯誤:

   [ 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

以下是分區詳情:

   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 還說 superblock 有問題……

嘗試 deroberts 的建議:

mknod sdb6 b 8 22

這成功了,因為沒有錯誤

下一個:

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?

翻譯

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?

正如您所猜測的,由於相同的損壞,文件系統可能已變為只讀。fsck應該修復它。

由於您關心您的數據,而且它是一個相對較小的設備,我建議您先拍攝一個完整的磁碟映像,cp /dev/sdb /root/sdcard-backup.img如果pv -pterb -s 7948206080 /dev/sdb > /root/sdcard-backup.img您有pv.

當您嘗試使用另一台機器執行fsck時,它無法看到分區。核心日誌實際上導致了一個解釋,儘管它被隱藏並且容易錯過:

[9480.368965] sd 3:0:0:0: [sdb] 15523840 512 字節邏輯塊:(7.94 GB/7.40 GiB)
⋮
[9480.390116] sdb:[ **CUMANA** /ADFS] sdb1 [ADFS] sdb1
[9480.396934] sd 3:0:0:0: [sdb] 附加的 SCSI 可移動磁碟

我在那裡加粗了。事實證明,Linux 在 DOS 分區表之前查找 CUMANA 分區表,不幸的是,CUMANA 分區表簽名是一個字節的不同——因此錯誤地檢測到一個字節是相當普遍的(如果數據是隨機的,則為1 ⁄ 256 )。錯誤檢測存在核心錯誤;核心人員的解決方案基本上是不應該啟用分區格式。

不幸的是,您的核心已CONFIG_ACORN_PARTITION_CUMANA啟用。如果沒有該選項,您可以切換到不使用或重新編譯核心的不同核心。我檢查了 Debian Jessie 核心沒有啟用該選項——所以使用 Jessie 核心(一個選項是Debian Live),您應該可以看到分區並且能夠fsck.

完成此操作後,您的 Raspberry Pi 應該會再次啟動。當然,根據確切的損壞情況,某些文件可能需要替換。

引用自:https://unix.stackexchange.com/questions/198923