데모

데모

SD 카드에 몇 가지 문제가 있는데 문제를 해결할 수 없습니다.
그놈 디스크에서 디스크는 다음과 같습니다: 우분투 디스크

을 실행하면 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.

그런데 파티션을 다시 확인해 보니 여전히 똑같습니다. 모든 파티션을 하나씩 삭제한 다음 새로운 빈 GUID 파티션 테이블을 만들려고 했지만 글을 쓴 후 다음과 같은 결과를 얻었습니다.

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

그런데 파티션을 다시 확인해 보니 여전히 똑같습니다. 하이브리드 MBR과 손상된 GPT 때문인 것 같습니다. 두 테이블을 동시에 삭제할 수 있는 방법이 있나요? 아니면 이 문제를 해결하려면 어떻게 해야 합니까?

미리 감사드립니다

답변1

나는 실제로 최근에 이와 같은 문제를 겪었습니다. SD 카드가 일종의 쓰기 금지 모드에 있을 수 있습니다. 가능한 원인들:

  1. 플래시 메모리가 마모되어 더 이상 쓸 수 없습니다. (이건 나쁘다!)
  2. 물리적 쓰기 방지 스위치가 활성화되었을 수 있습니다. (다시 쓰기를 활성화하려면 전원을 끄세요.)

내 경우에는 플래시 메모리가 실패한 후 플래시 디스크 컨트롤러가 내 쓰기를 자동으로 삭제했기 때문에 쓰기가 성공한 것처럼 보이더라도 다음 읽기에서 손상된 파티션 테이블이 다시 나타났습니다.

SD 카드가 이와 같이 작동하는 경우 오류가 발생한 것일 가능성이 높으므로 새 카드를 구입해야 합니다.

쓰기 방지 스위치가 활성화된 경우 Linux가 플래시 디스크나 SD 카드가 쓰기 금지되어 있는지 감지할 수 있으므로 일종의 "읽기 전용" 알림이 표시되기 때문에 첫 번째 문제가 발생한 것으로 의심됩니다. (보다 /var/log/syslog)

쓰기 금지된 플래시 드라이브의 예 /dev/sdc:

5월 29일 18:26:44 데모 커널: [32319.722491] scsi 2:0:0:0: Direct-Access 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.0GB/14.9GiB)
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].|
    

관련 정보