0

I'm trying to recover a disk which appears to have a corrupt ID for the protective MBR.

Yesterday I took a backup of the GPT and protective MBR, and dumped to file.

At that time fdisk reported the MBR type ID as 83, where it should be EE for a protective MBR.

Thanks to a great set of pages at http://www.rodsbooks.com/gdisk/gdisk.html I decided the best course of action was:

  1. invoke gdisk and select the GPT option (it was showing MBR as present, but not in protective mode). I understand selecting GPT creates a fresh protective MBR.
  2. write the table to disk, restoring the protective MBR.

So, I attempted it today, but something changed overnight, and now gdisk shows:

GPT fdisk (gdisk) version 0.8.8

Type device filename, or press <Enter> to exit: /dev/sdc
Warning! Read error 5; strange behavior now likely!
Warning! Read error 5; strange behavior now likely!
Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

(Overnight, I did have photorec running, and today decided to kill it - I didn't think it was intrusive, but wonder if that had anything to do with the change in status reported by gdisk. If not, then possibly the disk really is rotting badly.)

Anyway, I loaded my backed-up GPT and partitions look fine:

Recovery/transformation command (? for help): l
Enter backup filename to load: sdb_gpt.txt

Recovery/transformation command (? for help): p
Disk /dev/sdc: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 503CCEC8-87B4-4A12-B19B-1B1D224C216E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2925 sectors (1.4 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         3905535   1.9 GiB     EF02  
   2         3905536        11718655   3.7 GiB     8200  
   3        11718656      5761718271   2.7 TiB     0700  
   4      5761718272      5860532223   47.1 GiB    8300  

Recovery/transformation command (? for help): o

Disk size is 5860533168 sectors (2.7 TiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   4294967295   primary     0xEE

BUT.... I cannot write it out:

Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdc.
Unable to save backup partition table! Perhaps the 'e' option on the experts'
menu will resolve this problem.
Warning! An error was reported when writing the partition table! This error
MIGHT be harmless, or the disk might be damaged! Checking it is advisable.

I feel like I'm close to fixing. Why would gdisk fail to write out? Is there anything I can do to fix the disk at a lower level?

Could/should I erase the MBR and partition table at the start of the disk, and then retry the write?

swedishhh
  • 103
  • 1
  • 2
  • 7
  • You are working on drive sdc, but mention you used sdb_gpt.txt. Hope that was a typo here only, and not wrong backup. – oldfred Jan 05 '16 at 15:51
  • Well spotted oldfred, its just that I created the backup whilst it was on b. Thanks for comment. – swedishhh Jan 05 '16 at 21:58

1 Answers1

3

Linux's error #5 is an I/O error. This almost always signifies failing hardware, which is also consistent with your other symptoms. I recommend you check the disk's SMART status to see if it's failing. If SMART says the disk is OK, you could try replacing its cable or moving it to a different SATA port (if the computer's a desktop), since bad cables and connectors can sometimes cause problems. If the SMART results look bad or if a cable swap doesn't help, you may need to replace the disk.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • Thanks for comment Rod, and thanks for the excellent resources you have built up. I understand so much more now. I've already replaced the disk, recognising that I've lost some data (only some - a recent rsync backup has vast majority), however I'll give the SMART route a go - it would be useful to learn a little more, and there's the chance I complete the data recovery. I'll post back in due course once I get round to it. – swedishhh Jan 05 '16 at 22:02