mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-11-24 02:25:03 +08:00
In mke2fs and e2fsck, specifying the -c option twice will now do
a read/write test on the disk. Update the man pages to encourage using the -c option, and to discouraging running badblocks separately, since users tend to forget to set the blocksize when running badblocks.
This commit is contained in:
parent
5f0fabe6db
commit
3ed57c27df
@ -1,3 +1,17 @@
|
||||
2001-12-24 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* unix.c (PRS): Don't allow the -c and -l/-L options to be
|
||||
specified at the same time.
|
||||
|
||||
* e2fsck.h (E2F_OPT_WRITECHECK), unix.c (PRS),
|
||||
badblocks.c (read_bad_blocks_file): If two -c options are
|
||||
specified, then perform a non-destructive read/write scan
|
||||
of the disk.
|
||||
|
||||
* e2fsck.8.in: Document the double -c option; also encourage users
|
||||
to use -c instead of the -l/-L options since it's too hard
|
||||
for users to get things like the blocksize parameter correct.
|
||||
|
||||
2001-12-23 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* util.c (get_backup_sb): This function now searches for the
|
||||
|
@ -72,8 +72,9 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
|
||||
goto fatal;
|
||||
}
|
||||
} else {
|
||||
sprintf(buf, "badblocks -b %d %s%s %d", fs->blocksize,
|
||||
sprintf(buf, "badblocks -b %d %s%s%s %d", fs->blocksize,
|
||||
(ctx->options & E2F_OPT_PREEN) ? "" : "-s ",
|
||||
(ctx->options & E2F_OPT_WRITECHECK) ? "-n " : "",
|
||||
fs->device_name, fs->super->s_blocks_count);
|
||||
f = popen(buf, "r");
|
||||
if (!f) {
|
||||
|
@ -95,6 +95,8 @@ to run the
|
||||
.BR badblocks (8)
|
||||
program to find any blocks which are bad on the filesystem,
|
||||
and then marks them as bad by adding them to the bad block inode.
|
||||
If this option is specified twice, then the bad block scan will be done
|
||||
using a non-destructive read-write test.
|
||||
.TP
|
||||
.B \-C
|
||||
This option causes
|
||||
@ -127,11 +129,21 @@ time trials.
|
||||
@JDEV@found.
|
||||
.TP
|
||||
.BI \-l " filename"
|
||||
Add the blocks listed in the file specified by
|
||||
Add the block numbers listed in the file specified by
|
||||
.I filename
|
||||
to the list of bad blocks. The format of this file is the same as the
|
||||
one generated by the
|
||||
.BR badblocks (8)
|
||||
program. Note that the block numbers are based on the blocksize
|
||||
of the filesystem. Hence,
|
||||
.BR badblocks (8)
|
||||
must be given the blocksize of the filesystem in order to obtain correct
|
||||
results. As a result, it is much simpler and safer to use the
|
||||
.B -c
|
||||
option to
|
||||
.BR e2fsck ,
|
||||
since it will assure that the correct parameters are passed to the
|
||||
.B badblocks
|
||||
program.
|
||||
.TP
|
||||
.BI \-L " filename"
|
||||
|
@ -102,6 +102,7 @@ struct resource_track {
|
||||
#define E2F_OPT_CHECKBLOCKS 0x0040
|
||||
#define E2F_OPT_DEBUG 0x0080
|
||||
#define E2F_OPT_FORCE 0x0100
|
||||
#define E2F_OPT_WRITECHECK 0x0200
|
||||
|
||||
/*
|
||||
* E2fsck flags
|
||||
|
@ -511,7 +511,8 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
#endif
|
||||
break;
|
||||
case 'c':
|
||||
cflag++;
|
||||
if (cflag++)
|
||||
ctx->options |= E2F_OPT_WRITECHECK;
|
||||
ctx->options |= E2F_OPT_CHECKBLOCKS;
|
||||
break;
|
||||
case 'r':
|
||||
@ -610,11 +611,16 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
||||
if (swapfs) {
|
||||
if (cflag || bad_blocks_file) {
|
||||
fprintf(stderr, _("Incompatible options not "
|
||||
"allowed when byte-swapping.\n"));
|
||||
"allowed when byte-swapping.\n"));
|
||||
exit(FSCK_USAGE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (cflag && bad_blocks_file) {
|
||||
fprintf(stderr, _("The -c and the -l/-L options may "
|
||||
"not be both used at the same time.\n"));
|
||||
exit(FSCK_USAGE);
|
||||
}
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
/*
|
||||
* Set up signal action
|
||||
|
@ -1,5 +1,16 @@
|
||||
2001-12-24 Theodore Tso <tytso@valinux.com>
|
||||
|
||||
* mke2fs.c (main, test_disk): If two -c options are
|
||||
specified, then perform a destructive read/write test
|
||||
of the disk.
|
||||
|
||||
* mke2fs.8.in: Document the double -c option; also encourage users
|
||||
to use -c instead of the -l/-L options since it's too hard
|
||||
for users to get things like the blocksize parameter correct.
|
||||
|
||||
* badblocks.8.in: Encourage users to use the -c option in mke2fs
|
||||
and e2fsck instead of running badblocks directly.
|
||||
|
||||
* mke2fs.c (create_lost_and_found): The lost+found directory is
|
||||
now created with 0700 permissions, since files which get
|
||||
dropped into that directory may have come from a protected
|
||||
|
@ -46,6 +46,28 @@ on the device is used as a default.
|
||||
is an optional parameter specifying the starting block number
|
||||
for the test, which allows the testing to start in the middle of the
|
||||
disk. If it is not specified the first block on the disk is used as a default.
|
||||
.PP
|
||||
.B Important note:
|
||||
If the output of
|
||||
.B badblocks
|
||||
is going to be fed to the
|
||||
.B e2fsck
|
||||
or
|
||||
.B mke2fs
|
||||
programs, it is important that the block size is properly specified,
|
||||
since the block numbers which are generated is very dependent on the
|
||||
block size in use. For this reason, it is strongly recommended that
|
||||
users
|
||||
.B not
|
||||
run
|
||||
.B badblocks
|
||||
directly, but rather use the
|
||||
.B \-c
|
||||
option of the
|
||||
.B e2fsck
|
||||
and
|
||||
.B mke2fs
|
||||
programs.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI \-b " block-size"
|
||||
|
@ -141,8 +141,9 @@ of the filesystem (see the
|
||||
option).
|
||||
.TP
|
||||
.B \-c
|
||||
Check the device for bad blocks before creating the file system, using a
|
||||
fast read-only test.
|
||||
Check the device for bad blocks before creating the file system. If
|
||||
this option is specified twice, then a slower, destructive, read-write
|
||||
test is used instead of a fast read-only test.
|
||||
.TP
|
||||
.BI \-f " fragment-size"
|
||||
Specify the size of fragments in bytes.
|
||||
@ -225,7 +226,18 @@ The journal must fit within the newly created filesystem.
|
||||
.TP
|
||||
.BI \-l " filename"
|
||||
Read the bad blocks list from
|
||||
.IR filename .
|
||||
.IR filename .
|
||||
Note that the block numbers in the bad block list must be generated
|
||||
using the same block size as used by mke2fs. As a result, the
|
||||
.B \-c
|
||||
option to
|
||||
.B mke2fs
|
||||
is a much simpler and less error-prone method of checking a disk for bad
|
||||
blocks before formatting it, as
|
||||
.B mke2fs
|
||||
will automatically pass the correct parameters to the
|
||||
.B badblocks
|
||||
program.
|
||||
.TP
|
||||
.B \-L
|
||||
Set the volume label for the filesystem.
|
||||
|
@ -216,9 +216,9 @@ static void test_disk(ext2_filsys fs, badblocks_list *bb_list)
|
||||
errcode_t retval;
|
||||
char buf[1024];
|
||||
|
||||
sprintf(buf, "badblocks -b %d %s%s %d", fs->blocksize,
|
||||
quiet ? "" : "-s ", fs->device_name,
|
||||
fs->super->s_blocks_count);
|
||||
sprintf(buf, "badblocks -b %d %s%s%s %d", fs->blocksize,
|
||||
quiet ? "" : "-s ", (cflag > 1) ? "-w " : "",
|
||||
fs->device_name, fs->super->s_blocks_count);
|
||||
if (verbose)
|
||||
printf(_("Running command: %s\n"), buf);
|
||||
f = popen(buf, "r");
|
||||
@ -838,7 +838,7 @@ static void PRS(int argc, char *argv[])
|
||||
break;
|
||||
case 'c': /* Check for bad blocks */
|
||||
case 't': /* deprecated */
|
||||
cflag = 1;
|
||||
cflag++;
|
||||
break;
|
||||
case 'f':
|
||||
size = strtoul(optarg, &tmp, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user