2

When I boot up my laptop (with only opensuse installed, no other OS on it), I'm greeted with error: failure reading sector 0x802 from 'hd0'. and get put into GRUB rescue prompt.

I used the original installation USB to boot up a rescue Linux system. This is fdisk - l output from the rescue shell (the disk is the 1TB HDD that arrived with the laptop, only half of it has been partitioned and in use): IMG-20200312-195659-1584025922398.jpg

sda1 is the 30 GB partition with Opensuse in it, sda3 is a 350+ GB data partition. Trying fsck /dev/sda1 gives

fsck.ext2: Input/output error while trying to open /dev/sda1

The superblock could not be read or does not describe a valid ext2/ext3/ext4 filesystem.

This is followed by a suggestion to "try running e2fsck with an alternate superblock" (note: fsck on sda3 says "clean"). Running dumpe2fsck as suggested on the Opensuse wiki returns the same error message as above. I tried e2fsck -b <superblock> /dev/sda1 - with superblock as 8193 (said "Bad magic number in superblock"), and with superblock as 32768, which resulted in prompts to fix "Free blocks count", "Directories count", "Free inodes count" in many different groups (with a huge list of "Inode bitmap differences" in-between). But unfortunately, even the latter ultimately says "Error writing block 1 (Input/output error)" and doesn't fix the issue.

The whole saga started when the OS hung mid shutdown, and (in an attempt to save battery life) I force killed it by long-pressing the power button. I have looked under the hood and there doesn't seem to be any cable issues (and the other partitions show up fine anyway). Losing the 30GB OS partition would be an inconvenience, but losing the 380 GB data partition would be a major setback I'd rather avoid. What are the next steps to recover from this error and make the disk usable again?

JW0914
  • 9,096
Sundar R
  • 1,539

2 Answers2

3

The problem seems to be with the superblock of partition /dev/sda1. Selected links on the superblock are listed below.

You are in a good position, since the partition of most interest to you (/dev/sda3) seems ok. So you would:

  1. Backup contents of /dev/sda3 (the essential part).

  2. Get back to normal by

    2.1. Try repairing your system.

    2.2. Reinstalling from scratch and recovering your backup.

For step 1, you could well work with the remaining unformatted 500Gb as the backup storage (it should be ok), after booting from a Live CD/USB and suitably formatting the space. Nevertheless, to be on the safe side, you could get an external disk (recommended). The extra space actually needed is not ~380Gb, but it depends on the amount of data to be backed up from /dev/sda3. Even though it is likely irrelevant, as an external disk (or your new partition) will likely have 500Gb+, I mention this finer figure just in case it makes a difference to you.

Once you have booted in your new system, you could mount /dev/sda3, and backup your data. Use rsync, or tar to copy a directory structure, e.g.

For step 2.2, you surely know how to do it.

For step 2.1, this is an oft-quoted guide.

PS: Next time you face a "The whole saga ..."-type of problem (or others), remember The magic SysRq key (mostly REISUB).

PS2: Here, a warning on the use of TestDisk. Although it most often works like a charm.


On the superblock:
JW0914
  • 9,096
2

Buy a new disk and use ddrescue to copy the partitions. Booting from new disk after that will not experience sector errors, any FS errors can be fixed with fsck. Boot problems will be fixable using GRUB.

ArunasR
  • 212