Created attachment 357927 [details]
The -t option takes a parameter, but mke2fs in RHEL 5.4 Beta
ignores it because of a small bug in the optstring.
I'll cut straight to the patch.
(In reply to comment #0)
> The -t option takes a parameter, but mke2fs in RHEL 5.4 Beta
> ignores it because of a small bug in the optstring.
mke2fs in rhel5 does not really accept the -t option much ;) and when it does, it takes no parameter:
case 'c': /* Check for bad blocks */
case 't': /* deprecated */
In this older version of mke2fs, -t is equivalent to -c, which is "check for bad blocks." It's not doc'd in the manpage, though unfortunately it does show up in the usage():
fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] "
"[-f fragment-size]\n\t[-i bytes-per-inode] [-j] [-J journal-options]"
" [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] "
"[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] "
"[-M last-mounted-directory] [-O feature[,...]]\n\t"
"[-r fs-revision] [-R options] [-qvSV] device [blocks-count]\n"),
You may be thinking of the "-t fs-type" option which was added in later upstream e2fsprogs, which may be unfortunately confusing...
Created attachment 357957 [details]
I should probably say why we hit this. We had a Fedora script
which did something along the lines of:
/sbin/mke2fs -t ext3 /dev/hdx1
When we tried porting it to RHEL it gaves the rather obscure
mke2fs: invalid blocks count - /dev/hdx1
It took us quite a long time to work out what was going on,
including running mke2fs from RHEL under a debugger, when we
found this issue.
(Try a search for http://www.google.co.uk/search?q=mke2fs+invalid+blocks
and you'll see lots of people confused by this error
The nature of the script meant it wasn't particularly easy
to solve this ("ext3" came from user input). However since
filing the bug we discovered e4fsprogs / mke4fs on RHEL 5
so that is sufficient for us for now.
Anyhow, may I suggest the attached patch which makes the
error message clearer.
Sigh, yep, recycling the option was unfortunate.
Please be aware that mke4fs in rhel5 is still tech preview though, if that affects your planned usage at all.
Hrm some of those google-able instances seem to be another (related) problem, with the mkfs binary itself; "mkfs -c -t ext3" passes the -t through:
execve("/sbin/mkfs.ext2", ["mkfs.ext2", "-c", "-t", "ext3", "fsfile"]
while "mkfs -t ext3" does not:
execve("/sbin/mkfs.ext3", ["mkfs.ext3", "fsfile"]
Better error reporting would be good, and appropriate for upstream as well I suppose.
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".
I think we just live with this one. It properly errors out with incorrect invocation either way:
# misc/mke2fs -t ext3 fsfile
mke2fs: invalid blocks count - fsfile
ext3: No such file or directory
Especially given that '-t' isn't even documented (since it's deprecated) I'm not sure that offers any more clues as to what's gone wrong.
After such a usage error, I expect the user would consult the man page and find out that they should not be using "-t"
If you feel strongly otherwise, please reopen...