2

I can access the Huawei P9 on Win10 with adb, and shell into it, but that is with the phone booted into OS. I want to run a filesystem scan (e2fsck), but need un-mounted partitions for that.

I read a thread where someone was running e2fsck from recovery on his phone using adb shell.

If I boot the phone into recovery using adb, I get Reboot / Factory reset / Wipe Cache on menu, but phone is inaccessible on PC (adb or fastboot). Booting phone into bootloader via adb or directly on phone, also inaccessible via adb or fastboot. Shell seems only to be accessible when Android is booted.

Any ideas?

5
  • I know I can't unmount during runtime, so how do I run e2fsck? Scan @ reboot like other computers? But how? Or how do I shell into phone before boot (before mount)? – Rupert Dec 1 '20 at 8:53
  • 2
    You don't need to run filesystem checks manually. Android (vold) runs this automatically on every boot before mounting the filesystem: android.googlesource.com/platform/system/vold/+/refs/tags/… – Irfan Latif Dec 1 '20 at 14:14
  • @alecxs My problem is more that my old Huawei P9 lite seems to have problems accessing storage..... Symtoms: the main screen icons don't always appear on bootup. If they don't appear, I turn off screen, screen on/unlock. Icons there. When my son is playing a game on this old phone, game sometimes will crash/disappear. Reloading works. Crashing is not often. I think Irfan Latif basically answered my question with the "default scan @ reboot" BTW I did find e2fsck through adb shell, somewhere like /system/bin/e2fsck. However naturally no permissions to run it. – Rupert Dec 2 '20 at 9:28
  • How do I mark Irfan Latifs post as Answer? – Rupert Dec 2 '20 at 9:36
  • TWRP is available. for bootloader unlock remove google account, enable OEM unlocking in Developer Options and try 'fastboot oem unlock UUUUUUUUUUUUUUUU' (= factory reset). if that code doesn't work you can buy unlock code from dc unlocker – alecxs Dec 2 '20 at 23:11
1

Usually you don't need to run filesystem checks manually. Android runs this on every boot before mounting the filesystem (ref). So is the case with external storage (see this answer). However exceptions may exist:

"Some system images do not have e2fsck for licensing reasons (e.g. recent SDK system images). Detect these and skip the check."

So you can check if /system/bin/e2fsck (or /system/bin/fsck.f2fs, whatever applicable) exits on your device. Or check logcat after some repeated reboots to confirm if filesystem check was run (usually in vold or fs_mgr log).

If I boot the phone into recovery using adb, I get Reboot / Factory reset / Wipe Cache on menu, but phone is inaccessible on PC (through adb or fastboot).

You are booting into stock recovery provided by your OEM. But in order to run commands (including fsck) on adb shell or terminal emulator you need a custom recovery (like TWRP). Note that flashing custom recovery requires unlocking bootloader which is not supported on many devices (including all of the recent Huawei devices).
fastboot protocol is only available in bootloader mode (on supported devices), so not relevant here.

If you are sure that filesystem check is not being run on your device but it's required (due to filesystem errors), you can do a factory reset which recreates the /data filesystem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.