recovery_utils: add support for unmounting entire volumes
When wiping /system, the partition isn't actually mounted at /system
or / - it's mounted at /mnt/system. This breaks 'format system' from
recovery if the partition has been mounted.
This patch adds an ensure_volume_unmounted function that finds all
mounts of a given device and unmounts them, meaning the device
can be safely formatted.
Change-Id: Id4f727f845308a89e865f1ba60dc284f5ebc66e1
diff --git a/install/wipe_data.cpp b/install/wipe_data.cpp
index 024c1e1..57565e2 100644
--- a/install/wipe_data.cpp
+++ b/install/wipe_data.cpp
@@ -47,7 +47,11 @@
ui->Print("Formatting %s...\n", volume);
- ensure_path_unmounted(volume);
+ Volume* vol = volume_for_mount_point(volume);
+ if (ensure_volume_unmounted(vol->blk_device) == -1) {
+ PLOG(ERROR) << "Failed to unmount volume!";
+ return false;
+ }
int result = format_volume(volume);