From edee8361d75715b9bc020d76fa8f38b005a6e912 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 16 May 2018 13:43:22 -0700 Subject: recovery: add --fsck_unshare_blocks option for adb remount Allow "adb remount" on deduplicated filesystems to reboot into recovery and run e2fsck to undo deduplication. The e2fsck binary is copied from the system partition into tmpfs, and the system partition is unmounted so e2fsck can run safely. Bug: 64109868 Test: recovery with --fsck_unshare_blocks; adb remount Change-Id: I7558749b018b58f3c4339e51a95831dbd5be1ae3 --- recovery.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'recovery.cpp') diff --git a/recovery.cpp b/recovery.cpp index 56b2567d1..98cbfed2f 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -55,6 +55,7 @@ #include "adb_install.h" #include "common.h" #include "device.h" +#include "fsck_unshare_blocks.h" #include "fuse_sdcard_provider.h" #include "fuse_sideload.h" #include "install.h" @@ -969,6 +970,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector(arg.c_str()); }); static constexpr struct option OPTIONS[] = { + { "fsck_unshare_blocks", no_argument, nullptr, 0 }, { "just_exit", no_argument, nullptr, 'x' }, { "locale", required_argument, nullptr, 0 }, { "prompt_and_wipe_data", no_argument, nullptr, 0 }, @@ -997,6 +999,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vectorPrint("Rebooting automatically.\n"); } + } else if (fsck_unshare_blocks) { + if (!do_fsck_unshare_blocks()) { + status = INSTALL_ERROR; + } } else if (!just_exit) { // If this is an eng or userdebug build, automatically turn on the text display if no command // is specified. Note that this should be called before setting the background to avoid -- cgit v1.2.3