"\t\t--nomgs: turn off MGS service on this MDT\n"
"\t\t--writeconf: erase all config logs for this fs.\n"
#endif
- "\t\t--noformat: just report what we would do; "
+ "\t\t--dryrun: just report what we would do; "
"don't write to disk\n"
- "\t\t--verbose\n"
+ "\t\t--verbose : e.g. show mkfs progress\n"
"\t\t--quiet\n",
(int)sizeof(((struct lustre_disk_data *)0)->ldd_userdata));
return;
int run_command(char *cmd, int cmdsz)
{
char log[] = "/tmp/mkfs_logXXXXXX";
- int fd, rc;
+ int fd = -1, rc;
if ((cmdsz - strlen(cmd)) < 6) {
fatal();
return ENOMEM;
}
- if (verbose > 1)
+ if (verbose > 1) {
printf("cmd: %s\n", cmd);
-
- if ((fd = mkstemp(log)) >= 0) {
- close(fd);
- strcat(cmd, " >");
- strcat(cmd, log);
+ } else {
+ if ((fd = mkstemp(log)) >= 0) {
+ close(fd);
+ strcat(cmd, " >");
+ strcat(cmd, log);
+ }
}
strcat(cmd, " 2>&1");
/* Can't use popen because we need the rv of the command */
rc = system(cmd);
- if ((rc || (verbose > 2)) && (fd >= 0)) {
+ if (rc && (fd >= 0)) {
char buf[128];
FILE *fp;
fp = fopen(log, "r");
}
}
- /* Default bytes_per_inode is block size */
+ /* bytes_per_inode: disk size / num inodes */
if (strstr(mop->mo_mkfsopts, "-i") == NULL) {
long bytes_per_inode = 0;
}
}
- /* This is an undocumented mke2fs option. Default is 128. */
+ /* Inode size (for extended attributes) */
if (strstr(mop->mo_mkfsopts, "-I") == NULL) {
long inode_size = 0;
if (IS_MDT(&mop->mo_ldd)) {
{"comment", 1, 0, 'u'},
{"configdev", 1, 0, 'C'},
{"device-size", 1, 0, 'd'},
+ {"dryrun", 0, 0, 'n'},
{"erase-params", 0, 0, 'e'},
{"failnode", 1, 0, 'f'},
{"failover", 1, 0, 'f'},
fatal();
fprintf(stderr, "Unknown option '%c'\n", opt);
}
- usage(stderr);
- return 1;
+ return EINVAL;
}
}//while
- if (optind >= argc) {
+
+ /* Last arg is device */
+ if (optind != argc - 1) {
fatal();
- fprintf(stderr, "Bad arguments\n");
- usage(stderr);
- return 1;
+ fprintf(stderr, "Bad argument: %s\n", argv[optind]);
+ return EINVAL;
}
return 0;