デモ

デモ

問題のある SD カードがあり、修正できませんでした。GNOME
ディスクではディスクは次のようになります。 Ubuntu ディスク

を実行するとgdisk /dev/sdb、次の出力が得られます。

sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.3

Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
MBR: hybrid
BSD: not present
APM: not present
GPT: damaged

Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.

どのパーティション テーブルを使用すればよいかわかりませんが、GPT を使用しました (空の GPT を作成しても役に立ちませんでした)。パーティションは次のようになります。

Command (? for help): p
Disk /dev/sdb: 125067264 sectors, 59.6 GiB
Model: Multi-Card      
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 76A0F070-E171-475B-9409-53840D61AD12
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 4194270
Partitions will be aligned on 2048-sector boundaries
Total free space is 671677 sectors (328.0 MiB)


Number  Start (sector)    End (sector)  Size       Code  Name
1            2048           67583   32.0 MiB    0C01  hassos-boot
2           67584          116735   24.0 MiB    8300  hassos-kernel0
3          116736          641023   256.0 MiB   8300  hassos-system0
4          641024          690175   24.0 MiB    8300  hassos-kernel1
5          690176         1214463   256.0 MiB   8300  hassos-system1
6         1214464         1230847   8.0 MiB     8300  hassos-bootstate
7         1230848         1427455   96.0 MiB    8300  hassos-overlay
8         1427456         3524607   1024.0 MiB  8300  hassos-data

ディスクを検証したいときに、この情報が表示されます:

Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.

Problem: The secondary header's self-pointer indicates that it does not reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.

Identified 2 problems!

私はこれらの問題をなんとか解決することができ、その後、次のようなメッセージを受け取りました:

No problems found. 121544637 free sectors (58.0 GiB) available in 2
segments, the largest of which is 121542623 (58.0 GiB) in size.

しかし、書いた後に次のようになりました:

 OK: writing new GUID partition table (GPT) to /dev/sdb.
 The operation has completed successfully.

しかし、パーティションを再度確認すると、まだ同じです。すべてのパーティションを 1 つずつ削除して、新しい空の GUID パーティション テーブルを作成しようとしましたが、次のように書き込んだ後、次のようになりました。

OK: writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.

しかし、パーティションを再度確認すると、まだ同じです。ハイブリッド MBR と破損した GPT が原因だと思います。これらのテーブルの両方を同時に削除する方法はありますか? または、この問題を解決するためにまだ何ができますか?

前もって感謝します

答え1

実は私も最近同じ問題に遭遇しました。SD カードが何らかの書き込み禁止モードになっている可能性があります。考えられる原因:

  1. フラッシュメモリが消耗し、書き込みができなくなりました。(これはまずい!)
  2. 物理的な書き込み保護スイッチが有効になっている可能性があります。(書き込みを再度有効にするには、スイッチをオフにしてください。)

私の場合、フラッシュ ディスク コントローラはフラッシュ メモリに障害が発生した後、書き込みを黙って破棄していたため、書き込みが成功したように見えても、次の読み取り時に破損したパーティション テーブルが戻ってしまいました。

SD カードがこのように動作する場合、故障している可能性が高いので、新しいカードを入手する必要があります。

最初の問題が発生しているのは、書き込み保護スイッチがアクティブになっている場合、フラッシュ ディスクまたは SD カードが書き込み保護されているかどうかを Linux が検出できるため、何らかの「読み取り専用」通知が表示されるためではないかと思われます。(参照/var/log/syslog)

書き込み禁止のフラッシュドライブの例/dev/sdc:

5月29日 18:26:44 デモカーネル: [32319.722491] scsi 2:0:0:0: ダイレクトアクセス NA NA 1.26 PQ: 0 ANSI: 5
5月29日 18:26:44 デモカーネル: [32319.723377] sd 2:0:0:0: SCSI汎用SG1タイプ0を接続
5月29日 18:26:44 デモカーネル: [32319.724325] sd 2:0:0:0: [sdc] 31266816 512バイトの論理ブロック: (16.0 GB/14.9 GiB)
5月29日 18:26:44 デモカーネル: [32319.725131] sd 2:0:0:0: [sdc] 書き込み保護がオンです
5月29日 18:26:44 デモカーネル: [32319.725137] sd 2:0:0:0: [sdc] モードセンス: 43 00 80 00
5月29日 18:26:44 デモカーネル: [32319.725389] sd 2:0:0:0: [sdc] 書き込みキャッシュ: 無効、読み取りキャッシュ: 有効、DPO または FUA をサポートしていません
5月29日 18:26:44 デモカーネル: [32319.737297] sdc: sdc1
5月29日 18:26:44 デモカーネル: [32319.739266] sd 2:0:0:0: [sdc] SCSIリムーバブルディスクが接続されました

デモ

/dev/sdb書き込みを黙って破棄する壊れたフラッシュドライブでした。

  1. パーティション テーブルを消去してみました:

    root@demo [~]# gdisk /dev/sdb
    GPT fdisk (gdisk) version 1.0.3
    
    Caution: invalid backup GPT header, but valid main header; regenerating
    backup header from main header.
    
    Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
    on the recovery & transformation menu to examine the two tables.
    
    Warning! One or more CRCs don't match. You should repair the disk!
    
    Partition table scan:
      MBR: hybrid
      BSD: not present
      APM: not present
      GPT: damaged
    
    Found valid MBR and corrupt GPT. Which do you want to use? (Using the
    GPT MAY permit recovery of GPT data.)
     1 - MBR
     2 - GPT
     3 - Create blank GPT
    
    Your answer: 2
    
    Command (? for help): p
    Disk /dev/sdb: 7897087 sectors, 3.8 GiB
    Model: USB Flash Disk
    Sector size (logical/physical): 512/512 bytes
    Disk identifier (GUID): 5904C65E-B410-474D-B22F-9FEA7E3582C2
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 7897053
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 2014 sectors (1007.0 KiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
       2            4096          106495   50.0 MiB    EF00  EFI System
       3          106496         7897053   3.7 GiB     8300  Linux filesystem
    
    Command (? for help): x
    
    Expert command (? for help): z
    About to wipe out GPT on /dev/sdb. Proceed? (Y/N): y
    GPT data structures destroyed! You may now partition the disk using fdisk or
    other utilities.
    Blank out MBR? (Y/N): y
    
  2. 不良パーティション テーブルがすぐに返されました:

    root@demo [~]# gdisk /dev/sdb
    GPT fdisk (gdisk) version 1.0.3
    
    Caution: invalid backup GPT header, but valid main header; regenerating
    backup header from main header.
    
    Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
    on the recovery & transformation menu to examine the two tables.
    
    Warning! One or more CRCs don't match. You should repair the disk!
    
    Partition table scan:
      MBR: hybrid
      BSD: not present
      APM: not present
      GPT: damaged
    
    Found valid MBR and corrupt GPT. Which do you want to use? (Using the
    GPT MAY permit recovery of GPT data.)
     1 - MBR
     2 - GPT
     3 - Create blank GPT
    
    Your answer:
    
  3. ディスクの先頭を消去してddも効果はありませんでした:

    root@demo [~]# hexdump -C /dev/sdb | head
    00000000  eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00  |.c..............|
    00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000050  00 00 00 00 00 00 00 00  00 00 00 80 00 08 00 00  |................|
    00000060  00 00 00 00 ff fa 90 90  f6 c2 80 74 05 f6 c2 70  |...........t...p|
    00000070  74 02 b2 80 ea 79 7c 00  00 31 c0 8e d8 8e d0 bc  |t....y|..1......|
    00000080  00 20 fb a0 64 7c 3c ff  74 02 88 c2 52 bb 17 04  |. ..d|<.t...R...|
    00000090  f6 07 03 74 06 be 88 7d  e8 17 01 be 05 7c b4 41  |...t...}.....|.A|
    000000a0  bb aa 55 cd 13 5a 52 72  3d 81 fb 55 aa 75 37 83  |..U..ZRr=..U.u7.|
    000000b0  e1 01 74 32 31 c0 89 44  04 40 88 44 ff 89 44 02  |[email protected].|
    root@demo [~]# dd if=/dev/zero of=/dev/sdb bs=1M count=1 status=progress
    1+0 records in
    1+0 records out
    1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0219383 s, 47.8 MB/s
    root@demo [~]# hexdump -C /dev/sdb | head
    00000000  eb 63 90 00 00 00 00 00  00 00 00 00 00 00 00 00  |.c..............|
    00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000050  00 00 00 00 00 00 00 00  00 00 00 80 00 08 00 00  |................|
    00000060  00 00 00 00 ff fa 90 90  f6 c2 80 74 05 f6 c2 70  |...........t...p|
    00000070  74 02 b2 80 ea 79 7c 00  00 31 c0 8e d8 8e d0 bc  |t....y|..1......|
    00000080  00 20 fb a0 64 7c 3c ff  74 02 88 c2 52 bb 17 04  |. ..d|<.t...R...|
    00000090  f6 07 03 74 06 be 88 7d  e8 17 01 be 05 7c b4 41  |...t...}.....|.A|
    000000a0  bb aa 55 cd 13 5a 52 72  3d 81 fb 55 aa 75 37 83  |..U..ZRr=..U.u7.|
    000000b0  e1 01 74 32 31 c0 89 44  04 40 88 44 ff 89 44 02  |[email protected].|
    

関連情報