diff --git a/extendedcommands.c b/extendedcommands.c index af67c3e..43d449a 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -25,6 +25,7 @@ #include "cutils/properties.h" #include "firmware.h" #include "install.h" +#include "make_ext4fs.h" #include "minui/minui.h" #include "minzip/DirUtil.h" #include "roots.h" @@ -507,8 +508,13 @@ int format_device(const char *device, const char *path, const char *fs_type) { } if (strcmp(fs_type, "ext4") == 0) { + int length = 0; + if (strcmp(v->fs_type, "ext4") == 0) { + // Our desired filesystem matches the one in fstab, respect v->length + length = v->length; + } reset_ext4fs_info(); - int result = make_ext4fs(device, NULL, NULL, 0, 0, 0); + int result = make_ext4fs(device, length); if (result != 0) { LOGE("format_volume: make_extf4fs failed on %s\n", device); return -1;