Run e2fsck during vm start
If the VM isn't shutdown gracefully, some blocks
might be corrupted. This would help recover those
during next boot.
Bug: 403381813
Test: Kill the VM when active write I/O going on; boot the VM
Change-Id: Ie53e57ba8d09b10a3dea8c8320f2c3ba92950926
Signed-off-by: Akilesh Kailash <akailash@google.com>
diff --git a/android/TerminalApp/java/com/android/virtualization/terminal/InstalledImage.kt b/android/TerminalApp/java/com/android/virtualization/terminal/InstalledImage.kt
index 7acc5f3..a4663c8 100644
--- a/android/TerminalApp/java/com/android/virtualization/terminal/InstalledImage.kt
+++ b/android/TerminalApp/java/com/android/virtualization/terminal/InstalledImage.kt
@@ -116,11 +116,12 @@
val roundedUpDesiredSize = roundUp(desiredSize)
val curSize = getSize()
+ runE2fsck(rootPartition)
+
if (roundedUpDesiredSize == curSize) {
return roundedUpDesiredSize
}
- runE2fsck(rootPartition)
if (roundedUpDesiredSize > curSize) {
allocateSpace(rootPartition, roundedUpDesiredSize)
}