Filesystem corruption

Hi everyone,

I’m running OSMC on RPI3 with an external 2TB usb HDD.
It OSMC crashed during playback and I had to restart it.
After the restart I was greeted with the following screen:

Waiting for root filesystem device /dev/mmcblk0p2
/dev/mmcblk0p2: recovering journal
/dev/mmcblk0p2: Superblock needs recovery flag is clear, but journal has data.
/dev/mmcblk0p2: Run journal anyway

/dev/mmcblk0p2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
(i.e., without -a or -p options)
Serous file system corruption found. We will do our best to repair this now.

e2fsck 1.43.7 (16-Oct-2017)
/dev/mmcblk0p2: recovering journal
Superblock needs recovery flag is clear, but journal has data.
Run journal anyway? yes

/bin/e2fsck: Unknown code ____ 251 while recovering journal of /dev/mmcblk0p2
/bin/e2fsck: unable to set superblock flags on /dev/mmcblk0p2

/dev/mmcblk0p2: ********** WARNING: Filesystem still has errors **********

WARNING: OSMC cannot repair the filesystem and serious corruption may still exist. We recommend backing up any critical data and performing a fresh install of OSMC. Attempting to resume startup in 30 seconds.

mount: mounting /dev/mmcblk0p2 on real_root failed: Input/output error
FATAL ERROR: OSMC cannot mount /dev/mmcblk0p2 of ext4 filesystem

  OSMC initramfs Rescue Console.
  For help and support see https://osmc.tv/

/ * _

Is there anything I can do to fix this?

If you have another system running linux, you could connect the SD card to it and try repairing it there. Otherwise you could use a live linux USB stick on your PC (Ubuntu or Mint Live) and try to repair it.

My guess however is that the original crash was not the cause of the corruption, but was caused by corruption; probably a failed SD card or a bad power supply.

It’s there in the error log, that’s really the best solution

Input/output error near the end almost certainly means the SD card has failed. Time for a new SD card and a fresh install.

Perhaps consider a better quality of card as cheaper SD cards don’t last long as a boot file system for an operating system.

Thanks everyone for the suggestions.

I’m not very knowledgeable regarding linux, but I’ll try to restore the card, back it up and then restore the backup to a new card.

I’ve created a live USB stick using Lili USB Creator and ubuntu-15.04-desktop-i386.iso. When I start it, the Oracle VM window pops up, but eventually fails with a message “Exit Portable-VirtualBox. Please do not unplug your key!”
I’ll try to figure this out and when I manage to run Linux, how do I do restore and backup?

@DBMandrake I was using Samsung 32 evo plus. It looks like it lasted close to 1 year. Is this to be expected, or is this low quality card?

The Samsung EVO Plus is a good quality card. If it has indeed failed after only one year, you were either a bit unlucky or it had been given an above-average workout. On average, I’d expect at least two years from such a card but even if it follows a typical bathtub-curve distribution for reliability, there will always be earlier failures.

Don’t forget that it might still be under warranty.

I finally managed to run Ubuntu.

I’ve tried to repair the card:

ubuntu@ubuntu:/$ sudo e2fsck -p -f -v -C 0 /dev/sdd2
e2fsck: Read-only file system while trying to open /dev/sdd2
Disk write-protected; use the -n option to do a read-only
check of the device.
ubuntu@ubuntu:/$ sudo hdparm -r 0 /dev/sdd2

/dev/sdd2:
setting readonly to 0 (off)
readonly = 0 (off)
ubuntu@ubuntu:/$ sudo e2fsck -p -f -v -C 0 /dev/sdd2
e2fsck: Read-only file system while trying to open /dev/sdd2
Disk write-protected; use the -n option to do a read-only
check of the device.

It seems that the card is read only and I haven’t been able to remove that in order to use fsck.

GParted recognizes the card as /dev/sdd with 2 partitions sdd1 and sdd2.
sdd1 is fat32 and 243MB, while sdd2 is ext4 with 29.59GB.
Also, sdd1 is accessible and it contains the following:

Any ideas?

Probably it’s failed read-only.

However, I see that you tried to switch off the read-only flag on partition 2, rather than the whole card:

sudo hdparm -r 0 /dev/sdd2

It’s probably worth repeating the command for the whole SD card:

sudo hdparm -r 0 /dev/sdd

Try and write a file to an RW part of the card and see if it persists.
It’s likely to be dead.

Sam

The SD card is write-protected or at least that’s the way Ubuntu (Gparted) , macOS (Disk Utility) and Windows 10 sees it.
No matter what I do, I can’t remove it.
I’ve used USB card reader and SD card reader with the lock switch off.

@dillthedog I’ve tried hdparm on the whole SD card, but fsck still cannot repair it because it’s write-protected.

@sam_nazarko I’ve tried to copy a text file on it, but it fails. It looks like the card is dead, so I’ll have to buy another one. In order to avoid this scenario in the future, I’ve been looking in the ways to boot rpi from an USB flash drive. Is this supported by OSMC?

See if you can get it replaced under warranty.

You’re right, I should look into it. Thanks!

Yes – use the USB option in the OSMC installer. You’ll still need an SD card present for booting. This has fallen out of favour as SD card performance and reliability has improved greatly.

We also sell an optimised SD card for OSMC in our Store. It comes with a lifetime warranty.

Cheers

Sam

You could try https://www.sdcard.org/downloads/formatter_4/ - but if that fails … well then it’s dead.
Regards
/L

1 Like