ChangeLog, mke2fs.c:
mke2fs.c (PRS): Add a much more specific error message if the
filesystem size is defaulted and get_device_size returns a size of
zero. Otherwise, users get a confusing "invalid argument while passed
to ext2 library" error message.
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 3026f4c..5d012c1 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -949,8 +949,22 @@
"must specify\nthe size of the "
"filesystem\n"));
exit(1);
- } else
+ } else {
+ if (dev_size == 0) {
+ com_err(program_name, 0,
+ _("Device size reported to be zero. "
+ "Invalid partition specified, or\n\t"
+ "partition table wasn't reread "
+ "after running fdisk, due to\n\t"
+ "a modified partition being busy "
+ "and in use. You may need to reboot\n\t"
+ "to re-read your partition table.\n"
+ ));
+ exit(1);
+ }
param.s_blocks_count = dev_size;
+ }
+
} else if (!force && (param.s_blocks_count > dev_size)) {
com_err(program_name, 0,
_("Filesystem larger than apparent filesystem size."));