aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/Android.bp67
-rw-r--r--misc/Makefile.in20
-rw-r--r--misc/badblocks.8.in6
-rw-r--r--misc/badblocks.c41
-rw-r--r--misc/base_device.c2
-rw-r--r--misc/blkid.8.in2
-rw-r--r--misc/chattr.1.in122
-rw-r--r--misc/chattr.c2
-rw-r--r--misc/create_inode.c39
-rw-r--r--misc/default_profile.c4
-rw-r--r--misc/dumpe2fs.8.in30
-rw-r--r--misc/dumpe2fs.c4
-rw-r--r--misc/e2freefrag.8.in8
-rw-r--r--misc/e2image.8.in376
-rw-r--r--misc/e2image.c17
-rw-r--r--misc/e2initrd_helper.c5
-rw-r--r--misc/e2label.8.in4
-rw-r--r--misc/e2mmpstatus.8.in26
-rw-r--r--misc/e2undo.8.in12
-rw-r--r--misc/e4crypt.8.in2
-rw-r--r--misc/e4defrag.8.in8
-rw-r--r--misc/e4defrag.c45
-rw-r--r--misc/ext4.5.in102
-rw-r--r--misc/filefrag.8.in23
-rw-r--r--misc/filefrag.c96
-rw-r--r--misc/findfs.8.in6
-rw-r--r--misc/fsck.8.in98
-rw-r--r--misc/fsck.c7
-rw-r--r--misc/fuse2fs.c12
-rw-r--r--misc/lsattr.c7
-rw-r--r--misc/mk_hugefiles.c134
-rw-r--r--misc/mke2fs.8.in194
-rw-r--r--misc/mke2fs.c111
-rw-r--r--misc/mke2fs.conf.5.in74
-rw-r--r--misc/mke2fs.conf.in4
-rw-r--r--misc/mklost+found.8.in8
-rw-r--r--misc/tune2fs.8.in216
-rw-r--r--misc/tune2fs.c56
-rw-r--r--misc/util.c8
39 files changed, 1042 insertions, 956 deletions
diff --git a/misc/Android.bp b/misc/Android.bp
index 74ee223f..0656bf48 100644
--- a/misc/Android.bp
+++ b/misc/Android.bp
@@ -22,16 +22,13 @@ cc_library {
target: {
windows: {
- include_dirs: [ "external/e2fsprogs/include/mingw" ],
enabled: true,
- cflags: ["-Wno-unused-variable"],
},
},
srcs: [
"create_inode.c",
],
- cflags: ["-Wno-error=format-extra-args"],
shared_libs: [
"libext2fs",
"libext2_com_err",
@@ -43,9 +40,8 @@ cc_library {
//########################################################################
// Build mke2fs
-cc_binary {
- name: "mke2fs",
- host_supported: true,
+cc_defaults {
+ name: "mke2fs_defaults",
recovery_available: true,
defaults: ["e2fsprogs-defaults"],
@@ -55,11 +51,14 @@ cc_binary {
"mk_hugefiles.c",
"default_profile.c",
],
- cflags: [
- "-Wno-error=format",
- "-Wno-error=type-limits",
- "-Wno-format-extra-args",
- ],
+ stl: "libc++_static",
+ include_dirs: ["external/e2fsprogs/e2fsck"],
+}
+
+cc_binary {
+ name: "mke2fs",
+ host_supported: true,
+ defaults: ["mke2fs_defaults"],
target: {
host: {
static_libs: [
@@ -81,18 +80,8 @@ cc_binary {
],
},
windows: {
- include_dirs: [ "external/e2fsprogs/include/mingw" ],
- cflags: [
- "-D_POSIX",
- "-D__USE_MINGW_ALARM",
- // mke2fs.c has a warning from gcc which cannot be suppressed:
- // passing argument 3 of 'ext2fs_get_device_size' from
- // incompatible pointer type
- "-Wno-error"
- ],
ldflags: ["-static"],
- host_ldlibs: ["-lws2_32"],
- enabled: true
+ enabled: true,
},
android: {
required: [
@@ -107,11 +96,39 @@ cc_binary {
"libext2_com_err",
"libext2_e2p",
],
- symlinks: ["mkfs.ext2", "mkfs.ext3", "mkfs.ext4"],
+ symlinks: [
+ "mkfs.ext2",
+ "mkfs.ext3",
+ "mkfs.ext4",
+ ],
},
},
- stl: "libc++_static",
- include_dirs: ["external/e2fsprogs/e2fsck"],
+}
+
+cc_binary {
+ name: "mke2fs.microdroid",
+ defaults: ["mke2fs_defaults"],
+ bootstrap: true,
+ target: {
+ android: {
+ required: [
+ "mke2fs.conf",
+ ],
+ shared_libs: [
+ "libext2fs",
+ "libext2_blkid",
+ "libext2_misc",
+ "libext2_uuid",
+ "libext2_quota",
+ "libext2_com_err",
+ "libext2_e2p",
+ ],
+ symlinks: ["mkfs.ext4.microdroid"],
+ },
+ },
+ installable: false,
+ stem: "mke2fs",
+ visibility: ["//packages/modules/Virtualization/microdroid"],
}
//##########################################################################
diff --git a/misc/Makefile.in b/misc/Makefile.in
index 3b949d35..e5420bbd 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -360,15 +360,15 @@ dumpe2fs.static: $(DUMPE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBUUID) $(DEPL
$(STATIC_LIBS) $(STATIC_LIBE2P) $(STATIC_LIBUUID) \
$(LIBINTL) $(SYSLIBS) $(STATIC_LIBBLKID) $(LIBMAGIC)
-fsck: $(FSCK_OBJS) $(DEPLIBBLKID)
+fsck: $(FSCK_OBJS) $(DEPLIBBLKID) $(DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBBLKID) \
- $(LIBINTL) $(SYSLIBS)
+ $(LIBINTL) $(SYSLIBS) $(LIBS)
-fsck.profiled: $(FSCK_OBJS) $(PROFILED_DEPLIBBLKID)
+fsck.profiled: $(FSCK_OBJS) $(PROFILED_DEPLIBBLKID) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o fsck.profiled $(PROFILED_FSCK_OBJS) \
- $(PROFILED_LIBBLKID) $(LIBINTL) $(SYSLIBS)
+ $(PROFILED_LIBBLKID) $(LIBINTL) $(SYSLIBS) $(PROFILED_LIBS)
badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
$(E) " LD $@"
@@ -736,8 +736,8 @@ tune2fs.o: $(srcdir)/tune2fs.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \
$(top_srcdir)/lib/ext2fs/compiler.h $(top_srcdir)/lib/support/plausible.h \
$(top_srcdir)/lib/support/quotaio.h $(top_srcdir)/lib/support/dqblk_v2.h \
- $(top_srcdir)/lib/support/quotaio_tree.h $(top_srcdir)/lib/e2p/e2p.h \
- $(srcdir)/util.h $(top_srcdir)/version.h \
+ $(top_srcdir)/lib/support/quotaio_tree.h $(top_srcdir)/lib/support/devname.h \
+ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/util.h $(top_srcdir)/version.h \
$(top_srcdir)/lib/support/nls-enable.h
mklost+found.o: $(srcdir)/mklost+found.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
@@ -799,7 +799,8 @@ badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/support/nls-enable.h
fsck.o: $(srcdir)/fsck.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/version.h \
- $(top_srcdir)/lib/support/nls-enable.h $(srcdir)/fsck.h
+ $(top_srcdir)/lib/support/devname.h $(top_srcdir)/lib/support/nls-enable.h \
+ $(srcdir)/fsck.h
util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
@@ -808,7 +809,7 @@ util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
$(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/support/nls-enable.h \
- $(srcdir)/util.h
+ $(top_srcdir)/lib/support/devname.h $(srcdir)/util.h
uuidgen.o: $(srcdir)/uuidgen.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/support/nls-enable.h
blkid.o: $(srcdir)/blkid.c $(top_builddir)/lib/config.h \
@@ -826,7 +827,8 @@ filefrag.o: $(srcdir)/filefrag.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
- $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/fiemap.h
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/fiemap.h \
+ $(top_srcdir)/version.h
base_device.o: $(srcdir)/base_device.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(srcdir)/fsck.h
ismounted.o: $(srcdir)/ismounted.c $(top_builddir)/lib/config.h \
diff --git a/misc/badblocks.8.in b/misc/badblocks.8.in
index ca435938..6c96cdcd 100644
--- a/misc/badblocks.8.in
+++ b/misc/badblocks.8.in
@@ -68,7 +68,7 @@ or
.B mke2fs
programs, it is important that the block size is properly specified,
since the block numbers which are generated are very dependent on the
-block size in use by the filesystem.
+block size in use by the file system.
For this reason, it is strongly recommended that
users
.B not
@@ -105,7 +105,7 @@ range is reached.
.B \-f
Normally, badblocks will refuse to do a read/write or a non-destructive
test on a device which is mounted, since either can cause the system to
-potentially crash and/or damage the filesystem even if it is mounted
+potentially crash and/or damage the file system even if it is mounted
read-only. This can be overridden using the
.B \-f
flag, but should almost never be used --- if you think you're smarter
@@ -129,7 +129,7 @@ The
option of
.BR dumpe2fs (8)
can be used to retrieve the list of blocks currently marked bad on
-an existing filesystem, in a format suitable for use with this option.
+an existing file system, in a format suitable for use with this option.
.TP
.B \-n
Use non-destructive read-write mode. By default only a non-destructive
diff --git a/misc/badblocks.c b/misc/badblocks.c
index afeb3da9..2b5ff6d8 100644
--- a/misc/badblocks.c
+++ b/misc/badblocks.c
@@ -389,7 +389,7 @@ static int do_read (int dev, unsigned char * buffer, int try, int block_size,
/* Try the read */
if (d_flag)
gettimeofday(&tv1, NULL);
- got = read (dev, buffer, try * block_size);
+ got = read (dev, buffer, (size_t) try * block_size);
if (d_flag)
gettimeofday(&tv2, NULL);
if (got < 0)
@@ -460,7 +460,7 @@ static int do_write(int dev, unsigned char * buffer, int try, int block_size,
com_err (program_name, errno, "%s", _("during seek"));
/* Try the write */
- got = write (dev, buffer, try * block_size);
+ got = write (dev, buffer, (size_t) try * block_size);
if (got < 0)
got = 0;
if (got & 511)
@@ -510,9 +510,9 @@ static unsigned int test_ro (int dev, blk_t last_block,
} while (next_bad && next_bad < first_block);
if (t_flag) {
- blkbuf = allocate_buffer((blocks_at_once + 1) * block_size);
+ blkbuf = allocate_buffer(((size_t) blocks_at_once + 1) * block_size);
} else {
- blkbuf = allocate_buffer(blocks_at_once * block_size);
+ blkbuf = allocate_buffer((size_t) blocks_at_once * block_size);
}
if (!blkbuf)
{
@@ -612,7 +612,7 @@ static unsigned int test_rw (int dev, blk_t last_block,
/* set up abend handler */
capture_terminate(NULL);
- buffer = allocate_buffer(2 * blocks_at_once * block_size);
+ buffer = allocate_buffer((size_t) 2 * blocks_at_once * block_size);
read_buffer = buffer + blocks_at_once * block_size;
if (!buffer) {
@@ -771,7 +771,7 @@ static unsigned int test_nd (int dev, blk_t last_block,
ext2fs_badblocks_list_iterate (bb_iter, &next_bad);
} while (next_bad && next_bad < first_block);
- blkbuf = allocate_buffer(3 * blocks_at_once * block_size);
+ blkbuf = allocate_buffer((size_t) 3 * blocks_at_once * block_size);
test_record = malloc(blocks_at_once * sizeof(struct saved_blk_record));
if (!blkbuf || !test_record) {
com_err(program_name, ENOMEM, "%s",
@@ -1036,10 +1036,13 @@ static unsigned int parse_uint(const char *str, const char *descr)
errno = 0;
ret = strtoul(str, &tmp, 0);
- if (*tmp || errno || (ret > UINT_MAX) ||
- (ret == ULONG_MAX && errno == ERANGE)) {
+ if (*tmp || errno) {
com_err (program_name, 0, _("invalid %s - %s"), descr, str);
exit (1);
+ } else if ((ret > UINT_MAX) ||
+ (ret == ULONG_MAX && errno == ERANGE)) {
+ com_err (program_name, 0, _("%s too large - %lu"), descr, ret);
+ exit (1);
}
return ret;
}
@@ -1052,7 +1055,7 @@ int main (int argc, char ** argv)
char * input_file = NULL;
char * output_file = NULL;
FILE * in = NULL;
- int block_size = 1024;
+ unsigned int block_size = 1024;
unsigned int blocks_at_once = 64;
blk64_t last_block, first_block;
int num_passes = 0;
@@ -1093,6 +1096,8 @@ int main (int argc, char ** argv)
if (argc && *argv)
program_name = *argv;
+ else
+ usage();
while ((c = getopt (argc, argv, "b:d:e:fi:o:svwnc:p:h:t:BX")) != EOF) {
switch (c) {
case 'b':
@@ -1200,17 +1205,21 @@ int main (int argc, char ** argv)
exit(1);
}
}
- if ((block_size <= 0) || (block_size > (1 << 24)) ||
+ if ((block_size == 0) || (block_size > (1 << 24)) ||
(block_size & (block_size - 1))) {
- com_err(program_name, 0, _("Invalid block size: %d\n"),
+ com_err(program_name, 0, _("Invalid block size: %u\n"),
block_size);
exit(1);
}
- if ((blocks_at_once <= 0) ||
- (((unsigned long long) block_size * blocks_at_once) > 0xFFFFFFFF)) {
- com_err(program_name, 0, _("Invalid blocks_at_once: %d\n"),
+ if (blocks_at_once == 0) {
+ com_err(program_name, 0, _("Invalid number of blocks: %d\n"),
blocks_at_once);
exit(1);
+ } else if (((size_t) block_size * blocks_at_once) > SIZE_MAX / 3) {
+ /* maximum usage is in test_nd() */
+ com_err(program_name, 0, _("For block size %d, number of blocks too large: %d\n"),
+ block_size, blocks_at_once);
+ exit(1);
}
if (optind > argc - 1)
@@ -1218,7 +1227,7 @@ int main (int argc, char ** argv)
device_name = argv[optind++];
if (optind > argc - 1) {
errcode = ext2fs_get_device_size2(device_name,
- block_size,
+ (int) block_size,
&last_block);
if (errcode == EXT2_ET_UNIMPLEMENTED) {
com_err(program_name, 0, "%s",
@@ -1348,7 +1357,7 @@ int main (int argc, char ** argv)
do {
unsigned int bb_count;
- bb_count = test_func(dev, last_block, block_size,
+ bb_count = test_func(dev, last_block, (int) block_size,
first_block, blocks_at_once);
if (bb_count)
passes_clean = 0;
diff --git a/misc/base_device.c b/misc/base_device.c
index d1c1cd94..814a4791 100644
--- a/misc/base_device.c
+++ b/misc/base_device.c
@@ -33,7 +33,7 @@
/*
* Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
- * pathames.
+ * pathnames.
*/
static const char *devfs_hier[] = {
"host", "bus", "target", "lun", 0
diff --git a/misc/blkid.8.in b/misc/blkid.8.in
index 9c42686e..79be1c0c 100644
--- a/misc/blkid.8.in
+++ b/misc/blkid.8.in
@@ -41,7 +41,7 @@ The
.B blkid
program is the command-line interface to working with
.BR libblkid (3)
-library. It can determine the type of content (e.g. filesystem, swap)
+library. It can determine the type of content (e.g. file system, swap)
a block device holds, and also attributes (tokens, NAME=value pairs)
from the content metadata (e.g. LABEL or UUID fields).
.PP
diff --git a/misc/chattr.1.in b/misc/chattr.1.in
index 5e1eeb79..50c54e7d 100644
--- a/misc/chattr.1.in
+++ b/misc/chattr.1.in
@@ -23,47 +23,80 @@ chattr \- change file attributes on a Linux file system
.B chattr
changes the file attributes on a Linux file system.
.PP
-The format of a symbolic mode is +-=[aAcCdDeFijmPsStTux].
+The format of a symbolic
+.I mode
+is
+.BR +-= [ aAcCdDeFijmPsStTux ].
.PP
-The operator '+' causes the selected attributes to be added to the
-existing attributes of the files; '-' causes them to be removed; and '='
+The operator
+.RB ' + '
+causes the selected attributes to be added to the
+existing attributes of the files;
+.RB ' - '
+causes them to be removed; and
+.RB ' = '
causes them to be the only attributes that the files have.
.PP
-The letters 'aAcCdDeFijmPsStTux' select the new attributes for the files:
-append only (a),
-no atime updates (A),
-compressed (c),
-no copy on write (C),
-no dump (d),
-synchronous directory updates (D),
-extent format (e),
-case-insensitive directory lookups (F),
-immutable (i),
-data journalling (j),
-don't compress (m),
-project hierarchy (P),
-secure deletion (s),
-synchronous updates (S),
-no tail-merging (t),
-top of directory hierarchy (T),
-undeletable (u),
-and direct access for files (x).
+The letters
+.RB ' aAcCdDeFijmPsStTux '
+select the new attributes for the files:
+append only
+.RB ( a ),
+no atime updates
+.RB ( A ),
+compressed
+.RB ( c ),
+no copy on write
+.RB ( C ),
+no dump
+.RB ( d ),
+synchronous directory updates
+.RB ( D ),
+extent format
+.RB ( e ),
+case-insensitive directory lookups
+.RB ( F ),
+immutable
+.RB ( i ),
+data journaling
+.RB ( j ),
+don't compress
+.RB ( m ),
+project hierarchy
+.RB ( P ),
+secure deletion
+.RB ( s ),
+synchronous updates
+.RB ( S ),
+no tail-merging
+.RB ( t ),
+top of directory hierarchy
+.RB ( T ),
+undeletable
+.RB ( u ),
+and direct access for files
+.RB ( x ).
.PP
The following attributes are read-only, and may be listed by
.BR lsattr (1)
but not modified by chattr:
-encrypted (E),
-indexed directory (I),
-inline data (N),
-and verity (V).
+encrypted
+.RB ( E ),
+indexed directory
+.RB ( I ),
+inline data
+.RB ( N ),
+and verity
+.RB ( V ).
.PP
-Not all flags are supported or utilized by all filesystems; refer to
-filesystem-specific man pages such as
+Not all flags are supported or utilized by all file systems; refer to
+file system-specific man pages such as
.BR btrfs (5),
.BR ext4 (5),
+.BR mkfs.f2fs (8),
and
.BR xfs (5)
-for more filesystem-specific details.
+for more file system-specific details.
.SH OPTIONS
.TP
.B \-R
@@ -128,7 +161,7 @@ the blocks on disk. It may not be removed using
.TP
.B E
A file, directory, or symlink with the 'E' attribute set is encrypted by the
-filesystem. This attribute may not be set or cleared using
+file system. This attribute may not be set or cleared using
.BR chattr (1),
although it can be displayed by
.BR lsattr (1).
@@ -157,7 +190,7 @@ although it can be displayed by
A file with the 'j' attribute has all of its data written to the ext3 or
ext4 journal before being written to the file itself, if the file system
is mounted with the "data=ordered" or "data=writeback" options and the
-file system has a journal. When the filesystem is mounted with the
+file system has a journal. When the file system is mounted with the
"data=journal" option all file data is already journalled and this
attribute has no effect. Only the superuser or a process possessing the
CAP_SYS_RESOURCE capability can set or clear this attribute.
@@ -195,10 +228,10 @@ the 'sync' mount option applied to a subset of the files.
.TP
.B t
A file with the 't' attribute will not have a partial block fragment at
-the end of the file merged with other files (for those filesystems which
+the end of the file merged with other files (for those file systems which
support tail-merging). This is necessary for applications such as LILO
-which read the filesystem directly, and which don't understand tail-merged
-files. Note: As of this writing, the ext2, ext3, and ext4 filesystems do
+which read the file system directly, and which don't understand tail-merged
+files. Note: As of this writing, the ext2, ext3, and ext4 file systems do
not support tail-merging.
.TP
.B T
@@ -219,16 +252,20 @@ make sure to read the bugs and limitations section at the end of this
document.
.TP
.B x
-The 'x' attribute can be set on a directory or file. If the attribute
-is set on an existing directory, it will be inherited by all files and
-subdirectories that are subsequently created in the directory. If an
-existing directory has contained some files and subdirectories, modifying
-the attribute on the parent directory doesn't change the attributes on
-these files and subdirectories.
+A file with the 'x' requests the use of direct access (dax) mode, if the
+kernel supports DAX. This can be overridden by the 'dax=never' mount
+option. For more information see the kernel documentation for dax:
+<https://www.kernel.org/doc/html/latest/filesystems/dax.html>.
+.IP
+If the attribute is set on an existing directory, it will be inherited
+by all files and subdirectories that are subsequently created in the
+directory. If an existing directory has contained some files and
+subdirectories, modifying the attribute on the parent directory doesn't
+change the attributes on these files and subdirectories.
.TP
.B V
A file with the 'V' attribute set has fs-verity enabled. It cannot be
-written to, and the filesystem will automatically verify all data read
+written to, and the file system will automatically verify all data read
from it against a cryptographic hash that covers the entire file's
contents, e.g. via a Merkle tree. This makes it possible to efficiently
authenticate the file. This attribute may not be set or cleared using
@@ -242,7 +279,7 @@ was written by Remy Card <Remy.Card@linux.org>. It is currently being
maintained by Theodore Ts'o <tytso@alum.mit.edu>.
.SH BUGS AND LIMITATIONS
The 'c', 's', and 'u' attributes are not honored
-by the ext2, ext3, and ext4 filesystems as implemented in the current
+by the ext2, ext3, and ext4 file systems as implemented in the current
mainline Linux kernels.
Setting 'a' and 'i' attributes will not affect the ability to write
to already existing file descriptors.
@@ -258,4 +295,5 @@ http://e2fsprogs.sourceforge.net.
.BR lsattr (1),
.BR btrfs (5),
.BR ext4 (5),
+.BR mkfs.f2fs (8),
.BR xfs (5).
diff --git a/misc/chattr.c b/misc/chattr.c
index 644ef4e9..c7382a37 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -86,7 +86,7 @@ static unsigned long sf;
static void usage(void)
{
fprintf(stderr,
- _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
+ _("Usage: %s [-RVf] [-+=aAcCdDeijPsStTuFx] [-p project] [-v version] files...\n"),
program_name);
exit(1);
}
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 54d8d343..a3a34cd9 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -150,6 +150,8 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
size = llistxattr(filename, NULL, 0);
if (size == -1) {
+ if (errno == ENOTSUP)
+ return 0;
retval = errno;
com_err(__func__, retval, _("while listing attributes of \"%s\""),
filename);
@@ -234,7 +236,6 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
retval = retval ? retval : close_retval;
}
return retval;
- return 0;
}
#else /* HAVE_LLISTXATTR */
static errcode_t set_inode_xattr(ext2_filsys fs EXT2FS_ATTR((unused)),
@@ -764,37 +765,33 @@ static int scandir(const char *dir_name, struct dirent ***name_list,
size_t new_list_size = temp_list_size + 32;
struct dirent **new_list = (struct dirent**)realloc(
temp_list, new_list_size * sizeof(struct dirent*));
- if (new_list == NULL) {
- goto out;
- }
+ if (new_list == NULL)
+ goto out_err;
temp_list_size = new_list_size;
temp_list = new_list;
}
// add the copy of dirent to the list
temp_list[num_dent] = (struct dirent*)malloc((dent->d_reclen + 3) & ~3);
+ if (!temp_list[num_dent])
+ goto out_err;
memcpy(temp_list[num_dent], dent, dent->d_reclen);
num_dent++;
}
+ closedir(dir);
if (compar != NULL) {
qsort(temp_list, num_dent, sizeof(struct dirent*),
(int (*)(const void*, const void*))compar);
}
-
- // release the temp list
*name_list = temp_list;
- temp_list = NULL;
+ return num_dent;
-out:
- if (temp_list != NULL) {
- while (num_dent > 0) {
- free(temp_list[--num_dent]);
- }
- free(temp_list);
- num_dent = -1;
- }
+out_err:
closedir(dir);
- return num_dent;
+ while (num_dent > 0)
+ free(temp_list[--num_dent]);
+ free(temp_list);
+ return -1;
}
static int alphasort(const struct dirent **a, const struct dirent **b) {
@@ -812,11 +809,9 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
const char *name;
struct dirent **dent;
struct stat st;
- char *ln_target = NULL;
unsigned int save_inode;
ext2_ino_t ino;
errcode_t retval = 0;
- int read_cnt;
int hdlink;
size_t cur_dir_path_len;
int i, num_dents;
@@ -899,7 +894,10 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
goto out;
}
break;
- case S_IFLNK:
+ case S_IFLNK: {
+ char *ln_target;
+ int read_cnt;
+
ln_target = malloc(st.st_size + 1);
if (ln_target == NULL) {
com_err(__func__, retval,
@@ -934,7 +932,8 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
goto out;
}
break;
-#endif
+ }
+#endif /* !_WIN32 */
case S_IFREG:
retval = do_write_internal(fs, parent_ino, name, name,
root);
diff --git a/misc/default_profile.c b/misc/default_profile.c
index 585a34d3..e882b709 100644
--- a/misc/default_profile.c
+++ b/misc/default_profile.c
@@ -13,16 +13,13 @@ const char *mke2fs_default_profile =
" }\n"
" ext4 = {\n"
" features = has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize\n"
- " inode_size = 256\n"
" }\n"
" small = {\n"
" blocksize = 1024\n"
- " inode_size = 128\n"
" inode_ratio = 4096\n"
" }\n"
" floppy = {\n"
" blocksize = 1024\n"
- " inode_size = 128\n"
" inode_ratio = 8192\n"
" }\n"
" big = {\n"
@@ -45,5 +42,6 @@ const char *mke2fs_default_profile =
" hurd = {\n"
" blocksize = 4096\n"
" inode_size = 128\n"
+ " warn_y2038_dates = 0\n"
" }\n"
;
diff --git a/misc/dumpe2fs.8.in b/misc/dumpe2fs.8.in
index ce3214f3..dd27804e 100644
--- a/misc/dumpe2fs.8.in
+++ b/misc/dumpe2fs.8.in
@@ -4,7 +4,7 @@
.\"
.TH DUMPE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-dumpe2fs \- dump ext2/ext3/ext4 filesystem information
+dumpe2fs \- dump ext2/ext3/ext4 file system information
.SH SYNOPSIS
.B dumpe2fs
[
@@ -19,35 +19,35 @@ dumpe2fs \- dump ext2/ext3/ext4 filesystem information
.I device
.SH DESCRIPTION
.B dumpe2fs
-prints the super block and blocks group information for the filesystem
+prints the super block and blocks group information for the file system
present on
.I device.
.PP
.B Note:
-When used with a mounted filesystem, the printed
+When used with a mounted file system, the printed
information may be old or inconsistent.
.SH OPTIONS
.TP
.B \-b
-print the blocks which are reserved as bad in the filesystem.
+print the blocks which are reserved as bad in the file system.
.TP
.B \-o superblock=\fIsuperblock
use the block
.I superblock
-when examining the filesystem.
-This option is not usually needed except by a filesystem wizard who
-is examining the remains of a very badly corrupted filesystem.
+when examining the file system.
+This option is not usually needed except by a file system wizard who
+is examining the remains of a very badly corrupted file system.
.TP
.B \-o blocksize=\fIblocksize
use blocks of
.I blocksize
-bytes when examining the filesystem.
-This option is not usually needed except by a filesystem wizard who
-is examining the remains of a very badly corrupted filesystem.
+bytes when examining the file system.
+This option is not usually needed except by a file system wizard who
+is examining the remains of a very badly corrupted file system.
.TP
.B \-f
-force dumpe2fs to display a filesystem even though it may have some
-filesystem feature flags which dumpe2fs may not understand (and which
+force dumpe2fs to display a file system even though it may have some
+file system feature flags which dumpe2fs may not understand (and which
can cause some of dumpe2fs's display to be suspect).
.TP
.B \-g
@@ -63,7 +63,7 @@ only display the superblock information and not any of the block
group descriptor detail information.
.TP
.B \-i
-display the filesystem data from an image file created by
+display the file system data from an image file created by
.BR e2image ,
using
.I device
@@ -72,7 +72,7 @@ as the pathname to the image file.
.B \-m
If the
.B mmp
-feature is enabled on the filesystem, check if
+feature is enabled on the file system, check if
.I device
is in use by another node, see
.BR e2mmpstatus (8)
@@ -96,7 +96,7 @@ is in use by another node and
.B -m
is specified.
.SH BUGS
-You may need to know the physical filesystem structure to understand the
+You may need to know the physical file system structure to understand the
output.
.SH AUTHOR
.B dumpe2fs
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 3f4fc4ed..7c080ed9 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -338,6 +338,7 @@ static void list_bad_blocks(ext2_filsys fs, int dump)
if (retval) {
com_err("ext2fs_badblocks_list_iterate_begin", retval,
"%s", _("while printing bad block list"));
+ ext2fs_badblocks_list_free(bb_list);
return;
}
if (dump) {
@@ -618,7 +619,8 @@ int main (int argc, char ** argv)
mmp_check = 1;
header_only = 1;
}
- }
+ } else
+ usage();
if (!mmp_check)
fprintf(stderr, "dumpe2fs %s (%s)\n", E2FSPROGS_VERSION,
diff --git a/misc/e2freefrag.8.in b/misc/e2freefrag.8.in
index 51faf436..e77bcdb6 100644
--- a/misc/e2freefrag.8.in
+++ b/misc/e2freefrag.8.in
@@ -16,7 +16,7 @@ e2freefrag \- report free space fragmentation information
.B e2freefrag
is used to report free space fragmentation on ext2/3/4 file systems.
.I filesys
-is the filesystem device name (e.g.
+is the file system device name (e.g.
.IR /dev/hdc1 ", " /dev/md0 ).
The
.B e2freefrag
@@ -25,8 +25,8 @@ are present as contiguous and aligned free space. The percentage of contiguous
free blocks of size and of alignment
.I chunk_kb
is reported. It also displays the minimum/maximum/average free chunk size in
-the filesystem, along with a histogram of all free chunks. This information
-can be used to gauge the level of free space fragmentation in the filesystem.
+the file system, along with a histogram of all free chunks. This information
+can be used to gauge the level of free space fragmentation in the file system.
.SH OPTIONS
.TP
.BI \-c " chunk_kb"
@@ -35,7 +35,7 @@ If a chunk size is specified, then
will print how many free chunks of size
.I chunk_kb
are available in units of kilobytes (Kb). The chunk size must be a
-power of two and be larger than filesystem block size.
+power of two and be larger than file system block size.
.TP
.B \-h
Print the usage of the program.
diff --git a/misc/e2image.8.in b/misc/e2image.8.in
index ef124867..90ea0c27 100644
--- a/misc/e2image.8.in
+++ b/misc/e2image.8.in
@@ -1,18 +1,14 @@
.\" -*- nroff -*-
.\" Copyright 2001 by Theodore Ts'o. All Rights Reserved.
.\" This file may be copied under the terms of the GNU Public License.
-.\"
+.\"
.TH E2IMAGE 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-e2image \- Save critical ext2/ext3/ext4 filesystem metadata to a file
+e2image \- Save critical ext2/ext3/ext4 file system metadata to a file
+
.SH SYNOPSIS
.B e2image
-[
-.B \-r|\-Q
-]
-[
-.B \-f
-]
+.RB [ \-r | \-Q " [" \-af ]]
[
.B \-b
.I superblock
@@ -21,18 +17,8 @@ e2image \- Save critical ext2/ext3/ext4 filesystem metadata to a file
.B \-B
.I blocksize
]
-.I device
-.I image-file
-.br
-.B e2image
-.B \-I
-.I device
-.I image-file
-.br
-.B e2image
-.B \-ra
[
-.B \-cfnp
+.B \-cnps
]
[
.B \-o
@@ -42,14 +28,18 @@ e2image \- Save critical ext2/ext3/ext4 filesystem metadata to a file
.B \-O
.I dest_offset
]
-.I src_fs
-[
-.I dest_fs
-]
+.I device
+.I image-file
+.br
+.B e2image
+.B \-I
+.I device
+.I image-file
+
.SH DESCRIPTION
The
.B e2image
-program will save critical ext2, ext3, or ext4 filesystem metadata located on
+program will save critical ext2, ext3, or ext4 file system metadata located on
.I device
to a file specified by
.IR image-file .
@@ -59,24 +49,40 @@ and
.BR debugfs ,
by using the
.B \-i
-option to those programs. This can assist an expert in
-recovering catastrophically corrupted filesystems. In the future,
-e2fsck will be enhanced to be able to use the image file to help
-recover a badly damaged filesystem.
+option to those programs. This can assist an expert in recovering
+catastrophically corrupted file systems.
.PP
-When saving an e2image for debugging purposes, using either the
-.B \-r
-or
-.B \-Q
-options, the filesystem must be unmounted or be mounted read/only, in order
-for the image file to be in a consistent state. This requirement can be
-overridden using the
-.B \-f
-option, but the resulting image file is very likely not going to be useful.
+It is a very good idea to create image files for all file systems on a
+system and save the partition layout (which can be generated using the
+.B fdisk \-l
+command) at regular intervals --- at boot time, and/or every week or so.
+The image file should be stored on some file system other than
+the file system whose data it contains, to ensure that this data is
+accessible in the case where the file system has been badly damaged.
+.PP
+To save disk space,
+.B e2image
+creates the image file as a sparse file, or in QCOW2 format. Hence, if
+the sparse image file needs to be copied to another location, it should
+either be compressed first or copied using the
+.B \-\-sparse=always
+option to the GNU version of
+.BR cp (1).
+This does not apply to the QCOW2 image, which is not sparse.
+.PP
+The size of an ext2 image file depends primarily on the size of the
+file systems and how many inodes are in use. For a typical 10 Gigabyte
+file system, with 200,000 inodes in use out of 1.2 million inodes, the image
+file will be approximately 35 Megabytes; a 4 Gigabyte file system with 15,000
+inodes in use out of 550,000 inodes will result in a 3 Megabyte image file.
+Image files tend to be quite compressible; an image file taking up 32 Megabytes
+of space on disk will generally compress down to 3 or 4 Megabytes.
.PP
If
.I image-file
-is \-, then the output of
+is
+.BR \- ,
+then the output of
.B e2image
will be sent to standard output, so that the output can be piped to
another program, such as
@@ -87,125 +93,172 @@ creating a raw image file using the
option, since the process of creating a normal image file, or QCOW2
image currently
requires random access to the file, which cannot be done using a
-pipe. This restriction will hopefully be lifted in a future version of
-.BR e2image .)
-.PP
-It is a very good idea to create image files for all of
-filesystems on a system and save the partition
-layout (which can be generated using the
-.B fdisk \-l
-command) at regular intervals --- at boot time, and/or every week or so.
-The image file should be stored on some filesystem other than
-the filesystem whose data it contains, to ensure that this data is
-accessible in the case where the filesystem has been badly damaged.
-.PP
-To save disk space,
+pipe.
+
+.SH OPTIONS
+.TP
+.B \-a
+Include file data in the image file. Normally
.B e2image
-creates the image file as a sparse file, or in QCOW2 format.
-Hence, if the sparse image file
-needs to be copied to another location, it should
-either be compressed first or copied using the
-.B \-\-sparse=always
-option to the GNU version of
-.BR cp .
-This does not apply to the QCOW2 image, which is not sparse.
-.PP
-The size of an ext2 image file depends primarily on the size of the
-filesystems and how many inodes are in use. For a typical 10 gigabyte
-filesystem, with 200,000 inodes in use out of 1.2 million inodes, the
-image file will be approximately 35 megabytes; a 4 gigabyte filesystem with
-15,000 inodes in use out of 550,000 inodes will result in a 3 megabyte
-image file. Image files tend to be quite
-compressible; an image file taking up 32 megabytes of space on
-disk will generally compress down to 3 or 4 megabytes.
-.PP
-.SH RESTORING FILESYSTEM METADATA USING AN IMAGE FILE
-.PP
-The
+only includes fs metadata, not regular file data. This option will
+produce an image that is suitable to use to clone the entire FS or
+for backup purposes. Note that this option only works with the
+raw
+.RI ( \-r )
+or QCOW2
+.RI ( \-Q )
+formats. In conjunction with the
+.B \-r
+option it is possible to clone all and only the used blocks of one
+file system to another device/image file.
+.TP
+.BI \-b " superblock"
+Get image from partition with broken primary superblock by using
+the superblock located at file system block number
+.IR superblock .
+The partition is copied as-is including broken primary superblock.
+.TP
+.BI \-B " blocksize"
+Set the file system blocksize in bytes. Normally,
+.B e2image
+will search for the superblock at various different block sizes in an
+attempt to find the appropriate blocksize. This search can be fooled in
+some cases. This option forces e2fsck to only try locating the superblock
+with a particular blocksize. If the superblock is not found, e2image will
+terminate with a fatal error.
+.TP
+.BI \-c
+Compare each block to be copied from the source
+.I device
+to the corresponding block in the target
+.IR image-file .
+If both are already the same, the write will be skipped. This is
+useful if the file system is being cloned to a flash-based storage device
+(where reads are very fast and where it is desirable to avoid unnecessary
+writes to reduce write wear on the device).
+.TP
+.B \-f
+Override the read-only requirement for the source file system when saving
+the image file using the
+.B \-r
+and
+.B \-Q
+options. Normally, if the source file system is in use, the resulting image
+file is very likely not going to be useful. In some cases where the source
+file system is in constant use this may be better than no image at all.
+.TP
.B \-I
-option will cause e2image to install the metadata stored in the image
-file back to the device. It can be used to restore the filesystem metadata
-back to the device in emergency situations.
+install the metadata stored in the image file back to the device.
+It can be used to restore the file system metadata back to the device
+in emergency situations.
.PP
.B WARNING!!!!
The
.B \-I
option should only be used as a desperation measure when other
-alternatives have failed. If the filesystem has changed since the image
+alternatives have failed. If the file system has changed since the image
file was created, data
.B will
-be lost. In general, you should make a full image
-backup of the filesystem first, in case you wish to try other recovery
-strategies afterwards.
-.PP
+be lost. In general, you should make another full image backup of the
+file system first, in case you wish to try other recovery strategies afterward.
+.TP
+.B \-n
+Cause all image writes to be skipped, and instead only print the block
+numbers that would have been written.
+.TP
+.BI \-o " src_offset"
+Specify offset of the image to be read from the start of the source
+.I device
+in bytes. See
+.B OFFSETS
+for more details.
+.TP
+.BI \-O " tgt_offset"
+Specify offset of the image to be written from the start of the target
+.I image-file
+in bytes. See
+.B OFFSETS
+for more details.
+.TP
+.B \-p
+Show progress of image-file creation.
+.TP
+.B \-Q
+Create a QCOW2-format image file instead of a normal image file, suitable
+for use by virtual machine images, and other tools that can use the
+.B .qcow
+image format. See
+.B QCOW2 IMAGE FILES
+below for details.
+.TP
+.B \-r
+Create a raw image file instead of a normal image file. See
+.B RAW IMAGE FILES
+below for details.
+.TP
+.B \-s
+Scramble directory entries and zero out unused portions of the directory
+blocks in the written image file to avoid revealing information about
+the contents of the file system. However, this will prevent analysis of
+problems related to hash-tree indexed directories.
+
.SH RAW IMAGE FILES
The
.B \-r
-option will create a raw image file instead of a normal image file.
-A raw image file differs
-from a normal image file in two ways. First, the filesystem metadata is
-placed in the proper position so that e2fsck, dumpe2fs, debugfs,
-etc.\& can be run directly on the raw image file. In order to minimize
-the amount of disk space consumed by a raw image file, the file is
+option will create a raw image file, which differs
+from a normal image file in two ways. First, the file system metadata is
+placed in the same relative offset within
+.I image-file
+as it is in the
+.I device
+so that
+.BR debugfs (8),
+.BR dumpe2fs (8),
+.BR e2fsck (8),
+.BR losetup (8),
+etc. and can be run directly on the raw image file. In order to minimize
+the amount of disk space consumed by the raw image file, it is
created as a sparse file. (Beware of copying or
compressing/decompressing this file with utilities that don't understand
how to create sparse files; the file will become as large as the
-filesystem itself!) Secondly, the raw image file also includes indirect
-blocks and directory blocks, which the standard image file does not have,
-although this may change in the future.
+file system itself!) Secondly, the raw image file also includes indirect
+blocks and directory blocks, which the standard image file does not have.
.PP
-Raw image files are sometimes used when sending filesystems to the maintainer
+Raw image files are sometimes used when sending file systems to the maintainer
as part of bug reports to e2fsprogs. When used in this capacity, the
-recommended command is as follows (replace hda1 with the appropriate device):
+recommended command is as follows (replace
+.B hda1
+with the appropriate device for your system):
.PP
.br
\fBe2image \-r /dev/hda1 \- | bzip2 > hda1.e2i.bz2\fR
.PP
This will only send the metadata information, without any data blocks.
However, the filenames in the directory blocks can still reveal
-information about the contents of the filesystem that the bug reporter
+information about the contents of the file system that the bug reporter
may wish to keep confidential. To address this concern, the
.B \-s
-option can be specified. This will cause
-.B e2image
-to scramble directory entries and zero out any unused portions
-of the directory blocks before writing the image file. However,
-the
-.B \-s
-option will prevent analysis of problems related to hash-tree indexed
-directories.
-.PP
-Option
-.B \-b
-.I superblock
-can be used to get image from partition with broken primary superblock.
-The partition is copied as-is including broken primary superblock.
-.PP
-Option
-.B \-B
-.I blocksize
-can be used to set superblock block size. Normally, e2fsck will search
-for the superblock at various different block sizes in an attempt to find
-the appropriate blocksize. This search can be fooled in some cases. This
-option forces e2fsck to only try locating the superblock at a particular
-blocksize. If the superblock is not found, e2fsck will terminate with a
-fatal error.
+option can be specified to scramble the filenames in the image.
.PP
-Note that this will work even if you substitute "/dev/hda1" for another raw
+Note that this will work even if you substitute
+.B /dev/hda1
+for another raw
disk image, or QCOW2 image previously created by
.BR e2image .
-.PP
+
.SH QCOW2 IMAGE FILES
The
.B \-Q
option will create a QCOW2 image file instead of a normal, or raw image file.
A QCOW2 image contains all the information the raw image does, however unlike
-the raw image it is not sparse. The QCOW2 image minimize the amount of disk
-space by storing data in special format with pack data closely together, hence
-avoiding holes while still minimizing size.
+the raw image it is not sparse. The QCOW2 image minimize the amount of space
+used by the image by storing it in special format which packs data closely
+together, hence avoiding holes while still minimizing size.
.PP
-In order to send filesystem to the maintainer as a part of bug report to
-e2fsprogs, use following commands (replace hda1 with the appropriate device):
+In order to send file system to the maintainer as a part of bug report to
+e2fsprogs, use following commands (replace
+.B hda1
+with the appropriate device for your system):
.PP
.br
\ \fBe2image \-Q /dev/hda1 hda1.qcow2\fR
@@ -213,105 +266,70 @@ e2fsprogs, use following commands (replace hda1 with the appropriate device):
\ \fBbzip2 -z hda1.qcow2\fR
.PP
This will only send the metadata information, without any data blocks.
-However, the filenames in the directory blocks can still reveal
-information about the contents of the filesystem that the bug reporter
-may wish to keep confidential. To address this concern, the
-.B \-s
-option can be specified. This will cause
-.B e2image
-to scramble directory entries and zero out any unused portions
-of the directory blocks before writing the image file. However, the
+As described for
+.B RAW IMAGE FILES
+the
.B \-s
-option will prevent analysis of problems related to hash-tree indexed
-directories.
+option can be specified to scramble the file system names in the image.
.PP
-Note that QCOW2 image created by
+Note that the QCOW2 image created by
.B e2image
-is regular QCOW2 image and can be processed by tools aware of QCOW2 format
+is a regular QCOW2 image and can be processed by tools aware of QCOW2 format
such as for example
.BR qemu-img .
.PP
-You can convert a qcow2 image into a raw image with:
+You can convert a .qcow2 image into a raw image with:
.PP
.br
\ \fBe2image \-r hda1.qcow2 hda1.raw\fR
.br
.PP
-This can be useful to write a qcow2 image containing all data to a
+This can be useful to write a QCOW2 image containing all data to a
sparse image file where it can be loop mounted, or to a disk partition.
-Note that this may not work with qcow2 images not generated by e2image.
-.PP
-Options
-.B \-b
-.I superblock
-and
-.B \-B
-.I blocksize
-can be used same way as for raw images.
-.PP
-.SH INCLUDING DATA
-Normally
-.B e2image
-only includes fs metadata, not regular file data. The
-.B \-a
-option can be specified to include all data. This will
-give an image that is suitable to use to clone the entire FS or
-for backup purposes. Note that this option only works with the
-raw or QCOW2 formats. The
-.B \-p
-switch may be given to show progress. If the file system is being
-cloned to a flash-based storage device (where reads are very fast and
-where it is desirable to avoid unnecessary writes to reduce write wear
-on the device), the
-.B \-c
-option which cause e2image to try reading a block from the destination
-to see if it is identical to the block which
-.B e2image
-is about to copy. If the block is already the same, the write can be
-skipped. The
-.B \-n
-option will cause all of the writes to be no-ops, and print the blocks
-that would have been written.
-.PP
+Note that this may not work with QCOW2 images not generated by e2image.
+
.SH OFFSETS
-Normally a filesystem starts at the beginning of a partition, and
+Normally a file system starts at the beginning of a partition, and
.B e2image
is run on the partition. When working with image files, you don't
have the option of using the partition device, so you can specify
-the offset where the filesystem starts directly with the
+the offset where the file system starts directly with the
.B \-o
option. Similarly the
.B \-O
option specifies the offset that should be seeked to in the destination
-before writing the filesystem.
+before writing the file system.
.PP
For example, if you have a
.B dd
image of a whole hard drive that contains an ext2 fs in a partition
-starting at 1 MiB, you can clone that fs with:
+starting at 1 MiB, you can clone that image to a block device with:
.PP
.br
\ \fBe2image \-aro 1048576 img /dev/sda1\fR
.br
.PP
-Or you can clone a fs into an image file, leaving room in the first
-MiB for a partition table with:
+Or you can clone a file system from a block device into an image file,
+leaving room in the first MiB for a partition table with:
.PP
.br
\ \fBe2image -arO 1048576 /dev/sda1 img\fR
.br
.PP
If you specify at least one offset, and only one file, an in-place
-move will be performed, allowing you to safely move the filesystem
+move will be performed, allowing you to safely move the file system
from one offset to another.
+
.SH AUTHOR
.B e2image
was written by Theodore Ts'o (tytso@mit.edu).
+
.SH AVAILABILITY
.B e2image
is part of the e2fsprogs package and is available from
http://e2fsprogs.sourceforge.net.
+
.SH SEE ALSO
.BR dumpe2fs (8),
.BR debugfs (8)
-
+.BR e2fsck (8)
diff --git a/misc/e2image.c b/misc/e2image.c
index 347759b2..8b4c0677 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -52,6 +52,7 @@ extern int optind;
#include "support/nls-enable.h"
#include "support/plausible.h"
+#include "support/quotaio.h"
#include "../version.h"
#define QCOW_OFLAG_COPIED (1ULL << 63)
@@ -942,7 +943,7 @@ static errcode_t initialize_qcow2_image(int fd, ext2_filsys fs,
header->refcount_table_clusters =
ext2fs_cpu_to_be32(image->refcount.refcount_table_clusters);
offset += image->cluster_size;
- offset += image->refcount.refcount_table_clusters <<
+ offset += (blk64_t) image->refcount.refcount_table_clusters <<
image->cluster_bits;
/* Make space for L2 tables */
@@ -1262,7 +1263,7 @@ static void output_qcow2_meta_data_blocks(ext2_filsys fs, int fd)
offset += img->cluster_size;
}
}
- update_refcount(fd, img, offset, offset);
+ (void) update_refcount(fd, img, offset, offset);
flush_l2_cache(img);
sync_refcount(fd, img);
@@ -1305,7 +1306,7 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int type, int flags,
}
if (superblock) {
- int j;
+ unsigned int j;
ext2fs_mark_block_bitmap2(meta_block_map, superblock);
meta_blocks_count++;
@@ -1365,9 +1366,11 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int type, int flags,
pb.ino = ino;
pb.is_dir = LINUX_S_ISDIR(inode.i_mode);
if (LINUX_S_ISDIR(inode.i_mode) ||
- (LINUX_S_ISLNK(inode.i_mode) &&
- ext2fs_inode_has_valid_blocks2(fs, &inode)) ||
- ino == fs->super->s_journal_inum) {
+ LINUX_S_ISLNK(inode.i_mode) ||
+ ino == fs->super->s_journal_inum ||
+ ino == quota_type2inum(USRQUOTA, fs->super) ||
+ ino == quota_type2inum(GRPQUOTA, fs->super) ||
+ ino == quota_type2inum(PRJQUOTA, fs->super)) {
retval = ext2fs_block_iterate3(fs, ino,
BLOCK_FLAG_READ_ONLY, block_buf,
process_dir_block, &pb);
@@ -1514,6 +1517,8 @@ int main (int argc, char ** argv)
E2FSPROGS_DATE);
if (argc && *argv)
program_name = *argv;
+ else
+ usage();
add_error_table(&et_ext2_error_table);
while ((c = getopt(argc, argv, "b:B:nrsIQafo:O:pc")) != EOF)
switch (c) {
diff --git a/misc/e2initrd_helper.c b/misc/e2initrd_helper.c
index 436aab8c..b39fe15d 100644
--- a/misc/e2initrd_helper.c
+++ b/misc/e2initrd_helper.c
@@ -36,6 +36,7 @@ extern char *optarg;
#include "ext2fs/ext2fs.h"
#include "blkid/blkid.h"
#include "support/nls-enable.h"
+#include "support/devname.h"
#include "../version.h"
@@ -262,7 +263,7 @@ static int parse_fstab_line(char *line, struct fs_info *fs)
parse_escape(freq);
parse_escape(passno);
- dev = blkid_get_devname(cache, device, NULL);
+ dev = get_devname(cache, device, NULL);
if (dev)
device = dev;
@@ -325,7 +326,7 @@ static void PRS(int argc, char **argv)
}
if (optind < argc - 1 || optind == argc)
usage();
- device_name = blkid_get_devname(NULL, argv[optind], NULL);
+ device_name = get_devname(NULL, argv[optind], NULL);
if (!device_name) {
com_err(program_name, 0, _("Unable to resolve '%s'"),
argv[optind]);
diff --git a/misc/e2label.8.in b/misc/e2label.8.in
index 2f457072..1dc96199 100644
--- a/misc/e2label.8.in
+++ b/misc/e2label.8.in
@@ -4,7 +4,7 @@
.\"
.TH E2LABEL 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-e2label \- Change the label on an ext2/ext3/ext4 filesystem
+e2label \- Change the label on an ext2/ext3/ext4 file system
.SH SYNOPSIS
.B e2label
.I device
@@ -14,7 +14,7 @@ e2label \- Change the label on an ext2/ext3/ext4 filesystem
.SH DESCRIPTION
.B e2label
will display or change the volume label on the ext2, ext3, or ext4
-filesystem located on
+file system located on
.I device.
.PP
If the optional argument
diff --git a/misc/e2mmpstatus.8.in b/misc/e2mmpstatus.8.in
index 5f0e9dbb..c7ed929c 100644
--- a/misc/e2mmpstatus.8.in
+++ b/misc/e2mmpstatus.8.in
@@ -3,10 +3,10 @@
.\"
.TH E2MMPSTATUS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-e2mmpstatus \- Check MMP status of an ext4 filesystem
+e2mmpstatus \- Check MMP status of an ext4 file system
.SH SYNOPSIS
.BR e2mmpstatus " [" \-i ]
-.RI < filesystem >
+.RI < file system >
.SH OPTIONS
.TP
.B \-i
@@ -14,29 +14,29 @@ prints out the MMP information rather than check it.
.SH DESCRIPTION
.B e2mmpstatus
is used to check Multiple-Mount Protection (MMP) status of an ext4
-filesystem with the
+file system with the
.B mmp
feature enabled. The specified
-.I filesystem
+.I file system
can be a device name (e.g.
.IR /dev/hdc1 ", " /dev/sdb2 ),
-or an ext4 filesystem label or UUID, for example
+or an ext4 file system label or UUID, for example
.B UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd
or
.BR LABEL=root .
By default, the
.B e2mmpstatus
-program checks whether it is safe to mount the filesystem without taking
+program checks whether it is safe to mount the file system without taking
the risk of mounting it more than once.
.PP
MMP (multiple-mount protection) is a feature that adds protection against
-the filesystem being modified simultaneously by more than one node.
-It is NOT safe to mount a filesystem when one of the following conditions
+the file system being modified simultaneously by more than one node.
+It is NOT safe to mount a file system when one of the following conditions
is true:
.br
- 1. e2fsck is running on the filesystem.
+ 1. e2fsck is running on the file system.
.br
- 2. the filesystem is in use by another node.
+ 2. the file system is in use by another node.
.br
3. The MMP block is corrupted or cannot be read for some reason.
.br
@@ -48,9 +48,9 @@ frequently the MMP block is being written by the other node.
.SH EXIT CODE
The exit code returned by
.B e2mmpstatus
-is 0 when it is safe to mount the filesystem, 1 when the MMP block shows
-the filesystem is in use on another node and it is NOT safe to mount
-the filesystem, and 2 if some other failure occurred that prevents the
+is 0 when it is safe to mount the file system, 1 when the MMP block shows
+the file system is in use on another node and it is NOT safe to mount
+the file system, and 2 if some other failure occurred that prevents the
check from properly detecting the current MMP status.
.SH SEE ALSO
.BR dumpe2fs (8),
diff --git a/misc/e2undo.8.in b/misc/e2undo.8.in
index d8265b16..30253a45 100644
--- a/misc/e2undo.8.in
+++ b/misc/e2undo.8.in
@@ -4,7 +4,7 @@
.\"
.TH E2UNDO 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-e2undo \- Replay an undo log for an ext2/ext3/ext4 filesystem
+e2undo \- Replay an undo log for an ext2/ext3/ext4 file system
.SH SYNOPSIS
.B e2undo
[
@@ -32,7 +32,7 @@ e2undo \- Replay an undo log for an ext2/ext3/ext4 filesystem
.B e2undo
will replay the undo log
.I undo_log
-for an ext2/ext3/ext4 filesystem found on
+for an ext2/ext3/ext4 file system found on
.IR device .
This can be
used to undo a failed operation by an e2fsprogs program.
@@ -41,8 +41,8 @@ used to undo a failed operation by an e2fsprogs program.
.B \-f
Normally,
.B e2undo
-will check the filesystem superblock to make sure the undo log matches
-with the filesystem on the device. If they do not match,
+will check the file system superblock to make sure the undo log matches
+with the file system on the device. If they do not match,
.B e2undo
will refuse to apply the undo log as a safety mechanism. The
.B \-f
@@ -52,10 +52,10 @@ option disables this safety mechanism.
Display a usage message.
.TP
.B \-n
-Dry-run; do not actually write blocks back to the filesystem.
+Dry-run; do not actually write blocks back to the file system.
.TP
.BI \-o " offset"
-Specify the filesystem's
+Specify the file system's
.I offset
(in bytes) from the beginning of the device or file.
.TP
diff --git a/misc/e4crypt.8.in b/misc/e4crypt.8.in
index fe9372cf..97bbcc95 100644
--- a/misc/e4crypt.8.in
+++ b/misc/e4crypt.8.in
@@ -1,6 +1,6 @@
.TH E4CRYPT 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-e4crypt \- ext4 filesystem encryption utility
+e4crypt \- ext4 file system encryption utility
.SH SYNOPSIS
.B e4crypt add_key -S \fR[\fB -k \fIkeyring\fR ] [\fB-v\fR] [\fB-q\fR] \fR[\fB -p \fIpad\fR ] [ \fIpath\fR ... ]
.br
diff --git a/misc/e4defrag.8.in b/misc/e4defrag.8.in
index 6553721f..53d7f17d 100644
--- a/misc/e4defrag.8.in
+++ b/misc/e4defrag.8.in
@@ -1,6 +1,6 @@
.TH E4DEFRAG 8 "May 2009" "e4defrag version 2.0"
.SH NAME
-e4defrag \- online defragmenter for ext4 filesystem
+e4defrag \- online defragmenter for ext4 file system
.SH SYNOPSIS
.B e4defrag
[
@@ -15,13 +15,13 @@ e4defrag \- online defragmenter for ext4 filesystem
.B e4defrag
reduces fragmentation of extent based file. The file targeted by
.B e4defrag
-is created on ext4 filesystem made with "-O extent" option (see
+is created on ext4 file system made with "-O extent" option (see
.BR mke2fs (8)).
The targeted file gets more contiguous blocks and improves the file access
speed.
.PP
.I target
-is a regular file, a directory, or a device that is mounted as ext4 filesystem.
+is a regular file, a directory, or a device that is mounted as ext4 file system.
If
.I target
is a directory,
@@ -48,7 +48,7 @@ printed for each file.
.IP
Also this option outputs the average data size in one extent. If you see it,
you'll find the file has ideal extents or not. Note that the maximum extent
-size is 131072KB in ext4 filesystem (if block size is 4KB).
+size is 131072KB in ext4 file system (if block size is 4KB).
.IP
If this option is specified,
.I target
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 86e97ee3..e3011d7c 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -195,10 +195,6 @@ static struct frag_statistic_ino frag_rank[SHOW_FRAG_FILES];
#error posix_fadvise not available!
#endif
-#ifndef HAVE_FALLOCATE64
-#error fallocate64 not available!
-#endif /* ! HAVE_FALLOCATE64 */
-
/*
* get_mount_point() - Get device's mount point.
*
@@ -258,12 +254,12 @@ static int get_mount_point(const char *devname, char *mount_point,
*
* @file: the file's name.
*/
-static int is_ext4(const char *file, char *devname)
+static int is_ext4(const char *file, char devname[PATH_MAX + 1])
{
int maxlen = 0;
int len, ret;
+ int type_is_ext4 = 0;
FILE *fp = NULL;
- char *mnt_type = NULL;
/* Refer to /etc/mtab */
const char *mtab = MOUNTED;
char file_path[PATH_MAX + 1];
@@ -307,26 +303,16 @@ static int is_ext4(const char *file, char *devname)
maxlen = len;
- mnt_type = realloc(mnt_type, strlen(mnt->mnt_type) + 1);
- if (mnt_type == NULL) {
- endmntent(fp);
- return -1;
- }
- memset(mnt_type, 0, strlen(mnt->mnt_type) + 1);
- strncpy(mnt_type, mnt->mnt_type, strlen(mnt->mnt_type));
+ type_is_ext4 = !strcmp(mnt->mnt_type, FS_EXT4);
strncpy(lost_found_dir, mnt->mnt_dir, PATH_MAX);
- strncpy(devname, mnt->mnt_fsname, strlen(mnt->mnt_fsname) + 1);
+ strncpy(devname, mnt->mnt_fsname, PATH_MAX);
}
endmntent(fp);
- if (mnt_type && strcmp(mnt_type, FS_EXT4) == 0) {
- FREE(mnt_type);
+ if (type_is_ext4)
return 0;
- } else {
- FREE(mnt_type);
- PRINT_ERR_MSG(NGMSG_EXT4);
- return -1;
- }
+ PRINT_ERR_MSG(NGMSG_EXT4);
+ return -1;
}
/*
@@ -1021,7 +1007,7 @@ static int get_best_count(ext4_fsblk_t block_count)
return 1;
if (feature_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) {
- flex_bg_num = 1 << log_groups_per_flex;
+ flex_bg_num = 1U << log_groups_per_flex;
ret = ((block_count - 1) /
((ext4_fsblk_t)blocks_per_group *
flex_bg_num)) + 1;
@@ -1051,7 +1037,7 @@ static int file_statistic(const char *file, const struct stat64 *buf,
__u64 size_per_ext = 0;
float ratio = 0.0;
ext4_fsblk_t blk_count = 0;
- char msg_buffer[PATH_MAX + 24];
+ char msg_buffer[PATH_MAX + 48];
struct fiemap_extent_list *physical_list_head = NULL;
struct fiemap_extent_list *logical_list_head = NULL;
@@ -1220,8 +1206,9 @@ static int file_statistic(const char *file, const struct stat64 *buf,
if (mode_flag & DETAIL) {
/* Print statistic info */
- sprintf(msg_buffer, "[%u/%u]%s",
- defraged_file_count, total_count, file);
+ sprintf(msg_buffer, "[%u/%u]%.*s",
+ defraged_file_count, total_count,
+ PATH_MAX, file);
if (current_uid == ROOT_UID) {
if (strlen(msg_buffer) > 40)
printf("\033[79;0H\033[K%s\n"
@@ -1568,7 +1555,7 @@ static int file_defrag(const char *file, const struct stat64 *buf,
/* Allocate space for donor inode */
orig_group_tmp = orig_group_head;
do {
- ret = fallocate64(donor_fd, 0,
+ ret = fallocate(donor_fd, 0,
(ext2_loff_t)orig_group_tmp->start->data.logical * block_size,
(ext2_loff_t)orig_group_tmp->len * block_size);
if (ret < 0) {
@@ -1865,11 +1852,9 @@ int main(int argc, char *argv[])
/* fall through */
case DEVNAME:
if (arg_type == DEVNAME) {
- strncpy(lost_found_dir, dir_name,
- strnlen(dir_name, PATH_MAX));
+ strcpy(lost_found_dir, dir_name);
strncat(lost_found_dir, "/lost+found/",
- PATH_MAX - strnlen(lost_found_dir,
- PATH_MAX));
+ PATH_MAX - strlen(lost_found_dir));
}
nftw64(dir_name, calc_entry_counts, FTW_OPEN_FD, flags);
diff --git a/misc/ext4.5.in b/misc/ext4.5.in
index 90bc4f88..c835a344 100644
--- a/misc/ext4.5.in
+++ b/misc/ext4.5.in
@@ -161,8 +161,8 @@ option.
.TP
.B has_journal
.br
-Create a journal to ensure filesystem consistency even across unclean
-shutdowns. Setting the filesystem feature is equivalent to using the
+Create a journal to ensure file system consistency even across unclean
+shutdowns. Setting the file system feature is equivalent to using the
.B \-j
option with
.BR mke2fs " or " tune2fs.
@@ -208,7 +208,7 @@ kernels from mounting file systems that they could not understand.
.B metadata_csum
.br
This ext4 feature enables metadata checksumming. This feature stores
-checksums for all of the filesystem metadata (superblock, group
+checksums for all of the file system metadata (superblock, group
descriptor blocks, inode and block bitmaps, directories, and
extent tree blocks). The checksum algorithm used for the metadata
blocks is different than the one used for group descriptors with the
@@ -220,8 +220,8 @@ will be used preferentially instead of
.TP
.B metadata_csum_seed
.br
-This feature allows the filesystem to store the metadata checksum seed in the
-superblock, which allows the administrator to change the UUID of a filesystem
+This feature allows the file system to store the metadata checksum seed in the
+superblock, which allows the administrator to change the UUID of a file system
using the
.B metadata_csum
feature while it is mounted.
@@ -241,20 +241,20 @@ available in the resize inode.
.B mmp
.br
This ext4 feature provides multiple mount protection (MMP). MMP helps to
-protect the filesystem from being multiply mounted and is useful in
+protect the file system from being multiply mounted and is useful in
shared storage environments.
.TP
.B project
.br
This ext4 feature provides project quota support. With this feature,
-the project ID of inode will be managed when the filesystem is mounted.
+the project ID of inode will be managed when the file system is mounted.
.TP
.B quota
.br
Create quota inodes (inode #3 for userquota and inode
#4 for group quota) and set them in the superblock.
With this feature, the quotas will be enabled
-automatically when the filesystem is mounted.
+automatically when the file system is mounted.
.IP
Causes the quota files (i.e., user.quota and
group.quota which existed
@@ -270,7 +270,7 @@ is carried out by the kernel, triggered by
By default
.B mke2fs
will attempt to reserve enough space so that the
-filesystem may grow to 1024 times its initial size. This can be changed
+file system may grow to 1024 times its initial size. This can be changed
using the
.B resize
extended option.
@@ -301,9 +301,9 @@ contiguous blocks available for data files.
.TP
.B stable_inodes
.br
-Marks the filesystem's inode numbers and UUID as stable.
+Marks the file system's inode numbers and UUID as stable.
.BR resize2fs (8)
-will not allow shrinking a filesystem with this feature, nor
+will not allow shrinking a file system with this feature, nor
will
.BR tune2fs (8)
allow changing its UUID. This feature allows the use of specialized encryption
@@ -344,9 +344,9 @@ and ext4. Other generic mount options may be used as well; see
.BR mount (8)
for details.
.SH "Mount options for ext2"
-The `ext2' filesystem is the standard Linux filesystem.
+The `ext2' file system is the standard Linux file system.
Since Linux 2.5.46, for most mount options the default
-is determined by the filesystem superblock. Set them with
+is determined by the file system superblock. Set them with
.BR tune2fs (8).
.TP
.BR acl | noacl
@@ -361,17 +361,17 @@ system call. The
.B minixdf
behavior is to return in the
.I f_blocks
-field the total number of blocks of the filesystem, while the
+field the total number of blocks of the file system, while the
.B bsddf
behavior (which is the default) is to subtract the overhead blocks
-used by the ext2 filesystem and not available for file storage. Thus
+used by the ext2 file system and not available for file storage. Thus
.sp 1
% mount /k \-o minixdf; df /k; umount /k
.TS
tab(#);
l2 l2 r2 l2 l2 l
l c r c c l.
-Filesystem#1024-blocks#Used#Available#Capacity#Mounted on
+File System#1024-blocks#Used#Available#Capacity#Mounted on
/dev/sda6#2630655#86954#2412169#3%#/k
.TE
.sp 1
@@ -380,7 +380,7 @@ Filesystem#1024-blocks#Used#Available#Capacity#Mounted on
tab(#);
l2 l2 r2 l2 l2 l
l c r c c l.
-Filesystem#1024-blocks#Used#Available#Capacity#Mounted on
+File System#1024-blocks#Used#Available#Capacity#Mounted on
/dev/sda6#2543714#13#2412169#0%#/k
.TE
.sp 1
@@ -394,16 +394,16 @@ It is wise to invoke
.BR e2fsck (8)
every now and then, e.g.\& at boot time. The non-default behavior is unsupported
(check=normal and check=strict options have been removed). Note that these mount options
-don't have to be supported if ext4 kernel driver is used for ext2 and ext3 filesystems.
+don't have to be supported if ext4 kernel driver is used for ext2 and ext3 file systems.
.TP
.B debug
Print debugging info upon each (re)mount.
.TP
.BR errors= { continue | remount-ro | panic }
Define the behavior when an error is encountered.
-(Either ignore errors and just mark the filesystem erroneous and continue,
-or remount the filesystem read-only, or panic and halt the system.)
-The default is set in the filesystem superblock, and can be
+(Either ignore errors and just mark the file system erroneous and continue,
+or remount the file system read-only, or panic and halt the system.)
+The default is set in the file system superblock, and can be
changed using
.BR tune2fs (8).
.TP
@@ -419,7 +419,7 @@ if it is a directory itself.
.TP
.BR grpquota | noquota | quota | usrquota
The usrquota (same as quota) mount option enables user quota support on the
-filesystem. grpquota enables group quotas support. You need the quota utilities
+file system. grpquota enables group quotas support. You need the quota utilities
to actually enable and manage the quota system.
.TP
.B nouid32
@@ -430,7 +430,7 @@ kernels which only store and expect 16-bit values.
Use old allocator or Orlov allocator for new inodes. Orlov is default.
.TP
\fBresgid=\fP\,\fIn\fP and \fBresuid=\fP\,\fIn\fP
-The ext2 filesystem reserves a certain percentage of the available
+The ext2 file system reserves a certain percentage of the available
space (by default 5%, see
.BR mke2fs (8)
and
@@ -444,7 +444,7 @@ specified by
.IR n .
This option is normally used when the primary superblock has been
corrupted. The location of backup superblocks is dependent on the
-filesystem's blocksize, the number of blocks per group, and features
+file system's blocksize, the number of blocks per group, and features
such as
.BR sparse_super .
.IP
@@ -454,20 +454,20 @@ program using the
.B \-n
option to print out where the superblocks exist, supposing
.B mke2fs
-is supplied with arguments that are consistent with the filesystem's layout
+is supplied with arguments that are consistent with the file system's layout
(e.g. blocksize, blocks per group,
.BR sparse_super ,
etc.).
.IP
The block number here uses 1\ k units. Thus, if you want to use logical
-block 32768 on a filesystem with 4\ k blocks, use "sb=131072".
+block 32768 on a file system with 4\ k blocks, use "sb=131072".
.TP
.BR user_xattr | nouser_xattr
Support "user." extended attributes (or not).
.SH "Mount options for ext3"
-The ext3 filesystem is a version of the ext2 filesystem which has been
+The ext3 file system is a version of the ext2 file system which has been
enhanced with journaling. It supports the same options as ext2 as
well as the following additions:
.TP
@@ -480,22 +480,22 @@ in devnum, or via a path to the device.
.TP
.BR norecovery / noload
Don't load the journal on mounting. Note that
-if the filesystem was not unmounted cleanly,
+if the file system was not unmounted cleanly,
skipping the journal replay will lead to the
-filesystem containing inconsistencies that can
+file system containing inconsistencies that can
lead to any number of problems.
.TP
.BR data= { journal | ordered | writeback }
Specifies the journaling mode for file data. Metadata is always journaled.
To use modes other than
.B ordered
-on the root filesystem, pass the mode to the kernel as boot parameter, e.g.\&
+on the root file system, pass the mode to the kernel as boot parameter, e.g.\&
.IR rootflags=data=journal .
.RS
.TP
.B journal
All data is committed into the journal prior to being written into the
-main filesystem.
+main file system.
.TP
.B ordered
This is the default mode. All data is forced directly out to the main file
@@ -503,9 +503,9 @@ system prior to its metadata being committed to the journal.
.TP
.B writeback
Data ordering is not preserved \(en data may be written into the main
-filesystem after its metadata has been committed to the journal.
+file system after its metadata has been committed to the journal.
This is rumoured to be the highest-throughput option. It guarantees
-internal filesystem integrity, however it can allow old data to appear
+internal file system integrity, however it can allow old data to appear
in files after a crash and journal recovery.
.RE
.TP
@@ -541,7 +541,7 @@ ext3 also supports journaled quotas (version 2 quota). jqfmt=vfsv0 or
jqfmt=vfsv1 enables journaled quotas. Journaled quotas have the advantage that
even after a crash no quota check is required. When the
.B quota
-filesystem feature is enabled, journaled quotas are used automatically, and
+file system feature is enabled, journaled quotas are used automatically, and
this mount option is ignored.
.TP
.BR usrjquota=aquota.user | grpjquota=aquota.group
@@ -549,13 +549,13 @@ For journaled quotas (jqfmt=vfsv0 or jqfmt=vfsv1), the mount options
usrjquota=aquota.user and grpjquota=aquota.group are required to tell the
quota system which quota database files to use. When the
.B quota
-filesystem feature is enabled, journaled quotas are used automatically, and
+file system feature is enabled, journaled quotas are used automatically, and
this mount option is ignored.
.SH "Mount options for ext4"
-The ext4 filesystem is an advanced level of the ext3 filesystem which
+The ext4 file system is an advanced level of the ext3 file system which
incorporates scalability and reliability enhancements for supporting large
-filesystem.
+file system.
The options
.B journal_dev, journal_path, norecovery, noload, data, commit, orlov,
@@ -579,7 +579,7 @@ These mount options have the same effect as in ext3. The mount options
"barrier" and "nobarrier" are added for consistency with other ext4 mount
options.
-The ext4 filesystem enables write barriers by default.
+The ext4 file system enables write barriers by default.
.TP
.BI inode_readahead_blks= n
This tuning parameter controls the maximum number of inode table blocks that
@@ -587,9 +587,9 @@ ext4's inode table readahead algorithm will pre-read into the buffer cache.
The value must be a power of 2. The default value is 32 blocks.
.TP
.BI stripe= n
-Number of filesystem blocks that mballoc will try to use for allocation size
+Number of file system blocks that mballoc will try to use for allocation size
and alignment. For RAID5/6 systems this should be the number of data disks *
-RAID chunk size in filesystem blocks.
+RAID chunk size in file system blocks.
.TP
.B delalloc
Deferring block allocation until write-out time.
@@ -599,7 +599,7 @@ Disable delayed allocation. Blocks are allocated when data is copied from user
to page cache.
.TP
.BI max_batch_time= usec
-Maximum amount of time ext4 should wait for additional filesystem operations to
+Maximum amount of time ext4 should wait for additional file system operations to
be batch together with a synchronous write operation. Since a synchronous
write operation is going to force a commit and then a wait for the I/O
complete, it doesn't cost much, and can be a huge throughput win, we wait for a
@@ -628,7 +628,7 @@ priority.
.B abort
Simulate the effects of calling ext4_abort() for
debugging purposes. This is normally used while
-remounting a filesystem which is already mounted.
+remounting a file system which is already mounted.
.TP
.BR auto_da_alloc | noauto_da_alloc
Many broken applications don't use fsync() when
@@ -652,12 +652,12 @@ crashes before the delayed allocation blocks are forced to disk.
Do not initialize any uninitialized inode table blocks in the background. This
feature may be used by installation CD's so that the install process can
complete as quickly as possible; the inode table initialization process would
-then be deferred until the next time the filesystem is mounted.
+then be deferred until the next time the file system is mounted.
.TP
.B init_itable=n
The lazy itable init code will wait n times the number of milliseconds it took
to zero out the previous block group's inode table. This minimizes the impact on
-system performance while the filesystem's inode table is being initialized.
+system performance while the file system's inode table is being initialized.
.TP
.BR discard / nodiscard
Controls whether ext4 should issue discard/TRIM commands to the underlying
@@ -667,9 +667,9 @@ testing has been done.
.TP
.BR block_validity / noblock_validity
This option enables/disables the in-kernel facility for tracking
-filesystem metadata blocks within internal data structures. This allows multi-\c
+file system metadata blocks within internal data structures. This allows multi-\c
block allocator and other routines to quickly locate extents which might
-overlap with filesystem metadata blocks. This option is intended for debugging
+overlap with file system metadata blocks. This option is intended for debugging
purposes and since it negatively affects the performance, it is off by default.
.TP
.BR dioread_lock / dioread_nolock
@@ -700,14 +700,14 @@ systems where extended attributes are rarely or never shared between files,
use of mbcache for deduplication adds unnecessary computational overhead.
.TP
.B prjquota
-The prjquota mount option enables project quota support on the filesystem.
+The prjquota mount option enables project quota support on the file system.
You need the quota utilities to actually enable and manage the quota system.
This mount option requires the
.B project
-filesystem feature.
+file system feature.
.SH FILE ATTRIBUTES
-The ext2, ext3, and ext4 filesystems support setting the following file
+The ext2, ext3, and ext4 file systems support setting the following file
attributes on Linux systems using the
.BR chattr (1)
utility:
@@ -726,11 +726,11 @@ utility:
.sp
.BR u " - undeletable"
.sp
-In addition, the ext3 and ext4 filesystems support the following flag:
+In addition, the ext3 and ext4 file systems support the following flag:
.sp
.BR j " - data journaling"
.sp
-Finally, the ext4 filesystem also supports the following flag:
+Finally, the ext4 file system also supports the following flag:
.sp
.BR e " - extents format"
.sp
diff --git a/misc/filefrag.8.in b/misc/filefrag.8.in
index d15d3632..6d56c130 100644
--- a/misc/filefrag.8.in
+++ b/misc/filefrag.8.in
@@ -8,7 +8,7 @@ filefrag \- report on file fragmentation
.BI \-b blocksize
]
[
-.B \-BeksvxX
+.B \-BeEkPsvVxX
]
[
.I files...
@@ -16,8 +16,8 @@ filefrag \- report on file fragmentation
.SH DESCRIPTION
.B filefrag
reports on how badly fragmented a particular file might be. It makes
-allowances for indirect blocks for ext2 and ext3 filesystems, but can be
-used on files for any filesystem.
+allowances for indirect blocks for ext2 and ext3 file systems, but can be
+used on files for any file system.
.PP
The
.B filefrag
@@ -34,11 +34,14 @@ testing purposes.
Use
.I blocksize
in bytes, or with [KMG] suffix, up to 1GB for output instead of the
-filesystem blocksize. For compatibility with earlier versions of
+file system blocksize. For compatibility with earlier versions of
.BR filefrag ,
if
.I blocksize
-is unspecified it defaults to 1024 bytes.
+is unspecified it defaults to 1024 bytes. Since
+.I blocksize
+is an optional argument, it must be added without any space after
+.BR -b .
.TP
.B \-e
Print output in extent format, even for block-mapped files.
@@ -47,12 +50,12 @@ Print output in extent format, even for block-mapped files.
Display the contents of ext4's extent status cache. This feature is not
supported on all kernels, and is only supported on ext4 file systems.
.TP
+.B \-k
+Use 1024\-byte blocksize for output (identical to '\-b1024').
.TP
.B -P
-Pre-load the ext4's extent status cache for the file. This feature is not
+Pre-load the ext4 extent status cache for the file. This is not
supported on all kernels, and is only supported on ext4 file systems.
-.B \-k
-Use 1024\-byte blocksize for output (identical to '\-b 1024').
.TP
.B \-s
Sync the file before requesting the mapping.
@@ -60,6 +63,10 @@ Sync the file before requesting the mapping.
.B \-v
Be verbose when checking for file fragmentation.
.TP
+.B \-V
+Print version number of program and library. If given twice, also
+print the FIEMAP flags that are understood by the current version.
+.TP
.B \-x
Display mapping of extended attributes.
.TP
diff --git a/misc/filefrag.c b/misc/filefrag.c
index 1e43131e..eaaa90a8 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -51,13 +51,14 @@ extern int optind;
#include <ext2fs/ext2fs.h>
#include <ext2fs/ext2_types.h>
#include <ext2fs/fiemap.h>
+#include "../version.h"
int verbose = 0;
unsigned int blocksize; /* Use specified blocksize (default 1kB) */
int sync_file = 0; /* fsync file before getting the mapping */
int precache_file = 0; /* precache the file before getting the mapping */
int xattr_map = 0; /* get xattr mapping */
-int force_bmap; /* force use of FIBMAP instead of FIEMAP */
+int force_bmap; /* force use of FIBMAP instead of FIEMAP */
int force_extent; /* print output in extent format always */
int use_extent_cache; /* Use extent cache */
int logical_width = 8;
@@ -132,13 +133,49 @@ static void print_extent_header(void)
static void print_flag(__u32 *flags, __u32 mask, char *buf, const char *name)
{
+ char hex[sizeof(mask) * 2 + 4]; /* 2 chars/byte + 0x, + NUL */
+
if ((*flags & mask) == 0)
return;
+ if (name == NULL) {
+ sprintf(hex, "%#04x,", mask);
+ name = hex;
+ }
strcat(buf, name);
*flags &= ~mask;
}
+static void print_flags(__u32 fe_flags, char *flags, int len, int print_unknown)
+{
+ __u32 mask;
+
+ print_flag(&fe_flags, FIEMAP_EXTENT_LAST, flags, "last,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_UNKNOWN, flags, "unknown_loc,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_DELALLOC, flags, "delalloc,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_ENCODED, flags, "encoded,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_DATA_ENCRYPTED, flags,"encrypted,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_NOT_ALIGNED, flags, "not_aligned,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_DATA_INLINE, flags, "inline,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_DATA_TAIL, flags, "tail_packed,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_UNWRITTEN, flags, "unwritten,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_MERGED, flags, "merged,");
+ print_flag(&fe_flags, FIEMAP_EXTENT_SHARED, flags, "shared,");
+ print_flag(&fe_flags, EXT4_FIEMAP_EXTENT_HOLE, flags, "hole,");
+
+ if (!print_unknown)
+ goto out;
+
+ /* print any unknown flags as hex values */
+ for (mask = 1; fe_flags != 0 && mask != 0; mask <<= 1)
+ print_flag(&fe_flags, mask, flags, NULL);
+out:
+ /* Remove trailing comma, if any */
+ if (flags[0])
+ flags[strnlen(flags, len) - 1] = '\0';
+
+}
+
static void print_extent_info(struct fiemap_extent *fm_extent, int cur_ex,
unsigned long long expected, int blk_shift,
ext2fs_struct_stat *st)
@@ -148,7 +185,6 @@ static void print_extent_info(struct fiemap_extent *fm_extent, int cur_ex,
unsigned long long ext_len;
unsigned long long ext_blks;
unsigned long long ext_blks_phys;
- __u32 fe_flags, mask;
char flags[256] = "";
/* For inline data all offsets should be in bytes, not blocks */
@@ -164,44 +200,19 @@ static void print_extent_info(struct fiemap_extent *fm_extent, int cur_ex,
physical_blk = fm_extent->fe_physical >> blk_shift;
}
- fe_flags = fm_extent->fe_flags;
if (expected &&
- !(fe_flags & FIEMAP_EXTENT_UNKNOWN) &&
- !(fe_flags & EXT4_FIEMAP_EXTENT_HOLE))
+ !(fm_extent->fe_flags & FIEMAP_EXTENT_UNKNOWN) &&
+ !(fm_extent->fe_flags & EXT4_FIEMAP_EXTENT_HOLE))
sprintf(flags, ext_fmt == hex_fmt ? "%*llx: " : "%*llu: ",
physical_width, expected >> blk_shift);
else
sprintf(flags, "%.*s ", physical_width, " ");
- print_flag(&fe_flags, FIEMAP_EXTENT_LAST, flags, "last,");
- print_flag(&fe_flags, FIEMAP_EXTENT_UNKNOWN, flags, "unknown_loc,");
- print_flag(&fe_flags, FIEMAP_EXTENT_DELALLOC, flags, "delalloc,");
- print_flag(&fe_flags, FIEMAP_EXTENT_ENCODED, flags, "encoded,");
- print_flag(&fe_flags, FIEMAP_EXTENT_DATA_ENCRYPTED, flags,"encrypted,");
- print_flag(&fe_flags, FIEMAP_EXTENT_NOT_ALIGNED, flags, "not_aligned,");
- print_flag(&fe_flags, FIEMAP_EXTENT_DATA_INLINE, flags, "inline,");
- print_flag(&fe_flags, FIEMAP_EXTENT_DATA_TAIL, flags, "tail_packed,");
- print_flag(&fe_flags, FIEMAP_EXTENT_UNWRITTEN, flags, "unwritten,");
- print_flag(&fe_flags, FIEMAP_EXTENT_MERGED, flags, "merged,");
- print_flag(&fe_flags, FIEMAP_EXTENT_SHARED, flags, "shared,");
- print_flag(&fe_flags, EXT4_FIEMAP_EXTENT_HOLE, flags, "hole,");
- /* print any unknown flags as hex values */
- for (mask = 1; fe_flags != 0 && mask != 0; mask <<= 1) {
- char hex[sizeof(mask) * 2 + 4]; /* 2 chars/byte + 0x, + NUL */
-
- if ((fe_flags & mask) == 0)
- continue;
- sprintf(hex, "%#04x,", mask);
- print_flag(&fe_flags, mask, flags, hex);
- }
+ print_flags(fm_extent->fe_flags, flags, sizeof(flags), 1);
if (fm_extent->fe_logical + fm_extent->fe_length >=
- (unsigned long long) st->st_size)
- strcat(flags, "eof,");
-
- /* Remove trailing comma, if any */
- if (flags[0] != '\0')
- flags[strnlen(flags, sizeof(flags)) - 1] = '\0';
+ (unsigned long long)st->st_size)
+ strcat(flags, flags[0] ? ",eof" : "eof");
if ((fm_extent->fe_flags & FIEMAP_EXTENT_UNKNOWN) ||
(fm_extent->fe_flags & EXT4_FIEMAP_EXTENT_HOLE)) {
@@ -522,8 +533,8 @@ static int frag_report(const char *filename)
&st, numblocks, is_ext2);
if (expected < 0) {
if (expected == -EINVAL || expected == -ENOTTY) {
- fprintf(stderr, "%s: FIBMAP unsupported\n",
- filename);
+ fprintf(stderr, "%s: FIBMAP%s unsupported\n",
+ filename, force_bmap ? "" : "/FIEMAP");
} else if (expected == -EPERM) {
fprintf(stderr,
"%s: FIBMAP requires root privileges\n",
@@ -567,8 +578,9 @@ int main(int argc, char**argv)
{
char **cpp;
int rc = 0, c;
+ int version = 0;
- while ((c = getopt(argc, argv, "Bb::eEkPsvxX")) != EOF) {
+ while ((c = getopt(argc, argv, "Bb::eEkPsvVxX")) != EOF) {
switch (c) {
case 'B':
force_bmap++;
@@ -642,6 +654,9 @@ int main(int argc, char**argv)
case 'v':
verbose++;
break;
+ case 'V':
+ version++;
+ break;
case 'x':
xattr_map++;
break;
@@ -653,6 +668,17 @@ int main(int argc, char**argv)
break;
}
}
+ if (version) {
+ /* Print version number and exit */
+ printf("filefrag %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
+ if (version + verbose > 1) {
+ char flags[256] = "";
+
+ print_flags(0xffffffff, flags, sizeof(flags), 0);
+ printf("supported: %s\n", flags);
+ }
+ exit(0);
+ }
if (optind == argc)
usage(argv[0]);
diff --git a/misc/findfs.8.in b/misc/findfs.8.in
index 3146e0c8..00c33abe 100644
--- a/misc/findfs.8.in
+++ b/misc/findfs.8.in
@@ -4,7 +4,7 @@
.\"
.TH FINDFS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-findfs \- Find a filesystem by label or UUID
+findfs \- Find a file system by label or UUID
.SH SYNOPSIS
.B findfs
.BI LABEL= label
@@ -13,12 +13,12 @@ findfs \- Find a filesystem by label or UUID
.BI UUID= uuid
.SH DESCRIPTION
.B findfs
-will search the disks in the system looking for a filesystem which has
+will search the disks in the system looking for a file system which has
a label matching
.I label
or a UUID equal to
.IR uuid .
-If the filesystem is found, the device name for the filesystem will
+If the file system is found, the device name for the file system will
be printed on stdout.
.PP
.SH AUTHOR
diff --git a/misc/fsck.8.in b/misc/fsck.8.in
index e751f8de..c1890dfc 100644
--- a/misc/fsck.8.in
+++ b/misc/fsck.8.in
@@ -36,15 +36,15 @@ or an ext2 label or UUID specifier (e.g.
UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).
Normally, the
.B fsck
-program will try to handle filesystems on different physical disk drives
+program will try to handle file systems on different physical disk drives
in parallel to reduce the total amount of time needed to check all of the
-filesystems.
+file systems.
.PP
-If no filesystems are specified on the command line, and the
+If no file systems are specified on the command line, and the
.B \-A
option is not specified,
.B fsck
-will default to checking filesystems in
+will default to checking file systems in
.B /etc/fstab
serially. This is equivalent to the
.B \-As
@@ -93,7 +93,7 @@ further details.
Serialize
.B fsck
operations. This is a good idea if you are checking multiple
-filesystems and the checkers are in an interactive mode. (Note:
+file systems and the checkers are in an interactive mode. (Note:
.BR e2fsck (8)
runs in an interactive mode by default. To make
.BR e2fsck (8)
@@ -108,21 +108,21 @@ option if you do not.)
.BI \-t " fslist"
Specifies the type(s) of file system to be checked. When the
.B \-A
-flag is specified, only filesystems that match
+flag is specified, only file systems that match
.I fslist
are checked. The
.I fslist
-parameter is a comma-separated list of filesystems and options
-specifiers. All of the filesystems in this comma-separated list may be
+parameter is a comma-separated list of file systems and options
+specifiers. All of the file systems in this comma-separated list may be
prefixed by a negation operator
.RB ' no '
or
.RB ' ! ',
-which requests that only those filesystems not listed in
+which requests that only those file systems not listed in
.I fslist
-will be checked. If all of the filesystems in
+will be checked. If all of the file systems in
.I fslist
-are not prefixed by a negation operator, then only those filesystems
+are not prefixed by a negation operator, then only those file systems
listed
in
.I fslist
@@ -132,13 +132,13 @@ Options specifiers may be included in the comma-separated
.IR fslist .
They must have the format
.BI opts= fs-option\fR.
-If an options specifier is present, then only filesystems which contain
+If an options specifier is present, then only file systems which contain
.I fs-option
in their mount options field of
.B /etc/fstab
will be checked. If the options specifier is prefixed by a negation
operator, then only
-those filesystems that do not have
+those file systems that do not have
.I fs-option
in their mount options field of
.B /etc/fstab
@@ -148,7 +148,7 @@ For example, if
.B opts=ro
appears in
.IR fslist ,
-then only filesystems listed in
+then only file systems listed in
.B /etc/fstab
with the
.B ro
@@ -157,7 +157,7 @@ option will be checked.
For compatibility with Mandrake distributions whose boot scripts
depend upon an unauthorized UI change to the
.B fsck
-program, if a filesystem type of
+program, if a file system type of
.B loop
is found in
.IR fslist ,
@@ -167,17 +167,17 @@ were specified as an argument to the
.B \-t
option.
.sp
-Normally, the filesystem type is deduced by searching for
+Normally, the file system type is deduced by searching for
.I filesys
in the
.I /etc/fstab
file and using the corresponding entry.
-If the type can not be deduced, and there is only a single filesystem
+If the type can not be deduced, and there is only a single file system
given as an argument to the
.B \-t
option,
.B fsck
-will use the specified filesystem type. If this type is not
+will use the specified file system type. If this type is not
available, then the default file system type (currently ext2) is used.
.TP
.B \-A
@@ -189,53 +189,53 @@ typically used from the
system initialization file, instead of multiple commands for checking
a single file system.
.sp
-The root filesystem will be checked first unless the
+The root file system will be checked first unless the
.B \-P
option is specified (see below). After that,
-filesystems will be checked in the order specified by the
+file systems will be checked in the order specified by the
.I fs_passno
(the sixth) field in the
.I /etc/fstab
file.
-Filesystems with a
+File Systems with a
.I fs_passno
-value of 0 are skipped and are not checked at all. Filesystems with a
+value of 0 are skipped and are not checked at all. File Systems with a
.I fs_passno
value of greater than zero will be checked in order,
-with filesystems with the lowest
+with file systems with the lowest
.I fs_passno
number being checked first.
-If there are multiple filesystems with the same pass number,
+If there are multiple file systems with the same pass number,
fsck will attempt to check them in parallel, although it will avoid running
-multiple filesystem checks on the same physical disk.
+multiple file system checks on the same physical disk.
.sp
Hence, a very common configuration in
.I /etc/fstab
-files is to set the root filesystem to have a
+files is to set the root file system to have a
.I fs_passno
value of 1
-and to set all other filesystems to have a
+and to set all other file systems to have a
.I fs_passno
value of 2. This will allow
.B fsck
-to automatically run filesystem checkers in parallel if it is advantageous
+to automatically run file system checkers in parallel if it is advantageous
to do so. System administrators might choose
-not to use this configuration if they need to avoid multiple filesystem
+not to use this configuration if they need to avoid multiple file system
checks running in parallel for some reason --- for example, if the
machine in question is short on memory so that
excessive paging is a concern.
.TP
.B \-C\fR [ \fI "fd" \fR ]
-Display completion/progress bars for those filesystem checkers (currently
+Display completion/progress bars for those file system checkers (currently
only for ext2 and ext3) which support them. Fsck will manage the
-filesystem checkers so that only one of them will display
+file system checkers so that only one of them will display
a progress bar at a time. GUI front-ends may specify a file descriptor
.IR fd ,
in which case the progress bar information will be sent to that file descriptor.
.TP
.B \-M
-Do not check mounted filesystems and return an exit code of 0
-for mounted filesystems.
+Do not check mounted file systems and return an exit code of 0
+for mounted file systems.
.TP
.B \-N
Don't execute, just show what would be done.
@@ -243,13 +243,13 @@ Don't execute, just show what would be done.
.B \-P
When the
.B \-A
-flag is set, check the root filesystem in parallel with the other filesystems.
+flag is set, check the root file system in parallel with the other file systems.
This is not the safest thing in the world to do,
-since if the root filesystem is in doubt things like the
+since if the root file system is in doubt things like the
.BR e2fsck (8)
executable might be corrupted! This option is mainly provided
for those sysadmins who don't want to repartition the root
-filesystem to be small and compact (which is really the right solution).
+file system to be small and compact (which is really the right solution).
.TP
.B \-R
When checking all file systems with the
@@ -266,7 +266,7 @@ that are executed.
.B fs-specific-options
Options which are not understood by
.B fsck
-are passed to the filesystem-specific checker. These arguments
+are passed to the file system-specific checker. These arguments
.B must
not take arguments, as there is no
way for
@@ -280,9 +280,9 @@ are treated as file system-specific options to be passed to the
file system-specific checker.
.IP
Please note that fsck is not
-designed to pass arbitrarily complicated options to filesystem-specific
+designed to pass arbitrarily complicated options to file system-specific
checkers. If you're doing something complicated, please just
-execute the filesystem-specific checker directly. If you pass
+execute the file system-specific checker directly. If you pass
.B fsck
some horribly complicated option and arguments, and it doesn't do
what you expect,
@@ -291,8 +291,8 @@ You're almost certainly doing something that you shouldn't be doing
with
.BR fsck.
.PP
-Options to different filesystem-specific fsck's are not standardized.
-If in doubt, please consult the man pages of the filesystem-specific
+Options to different file system-specific fsck's are not standardized.
+If in doubt, please consult the man pages of the file system-specific
checker. Although not guaranteed, the following options are supported
by most file system checkers:
.TP
@@ -310,11 +310,11 @@ option which is safe to use, unlike the
option that some file system checkers support.
.TP
.B \-n
-For some filesystem-specific checkers, the
+For some file system-specific checkers, the
.B \-n
option will cause the fs-specific fsck to avoid attempting to repair any
problems, but simply report such problems to stdout. This is however
-not true for all filesystem-specific checkers. In particular,
+not true for all file system-specific checkers. In particular,
.BR fsck.reiserfs (8)
will not report any corruption if given this option.
.BR fsck.minix (8)
@@ -323,7 +323,7 @@ does not support the
option at all.
.TP
.B \-r
-Interactively repair the filesystem (ask for confirmations). Note: It
+Interactively repair the file system (ask for confirmations). Note: It
is generally a bad idea to use this option if multiple fsck's are being
run in parallel. Also note that this is
.BR e2fsck 's
@@ -331,13 +331,13 @@ default behavior; it supports this option for backwards compatibility
reasons only.
.TP
.B \-y
-For some filesystem-specific checkers, the
+For some file system-specific checkers, the
.B \-y
option will cause the fs-specific fsck to always attempt to fix any
-detected filesystem corruption automatically. Sometimes an expert may
+detected file system corruption automatically. Sometimes an expert may
be able to do better driving the fsck manually. Note that
.B not
-all filesystem-specific checkers implement this option. In particular
+all file system-specific checkers implement this option. In particular
.BR fsck.minix (8)
and
.BR fsck.cramfs (8)
@@ -356,8 +356,8 @@ program's behavior is affected by the following environment variables:
.B FSCK_FORCE_ALL_PARALLEL
If this environment variable is set,
.B fsck
-will attempt to run all of the specified filesystems in parallel,
-regardless of whether the filesystems appear to be on the same
+will attempt to run all of the specified file systems in parallel,
+regardless of whether the file systems appear to be on the same
device. (This is useful for RAID systems or high-end storage systems
such as those sold by companies such as IBM or EMC.)
.TP
diff --git a/misc/fsck.c b/misc/fsck.c
index 4efe10ec..1769a106 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -59,6 +59,7 @@
#endif
#include "../version.h"
+#include "support/devname.h"
#include "support/nls-enable.h"
#include "fsck.h"
#include "blkid/blkid.h"
@@ -297,7 +298,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs)
parse_escape(freq);
parse_escape(passno);
- dev = blkid_get_devname(cache, device, NULL);
+ dev = get_devname(cache, device, NULL);
if (dev)
device = dev;
@@ -546,6 +547,8 @@ static int kill_all(int signum)
for (inst = instance_list; inst; inst = inst->next) {
if (inst->flags & FLAG_DONE)
continue;
+ if (inst->pid <= 0)
+ continue;
kill(inst->pid, signum);
n++;
}
@@ -1128,7 +1131,7 @@ static void PRS(int argc, char *argv[])
progname);
exit(EXIT_ERROR);
}
- dev = blkid_get_devname(cache, arg, NULL);
+ dev = get_devname(cache, arg, NULL);
if (!dev && strchr(arg, '=')) {
/*
* Check to see if we failed because
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index c5957212..0dc77ead 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -325,6 +325,7 @@ struct fuse2fs {
int fakeroot;
int alloc_all_blocks;
int norecovery;
+ unsigned long offset;
FILE *err_fp;
unsigned int next_generation;
};
@@ -2508,9 +2509,10 @@ static int copy_names(char *name, char *value EXT2FS_ATTR((unused)),
size_t value_len EXT2FS_ATTR((unused)), void *data)
{
char **b = data;
+ size_t name_len = strlen(name);
- strncpy(*b, name, strlen(name));
- *b = *b + strlen(name) + 1;
+ memcpy(*b, name, name_len + 1);
+ *b = *b + name_len + 1;
return 0;
}
@@ -3659,6 +3661,7 @@ static struct fuse_opt fuse2fs_opts[] = {
FUSE2FS_OPT("fuse2fs_debug", debug, 1),
FUSE2FS_OPT("no_default_opts", no_default_opts, 1),
FUSE2FS_OPT("norecovery", norecovery, 1),
+ FUSE2FS_OPT("offset=%lu", offset, 0),
FUSE_OPT_KEY("-V", FUSE2FS_VERSION),
FUSE_OPT_KEY("--version", FUSE2FS_VERSION),
@@ -3697,6 +3700,7 @@ static int fuse2fs_opt_proc(void *data, const char *arg,
" -o minixdf minix-style df\n"
" -o fakeroot pretend to be root for permission checks\n"
" -o no_default_opts do not include default fuse options\n"
+ " -o offset=<bytes> similar to mount -o offset=<bytes>, mount the partition starting at <bytes>\n"
" -o norecovery don't replay the journal (implies ro)\n"
" -o fuse2fs_debug enable fuse2fs debugging\n"
"\n",
@@ -3776,7 +3780,9 @@ int main(int argc, char *argv[])
ret = 2;
if (!fctx.ro)
flags |= EXT2_FLAG_RW;
- err = ext2fs_open2(fctx.device, NULL, flags, 0, 0, unix_io_manager,
+ char options[50];
+ sprintf(options, "offset=%lu", fctx.offset);
+ err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
&global_fs);
if (err) {
printf(_("%s: %s.\n"), fctx.device, error_message(err));
diff --git a/misc/lsattr.c b/misc/lsattr.c
index 0d954376..72f4c681 100644
--- a/misc/lsattr.c
+++ b/misc/lsattr.c
@@ -144,6 +144,11 @@ static int lsattr_dir_proc (const char * dir_name, struct dirent * de,
int dir_len = strlen(dir_name);
path = malloc(dir_len + strlen (de->d_name) + 2);
+ if (!path) {
+ fputs(_("Couldn't allocate path variable in lsattr_dir_proc\n"),
+ stderr);
+ return -1;
+ }
if (dir_len && dir_name[dir_len-1] == '/')
sprintf (path, "%s%s", dir_name, de->d_name);
@@ -182,6 +187,8 @@ int main (int argc, char ** argv)
#endif
if (argc && *argv)
program_name = *argv;
+ else
+ usage();
while ((c = getopt (argc, argv, "RVadlvp")) != EOF)
switch (c)
{
diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c
index 0280b41e..3caaf1b6 100644
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -2,13 +2,8 @@
* mk_hugefiles.c -- create huge files
*/
-#define _XOPEN_SOURCE 600 /* for inclusion of PATH_MAX in Solaris */
-#define _BSD_SOURCE /* for makedev() and major() */
-#define _DEFAULT_SOURCE /* since glibc 2.20 _BSD_SOURCE is deprecated */
-
#include "config.h"
#include <stdio.h>
-#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
@@ -68,141 +63,30 @@ static char *fn_buf;
static char *fn_numbuf;
int zero_hugefile = 1;
-#define SYSFS_PATH_LEN 300
-typedef char sysfs_path_t[SYSFS_PATH_LEN];
-
-#ifndef HAVE_SNPRINTF
-/*
- * We are very careful to avoid needing to worry about buffer
- * overflows, so we don't really need to use snprintf() except as an
- * additional safety check. So if snprintf() is not present, it's
- * safe to fall back to vsprintf(). This provides portability since
- * vsprintf() is guaranteed by C89, while snprintf() is only
- * guaranteed by C99 --- which for example, Microsoft Visual Studio
- * has *still* not bothered to implement. :-/ (Not that I expect
- * mke2fs to be ported to MS Visual Studio any time soon, but
- * libext2fs *does* get built on Microsoft platforms, and we might
- * want to move this into libext2fs some day.)
- */
-static int my_snprintf(char *str, size_t size, const char *format, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = vsprintf(str, format, ap);
- va_end(ap);
- return ret;
-}
-
-#define snprintf my_snprintf
-#endif
-
-/*
- * Fall back to Linux's definitions of makedev and major are needed.
- * The search_sysfs_block() function is highly unlikely to work on
- * non-Linux systems anyway.
- */
-#ifndef makedev
-#define makedev(maj, min) (((maj) << 8) + (min))
-#endif
-
-static char *search_sysfs_block(dev_t devno, sysfs_path_t ret_path)
-{
- struct dirent *de, *p_de;
- DIR *dir = NULL, *p_dir = NULL;
- FILE *f;
- sysfs_path_t path, p_path;
- unsigned int major, minor;
- char *ret = ret_path;
-
- ret_path[0] = 0;
- if ((dir = opendir("/sys/block")) == NULL)
- return NULL;
- while ((de = readdir(dir)) != NULL) {
- if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") ||
- strlen(de->d_name) > sizeof(path)-32)
- continue;
- snprintf(path, SYSFS_PATH_LEN,
- "/sys/block/%s/dev", de->d_name);
- f = fopen(path, "r");
- if (f &&
- (fscanf(f, "%u:%u", &major, &minor) == 2)) {
- fclose(f); f = NULL;
- if (makedev(major, minor) == devno) {
- snprintf(ret_path, SYSFS_PATH_LEN,
- "/sys/block/%s", de->d_name);
- goto success;
- }
-#ifdef major
- if (major(devno) != major)
- continue;
-#endif
- }
- if (f)
- fclose(f);
-
- snprintf(path, SYSFS_PATH_LEN, "/sys/block/%s", de->d_name);
-
- if (p_dir)
- closedir(p_dir);
- if ((p_dir = opendir(path)) == NULL)
- continue;
- while ((p_de = readdir(p_dir)) != NULL) {
- if (!strcmp(p_de->d_name, ".") ||
- !strcmp(p_de->d_name, "..") ||
- (strlen(p_de->d_name) >
- SYSFS_PATH_LEN - strlen(path) - 32))
- continue;
- snprintf(p_path, SYSFS_PATH_LEN, "%s/%s/dev",
- path, p_de->d_name);
-
- f = fopen(p_path, "r");
- if (f &&
- (fscanf(f, "%u:%u", &major, &minor) == 2) &&
- (((major << 8) + minor) == devno)) {
- fclose(f);
- snprintf(ret_path, SYSFS_PATH_LEN, "%s/%s",
- path, p_de->d_name);
- goto success;
- }
- if (f)
- fclose(f);
- }
- }
- ret = NULL;
-success:
- if (dir)
- closedir(dir);
- if (p_dir)
- closedir(p_dir);
- return ret;
-}
-
-static blk64_t get_partition_start(const char *device_name)
+static blk64_t
+get_partition_start(const char *device_name EXT2FS_ATTR((unused)))
{
+#ifdef __linux__
unsigned long long start;
- sysfs_path_t path;
+ char path[128];
struct stat st;
FILE *f;
- char *cp;
int n;
if ((stat(device_name, &st) < 0) || !S_ISBLK(st.st_mode))
return 0;
- cp = search_sysfs_block(st.st_rdev, path);
- if (!cp)
- return 0;
- if (strlen(path) > SYSFS_PATH_LEN - sizeof("/start"))
- return 0;
- strcat(path, "/start");
+ sprintf(path, "/sys/dev/block/%d:%d/start",
+ major(st.st_rdev), minor(st.st_rdev));
f = fopen(path, "r");
if (!f)
return 0;
n = fscanf(f, "%llu", &start);
fclose(f);
return (n == 1) ? start : 0;
+#else
+ return 0;
+#endif
}
static errcode_t create_directory(ext2_filsys fs, char *dir,
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 84248ffc..c0b53245 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -4,7 +4,7 @@
.\"
.TH MKE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-mke2fs \- create an ext2/ext3/ext4 filesystem
+mke2fs \- create an ext2/ext3/ext4 file system
.SH SYNOPSIS
.B mke2fs
[
@@ -155,7 +155,7 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
@JDEV@]
.SH DESCRIPTION
.B mke2fs
-is used to create an ext2, ext3, or ext4 filesystem, usually in a disk
+is used to create an ext2, ext3, or ext4 file system, usually in a disk
partition (or file) named by
.IR device .
.PP
@@ -198,7 +198,7 @@ will create a file system for use with ext3,
.B mkfs.ext4
will create a file system for use with ext4, and so on.
.PP
-The defaults of the parameters for the newly created filesystem, if not
+The defaults of the parameters for the newly created file system, if not
overridden by the options listed below, are controlled by the
.B /etc/mke2fs.conf
configuration file. See the
@@ -209,10 +209,10 @@ manual page for more details.
.BI \-b " block-size"
Specify the size of blocks in bytes. Valid block-size values are powers of two
from 1024 up to 65536 (however note that the kernel is able to mount only
-filesystems with block-size smaller or equal to the system page size - 4k on
+file systems with block-size smaller or equal to the system page size - 4k on
x86 systems, up to 64k on ppc64 or aarch64 depending on kernel configuration).
-If omitted, block-size is heuristically determined by the filesystem size and
-the expected usage of the filesystem (see the
+If omitted, block-size is heuristically determined by the file system size and
+the expected usage of the file system (see the
.B \-T
option). In most common cases, the default block size is 4k. If
.I block-size
@@ -231,7 +231,7 @@ this option is specified twice, then a slower read-write
test is used instead of a fast read-only test.
.TP
.B \-C " cluster-size"
-Specify the size of cluster in bytes for filesystems using the bigalloc
+Specify the size of cluster in bytes for file systems using the bigalloc
feature. Valid cluster-size values are from 2048 to 256M bytes per
cluster. This can only be specified if the bigalloc feature is
enabled. (See the
@@ -241,7 +241,7 @@ bigalloc is enabled is 16 times the block size.
.TP
.BI \-d " root-directory"
Copy the contents of the given directory into the root directory of the
-filesystem.
+file system.
.TP
.B \-D
Use direct I/O when writing to the disk. This avoids mke2fs dirtying a
@@ -251,9 +251,9 @@ slowly, however, so there is a tradeoff to using direct I/O.
.TP
.BI \-e " error-behavior"
Change the behavior of the kernel code when errors are detected.
-In all cases, a filesystem error will cause
+In all cases, a file system error will cause
.BR e2fsck (8)
-to check the filesystem on the next boot.
+to check the file system on the next boot.
.I error-behavior
can be one of the following:
.RS 1.2i
@@ -262,14 +262,14 @@ can be one of the following:
Continue normal execution.
.TP
.B remount-ro
-Remount filesystem read-only.
+Remount file system read-only.
.TP
.B panic
Cause a kernel panic.
.RE
.TP
.BI \-E " extended-options"
-Set extended options for the filesystem. Extended options are comma
+Set extended options for the file system. Extended options are comma
separated, and may take an argument using the equals ('=') sign. The
.B \-E
option used to be
@@ -318,32 +318,32 @@ be less than 300 seconds. Requires that the
feature be enabled.
.TP
.BI stride= stride-size
-Configure the filesystem for a RAID array with
+Configure the file system for a RAID array with
.I stride-size
-filesystem blocks. This is the number of blocks read or written to disk
+file system blocks. This is the number of blocks read or written to disk
before moving to the next disk, which is sometimes referred to as the
.I chunk size.
-This mostly affects placement of filesystem metadata like bitmaps at
+This mostly affects placement of file system metadata like bitmaps at
.B mke2fs
time to avoid placing them on a single disk, which can hurt performance.
It may also be used by the block allocator.
.TP
.BI stripe_width= stripe-width
-Configure the filesystem for a RAID array with
+Configure the file system for a RAID array with
.I stripe-width
-filesystem blocks per stripe. This is typically stride-size * N, where
+file system blocks per stripe. This is typically stride-size * N, where
N is the number of data-bearing disks in the RAID (e.g. for RAID 5 there is one
parity disk, so N will be the number of disks in the array minus 1).
This allows the block allocator to prevent read-modify-write of the
parity in a RAID stripe if possible when the data is written.
.TP
.BI offset= offset
-Create the filesystem at an offset from the beginning of the device or
+Create the file system at an offset from the beginning of the device or
file. This can be useful when creating disk images for virtual machines.
.TP
.BI resize= max-online-resize
Reserve enough space so that the block group descriptor table can grow
-to support a filesystem that has
+to support a file system that has
.I max-online-resize
blocks.
.TP
@@ -351,16 +351,16 @@ blocks.
If enabled and the uninit_bg feature is enabled, the inode table will
not be fully initialized by
.BR mke2fs .
-This speeds up filesystem
+This speeds up file system
initialization noticeably, but it requires the kernel to finish
-initializing the filesystem in the background when the filesystem is
+initializing the file system in the background when the file system is
first mounted. If the option value is omitted, it defaults to 1 to
enable lazy inode table zeroing.
.TP
.B lazy_journal_init\fR[\fB= \fI<0 to disable, 1 to enable>\fR]
If enabled, the journal inode will not be fully zeroed out by
.BR mke2fs .
-This speeds up filesystem initialization noticeably, but carries some
+This speeds up file system initialization noticeably, but carries some
small risk if the system crashes before the journal has been overwritten
entirely one time. If the option value is omitted, it defaults to 1 to
enable lazy journal inode zeroing.
@@ -397,18 +397,18 @@ In \fBmke2fs\fR 1.42 and earlier the UID and GID of the root directory were
set by default to the UID and GID of the user running the mke2fs command.
The \fBroot_owner=\fR option allows explicitly specifying these values,
and avoid side-effects for users that do not expect the contents of the
-filesystem to change based on the user running \fBmke2fs\fR.
+file system to change based on the user running \fBmke2fs\fR.
.TP
.B test_fs
-Set a flag in the filesystem superblock indicating that it may be
-mounted using experimental kernel code, such as the ext4dev filesystem.
+Set a flag in the file system superblock indicating that it may be
+mounted using experimental kernel code, such as the ext4dev file system.
.TP
.B discard
Attempt to discard blocks at mkfs time (discarding blocks initially is useful
on solid state devices and sparse / thin-provisioned storage). When the device
advertises that discard also zeroes data (any subsequent read after the discard
and before write returns zero), then mark all not-yet-zeroed inode tables as
-zeroed. This significantly speeds up filesystem initialization. This is set
+zeroed. This significantly speeds up file system initialization. This is set
as default.
.TP
.B nodiscard
@@ -428,19 +428,19 @@ feature is enabled that project quotas will be initialized as well.
.B \-F
Force
.B mke2fs
-to create a filesystem, even if the specified device is not a partition
+to create a file system, even if the specified device is not a partition
on a block special device, or if other parameters do not make sense.
In order to force
.B mke2fs
-to create a filesystem even if the filesystem appears to be in use
+to create a file system even if the file system appears to be in use
or is mounted (a truly dangerous thing to do), this option must be
specified twice.
.TP
.BI \-g " blocks-per-group"
Specify the number of blocks in a block group. There is generally no
reason for the user to ever set this parameter, as the default is optimal
-for the filesystem. (For administrators who are creating
-filesystems on RAID arrays, it is preferable to use the
+for the file system. (For administrators who are creating
+file systems on RAID arrays, it is preferable to use the
.I stride
RAID parameter as part of the
.B \-E
@@ -455,11 +455,11 @@ option will specify the number of clusters in a block group.
.BI \-G " number-of-groups"
Specify the number of block groups that will be packed together to
create a larger virtual block group (or "flex_bg group") in an
-ext4 filesystem. This improves meta-data locality and performance
+ext4 file system. This improves meta-data locality and performance
on meta-data heavy workloads. The number of groups must be a power
of 2 and may only be specified if the
.B flex_bg
-filesystem feature is enabled.
+file system feature is enabled.
.TP
.BI \-i " bytes-per-inode"
Specify the bytes/inode ratio.
@@ -469,11 +469,11 @@ creates an inode for every
bytes of space on the disk. The larger the
.I bytes-per-inode
ratio, the fewer inodes will be created. This value generally shouldn't
-be smaller than the blocksize of the filesystem, since in that case more
+be smaller than the blocksize of the file system, since in that case more
inodes would be made than can ever be used. Be warned that it is not
-possible to change this ratio on a filesystem after it is created, so be
+possible to change this ratio on a file system after it is created, so be
careful deciding the correct value for this parameter. Note that resizing
-a filesystem changes the number of inodes to maintain this ratio.
+a file system changes the number of inodes to maintain this ratio.
.TP
.BI \-I " inode-size"
Specify the size of each inode in bytes.
@@ -482,9 +482,9 @@ The
value must be a power of 2 larger or equal to 128. The larger the
.I inode-size
the more space the inode table will consume, and this reduces the usable
-space in the filesystem and can also negatively impact performance.
+space in the file system and can also negatively impact performance.
It is not
-possible to change this value after the filesystem is created.
+possible to change this value after the file system is created.
.IP
File systems with an inode size of 128 bytes do not support timestamps
beyond January 19, 2038. Inodes which are 256 bytes or larger will
@@ -500,11 +500,11 @@ most file systems, except for small file systems where the inode size
will be 128 bytes.
.TP
.B \-j
-Create the filesystem with an ext3 journal. If the
+Create the file system with an ext3 journal. If the
.B \-J
option is not specified, the default journal parameters will be used to
-create an appropriately sized journal (given the size of the filesystem)
-stored within the filesystem. Note that you must be using a kernel
+create an appropriately sized journal (given the size of the file system)
+stored within the file system. Note that you must be using a kernel
which has ext3 support in order to actually make use of the journal.
.TP
.BI \-J " journal-options"
@@ -515,12 +515,12 @@ The following journal options are supported:
.RS 1.2i
.TP
.BI size= journal-size
-Create an internal journal (i.e., stored inside the filesystem) of size
+Create an internal journal (i.e., stored inside the file system) of size
.I journal-size
megabytes.
-The size of the journal must be at least 1024 filesystem blocks
+The size of the journal must be at least 1024 file system blocks
(i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.)
-and may be no more than 10,240,000 filesystem blocks or half the total
+and may be no more than 10,240,000 file system blocks or half the total
file system size (whichever is smaller)
.TP
.BI fast_commit_size= fast-commit-size
@@ -541,7 +541,7 @@ feature set is
+ (
.I fast-commit-size
* 1024) megabytes. The total journal size may be no more than
-10,240,000 filesystem blocks or half the total file system size
+10,240,000 file system blocks or half the total file system size
(whichever is smaller).
.TP
.BI location =journal-location
@@ -552,7 +552,7 @@ suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the
beginning of the file system.
@JDEV@.TP
@JDEV@.BI device= external-journal
-@JDEV@Attach the filesystem to the journal block device located on
+@JDEV@Attach the file system to the journal block device located on
@JDEV@.IR external-journal .
@JDEV@The external
@JDEV@journal must already have been created using the command
@@ -563,9 +563,9 @@ beginning of the file system.
@JDEV@Note that
@JDEV@.I external-journal
@JDEV@must have been created with the
-@JDEV@same block size as the new filesystem.
+@JDEV@same block size as the new file system.
@JDEV@In addition, while there is support for attaching
-@JDEV@multiple filesystems to a single external journal,
+@JDEV@multiple file systems to a single external journal,
@JDEV@the Linux kernel and
@JDEV@.BR e2fsck (8)
@JDEV@do not currently support shared external journals yet.
@@ -587,7 +587,7 @@ beginning of the file system.
@JDEV@.IP
@JDEV@Only one of the
@JDEV@.BR size " or " device
-@JDEV@options can be given for a filesystem.
+@JDEV@options can be given for a file system.
.TP
.BI \-l " filename"
Read the bad blocks list from
@@ -607,41 +607,41 @@ will automatically pass the correct parameters to the
program.
.TP
.BI \-L " new-volume-label"
-Set the volume label for the filesystem to
+Set the volume label for the file system to
.IR new-volume-label .
The maximum length of the
volume label is 16 bytes.
.TP
.BI \-m " reserved-blocks-percentage"
-Specify the percentage of the filesystem blocks reserved for
+Specify the percentage of the file system blocks reserved for
the super-user. This avoids fragmentation, and allows root-owned
daemons, such as
.BR syslogd (8),
to continue to function correctly after non-privileged processes are
-prevented from writing to the filesystem. The default percentage
+prevented from writing to the file system. The default percentage
is 5%.
.TP
.BI \-M " last-mounted-directory"
-Set the last mounted directory for the filesystem. This might be useful
+Set the last mounted directory for the file system. This might be useful
for the sake of utilities that key off of the last mounted directory to
-determine where the filesystem should be mounted.
+determine where the file system should be mounted.
.TP
.B \-n
Causes
.B mke2fs
-to not actually create a filesystem, but display what it
-would do if it were to create a filesystem. This can be used to
+to not actually create a file system, but display what it
+would do if it were to create a file system. This can be used to
determine the location of the backup superblocks for a particular
-filesystem, so long as the
+file system, so long as the
.B mke2fs
parameters that were passed when the
-filesystem was originally created are used again. (With the
+file system was originally created are used again. (With the
.B \-n
option added, of course!)
.TP
.BI \-N " number-of-inodes"
Overrides the default calculation of the number of inodes that should be
-reserved for the filesystem (which is based on the number of blocks and
+reserved for the file system (which is based on the number of blocks and
the
.I bytes-per-inode
ratio). This allows the user to specify the number
@@ -649,13 +649,13 @@ of desired inodes directly.
.TP
.BI \-o " creator-os"
Overrides the default value of the "creator operating system" field of the
-filesystem. The creator field is set by default to the name of the OS the
+file system. The creator field is set by default to the name of the OS the
.B mke2fs
executable was compiled for.
.TP
.B "\-O \fR[^]\fIfeature\fR[,...]"
-Create a filesystem with the given features (filesystem options),
-overriding the default filesystem options. The features that are
+Create a file system with the given features (file system options),
+overriding the default file system options. The features that are
enabled by default are specified by the
.I base_features
relation, either in the
@@ -671,27 +671,27 @@ option, further modified by the
.I features
relation found in the
.I [fs_types]
-subsections for the filesystem and usage types. See the
+subsections for the file system and usage types. See the
.BR mke2fs.conf (5)
manual page for more details.
-The filesystem type-specific configuration setting found in the
+The file system type-specific configuration setting found in the
.I [fs_types]
section will override the global default found in
.IR [defaults] .
.sp
-The filesystem feature set will be further edited
+The file system feature set will be further edited
using either the feature set specified by this option,
or if this option is not given, by the
.I default_features
-relation for the filesystem type being created, or in the
+relation for the file system type being created, or in the
.I [defaults]
section of the configuration file.
.sp
-The filesystem feature set is comprised of a list of features, separated
+The file system feature set is comprised of a list of features, separated
by commas, that are to be enabled. To disable a feature, simply
prefix the feature name with a caret ('^') character.
Features with dependencies will not be removed successfully.
-The pseudo-filesystem feature "none" will clear all filesystem features.
+The pseudo-file system feature "none" will clear all file system features.
.TP
For more information about the features which can be set, please see
the manual page
@@ -703,9 +703,9 @@ Quiet execution. Useful if
is run in a script.
.TP
.BI \-r " revision"
-Set the filesystem revision for the new filesystem. Note that 1.2
-kernels only support revision 0 filesystems. The default is to
-create revision 1 filesystems.
+Set the file system revision for the new file system. Note that 1.2
+kernels only support revision 0 file systems. The default is to
+create revision 1 file systems.
.TP
.B \-S
Write superblock and group descriptors only. This is an extreme
@@ -722,19 +722,19 @@ variety of possible options to
.B mke2fs
that affect the on-disk layout, it is critical to specify exactly
the same format options, such as blocksize, fs-type, feature flags, and
-other tunables when using this option, or the filesystem will be further
-corrupted. In some cases, such as filesystems that have been resized,
+other tunables when using this option, or the file system will be further
+corrupted. In some cases, such as file systems that have been resized,
or have had features enabled after format time, it is impossible to
-overwrite all of the superblocks correctly, and at least some filesystem
+overwrite all of the superblocks correctly, and at least some file system
corruption will occur. It is best to run this on a full copy of the
-filesystem so other options can be tried if this doesn't work.
+file system so other options can be tried if this doesn't work.
.\" .TP
.\" .BI \-t " test"
.\" Check the device for bad blocks before creating the file system
.\" using the specified test.
.TP
.BI \-t " fs-type"
-Specify the filesystem type (i.e., ext2, ext3, ext4, etc.) that is
+Specify the file system type (i.e., ext2, ext3, ext4, etc.) that is
to be created.
If this option is not specified,
.B mke2fs
@@ -742,7 +742,7 @@ will pick a default either via how
the command was run (for example, using a name of the form mkfs.ext2,
mkfs.ext3, etc.) or via a default as defined by the
.B /etc/mke2fs.conf
-file. This option controls which filesystem options are used by
+file. This option controls which file system options are used by
default, based on the
.B fstypes
configuration stanza in
@@ -750,20 +750,20 @@ configuration stanza in
.sp
If the
.B \-O
-option is used to explicitly add or remove filesystem options that
-should be set in the newly created filesystem, the
-resulting filesystem may not be supported by the requested
+option is used to explicitly add or remove file system options that
+should be set in the newly created file system, the
+resulting file system may not be supported by the requested
.IR fs-type .
(e.g., "\fBmke2fs \-t ext3 \-O extent /dev/sdXX\fR" will create a
-filesystem that is not supported by the ext3 implementation as found in
+file system that is not supported by the ext3 implementation as found in
the Linux kernel; and "\fBmke2fs \-t ext3 \-O ^has_journal /dev/hdXX\fR"
-will create a filesystem that does not have a journal and hence will not
-be supported by the ext3 filesystem code in the Linux kernel.)
+will create a file system that does not have a journal and hence will not
+be supported by the ext3 file system code in the Linux kernel.)
.TP
.BI \-T " usage-type[,...]"
-Specify how the filesystem is going to be used, so that
+Specify how the file system is going to be used, so that
.B mke2fs
-can choose optimal filesystem parameters for that use. The usage
+can choose optimal file system parameters for that use. The usage
types that are supported are defined in the configuration file
.BR /etc/mke2fs.conf .
The user may specify one or more usage types
@@ -771,32 +771,32 @@ using a comma separated list.
.sp
If this option is is not specified,
.B mke2fs
-will pick a single default usage type based on the size of the filesystem to
-be created. If the filesystem size is less than 3 megabytes,
+will pick a single default usage type based on the size of the file system to
+be created. If the file system size is less than 3 megabytes,
.B mke2fs
-will use the filesystem type
+will use the file system type
.IR floppy .
-If the filesystem size is greater than or equal to 3 but less than
+If the file system size is greater than or equal to 3 but less than
512 megabytes,
.BR mke2fs (8)
-will use the filesystem type
+will use the file system type
.IR small .
-If the filesystem size is greater than or equal to 4 terabytes but less than
+If the file system size is greater than or equal to 4 terabytes but less than
16 terabytes,
.BR mke2fs (8)
-will use the filesystem type
+will use the file system type
.IR big .
-If the filesystem size is greater than or equal to 16 terabytes,
+If the file system size is greater than or equal to 16 terabytes,
.BR mke2fs (8)
-will use the filesystem type
+will use the file system type
.IR huge .
Otherwise,
.BR mke2fs (8)
-will use the default filesystem type
+will use the default file system type
.IR default .
.TP
.BI \-U " UUID"
-Set the universally unique identifier (UUID) of the filesystem to
+Set the universally unique identifier (UUID) of the file system to
.IR UUID .
The format of the UUID is a series of hex digits separated by hyphens,
like this:
@@ -807,7 +807,7 @@ parameter may also be one of the following:
.RS 1.2i
.TP
.I clear
-clear the filesystem UUID
+clear the file system UUID
.TP
.I random
generate a new randomly-generated UUID
@@ -860,7 +860,7 @@ sector size of the
.IR device .
.TP
.B MKE2FS_SKIP_CHECK_MSG
-If set, do not show the message of filesystem automatic check caused by
+If set, do not show the message of file system automatic check caused by
mount count or check interval.
.SH AUTHOR
This version of
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index bd60d49e..ba5f179a 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -585,8 +585,10 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect)
else {
magic = (unsigned int *) (buf + BSD_LABEL_OFFSET);
if ((*magic == BSD_DISKMAGIC) ||
- (*magic == BSD_MAGICDISK))
+ (*magic == BSD_MAGICDISK)) {
+ free(buf);
return;
+ }
}
}
@@ -1480,7 +1482,7 @@ extern const char *mke2fs_default_profile;
static const char *default_files[] = { "<default>", 0 };
struct device_param {
- unsigned long min_io; /* prefered minimum IO size */
+ unsigned long min_io; /* preferred minimum IO size */
unsigned long opt_io; /* optimal IO size */
unsigned long alignment_offset; /* alignment offset wrt physical block size */
unsigned int dax:1; /* supports dax? */
@@ -1570,7 +1572,6 @@ static void PRS(int argc, char *argv[])
* Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs.
*/
blk64_t fs_blocks_count = 0;
- long sysval;
int s_opt = -1, r_opt = -1;
char *fs_features = 0;
int fs_features_size = 0;
@@ -1604,9 +1605,12 @@ static void PRS(int argc, char *argv[])
#define _SC_PAGESIZE _SC_PAGE_SIZE
#endif
#ifdef _SC_PAGESIZE
- sysval = sysconf(_SC_PAGESIZE);
- if (sysval > 0)
- sys_page_size = sysval;
+ {
+ long sysval = sysconf(_SC_PAGESIZE);
+
+ if (sysval > 0)
+ sys_page_size = sysval;
+ }
#endif /* _SC_PAGESIZE */
#endif /* HAVE_SYSCONF */
@@ -1922,10 +1926,10 @@ profile_error:
#ifdef CONFIG_TESTIO_DEBUG
if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
io_ptr = test_io_manager;
- test_io_backing_manager = unix_io_manager;
+ test_io_backing_manager = default_io_manager;
} else
#endif
- io_ptr = unix_io_manager;
+ io_ptr = default_io_manager;
retval = ext2fs_open(journal_device,
EXT2_FLAG_JOURNAL_DEV_OK, 0,
0, io_ptr, &jfs);
@@ -1971,18 +1975,8 @@ profile_error:
profile_get_integer(profile, "options", "proceed_delay", 0, 0,
&proceed_delay);
- /* The isatty() test is so we don't break existing scripts */
- flags = CREATE_FILE;
- if (isatty(0) && isatty(1) && !offset)
- flags |= CHECK_FS_EXIST;
- if (!quiet)
- flags |= VERBOSE_CREATE;
- if (fs_blocks_count == 0)
- flags |= NO_SIZE;
- else
+ if (fs_blocks_count)
explicit_fssize = 1;
- if (!check_plausibility(device_name, flags, &is_device) && !force)
- proceed_question(proceed_delay);
check_mount(device_name, force, _("filesystem"));
@@ -1994,6 +1988,26 @@ profile_error:
retval = ext2fs_get_device_size2(device_name,
EXT2_BLOCK_SIZE(&fs_param),
&dev_size);
+ if (retval == ENOENT) {
+ int fd;
+
+ if (!explicit_fssize) {
+ fprintf(stderr,
+ _("The file %s does not exist and no "
+ "size was specified.\n"), device_name);
+ exit(1);
+ }
+ fd = ext2fs_open_file(device_name,
+ O_CREAT | O_WRONLY, 0666);
+ if (fd < 0) {
+ retval = errno;
+ } else {
+ dev_size = 0;
+ retval = 0;
+ close(fd);
+ printf(_("Creating regular file %s\n"), device_name);
+ }
+ }
if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
com_err(program_name, retval, "%s",
_("while trying to determine filesystem size"));
@@ -2036,6 +2050,9 @@ profile_error:
if (!usage_types)
profile_get_string(profile, "devices", device_name,
"usage_types", 0, &usage_types);
+ if (!creator_os)
+ profile_get_string(profile, "defaults", "creator_os", 0,
+ 0, &creator_os);
/*
* We have the file system (or device) size, so we can now
@@ -2329,9 +2346,9 @@ profile_error:
device_name);
} else {
/* setting stripe/stride to blocksize is pointless */
- if (dev_param.min_io > blocksize)
+ if (dev_param.min_io > (unsigned) blocksize)
fs_param.s_raid_stride = dev_param.min_io / blocksize;
- if (dev_param.opt_io > blocksize) {
+ if (dev_param.opt_io > (unsigned) blocksize) {
fs_param.s_raid_stripe_width =
dev_param.opt_io / blocksize;
}
@@ -2514,11 +2531,12 @@ profile_error:
exit(1);
}
- if (!quiet && ext2fs_has_feature_bigalloc(&fs_param))
- fprintf(stderr, "%s", _("\nWarning: the bigalloc feature is "
- "still under development\n"
- "See https://ext4.wiki.kernel.org/"
- "index.php/Bigalloc for more information\n\n"));
+ if (!quiet && ext2fs_has_feature_bigalloc(&fs_param) &&
+ EXT2_CLUSTER_SIZE(&fs_param) > 16 * EXT2_BLOCK_SIZE(&fs_param))
+ fprintf(stderr, "%s", _("\nWarning: bigalloc file systems "
+ "with a cluster size greater than\n"
+ "16 times the block size is considered "
+ "experimental\n"));
/*
* Since sparse_super is the default, we would only have a problem
@@ -2591,6 +2609,17 @@ profile_error:
exit(1);
}
+ /*
+ * Warn the user that filesystems with 128-byte inodes will
+ * not work properly beyond 2038. This can be suppressed via
+ * a boolean in the mke2fs.conf file, and we will disable this
+ * warning for file systems created for the GNU Hurd.
+ */
+ if (inode_size == EXT2_GOOD_OLD_INODE_SIZE &&
+ get_bool_from_profile(fs_types, "warn_y2038_dates", 1))
+ printf(
+_("128-byte inodes cannot handle dates beyond 2038 and are deprecated\n"));
+
/* Make sure number of inodes specified will fit in 32 bits */
if (num_inodes == 0) {
unsigned long long n;
@@ -2648,6 +2677,17 @@ profile_error:
free(fs_type);
free(usage_types);
+
+ /* The isatty() test is so we don't break existing scripts */
+ flags = CREATE_FILE;
+ if (isatty(0) && isatty(1) && !offset)
+ flags |= CHECK_FS_EXIST;
+ if (!quiet)
+ flags |= VERBOSE_CREATE;
+ if (!explicit_fssize)
+ flags |= NO_SIZE;
+ if (!check_plausibility(device_name, flags, &is_device) && !force)
+ proceed_question(proceed_delay);
}
static int should_do_undo(const char *name)
@@ -2656,7 +2696,7 @@ static int should_do_undo(const char *name)
io_channel channel;
__u16 s_magic;
struct ext2_super_block super;
- io_manager manager = unix_io_manager;
+ io_manager manager = default_io_manager;
int csum_flag, force_undo;
csum_flag = ext2fs_has_feature_metadata_csum(&fs_param) ||
@@ -2792,7 +2832,7 @@ static int mke2fs_discard_device(ext2_filsys fs)
struct ext2fs_numeric_progress_struct progress;
blk64_t blocks = ext2fs_blocks_count(fs->super);
blk64_t count = DISCARD_STEP_MB;
- blk64_t cur;
+ blk64_t cur = 0;
int retval = 0;
/*
@@ -2800,10 +2840,9 @@ static int mke2fs_discard_device(ext2_filsys fs)
* we do not print numeric progress resulting in failure
* afterwards.
*/
- retval = io_channel_discard(fs->io, 0, fs->blocksize);
+ retval = io_channel_discard(fs->io, 0, 1);
if (retval)
return retval;
- cur = fs->blocksize;
count *= (1024 * 1024);
count /= fs->blocksize;
@@ -2931,12 +2970,6 @@ try_user:
return 0;
}
-// TODO(b/141583541): stop leaks
-const char *__asan_default_options()
-{
- return "detect_leaks=0";
-}
-
int main (int argc, char *argv[])
{
errcode_t retval = 0;
@@ -2968,10 +3001,10 @@ int main (int argc, char *argv[])
#ifdef CONFIG_TESTIO_DEBUG
if (getenv("TEST_IO_FLAGS") || getenv("TEST_IO_BLOCK")) {
io_ptr = test_io_manager;
- test_io_backing_manager = unix_io_manager;
+ test_io_backing_manager = default_io_manager;
} else
#endif
- io_ptr = unix_io_manager;
+ io_ptr = default_io_manager;
if (undo_file != NULL || should_do_undo(device_name)) {
retval = mke2fs_setup_tdb(device_name, &io_ptr);
@@ -3364,7 +3397,7 @@ int main (int argc, char *argv[])
retval = ext2fs_open(journal_device, EXT2_FLAG_RW|
EXT2_FLAG_JOURNAL_DEV_OK, 0,
- fs->blocksize, unix_io_manager, &jfs);
+ fs->blocksize, default_io_manager, &jfs);
if (retval) {
com_err(program_name, retval,
_("while trying to open journal device %s\n"),
diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in
index 08bb9488..96dbfcbf 100644
--- a/misc/mke2fs.conf.5.in
+++ b/misc/mke2fs.conf.5.in
@@ -11,7 +11,7 @@ is the configuration file for
.BR mke2fs (8).
It controls the default parameters used by
.BR mke2fs (8)
-when it is creating ext2, ext3, or ext4 filesystems.
+when it is creating ext2, ext3, or ext4 file systems.
.PP
The
.I mke2fs.conf
@@ -118,8 +118,15 @@ The following relations are defined in the
.I [defaults]
stanza.
.TP
+.I creator_os
+This relation specifies the "creator operating system" for the
+file system unless it is overridden on the command line.
+The default value is the OS for which the
+.B mke2fs
+executable was compiled.
+.TP
.I fs_type
-This relation specifies the default filesystem type if the user does not
+This relation specifies the default file system type if the user does not
specify it via the
.B \-t
option, or if
@@ -128,8 +135,8 @@ is not started using a program name of the form
.BI mkfs. fs-type\fR.
If both the user and the
.B mke2fs.conf
-file do not specify a default filesystem type, mke2fs will use a
-default filesystem type of
+file do not specify a default file system type, mke2fs will use a
+default file system type of
.I ext3
if a journal was requested via a command-line option, or
.I ext2
@@ -154,12 +161,12 @@ subsection as defined below (e.g.,
etc.) can also be specified in the
.I defaults
stanza to specify the default value to be used if the user does not
-specify one on the command line, and the filesystem-type
+specify one on the command line, and the file system-type
specific section of the configuration file does not specify a default value.
.SH THE [fs_types] STANZA
Each tag in the
.I [fs_types]
-stanza names a filesystem type or usage type which can be specified via the
+stanza names a file system type or usage type which can be specified via the
.B \-t
or
.B \-T
@@ -169,14 +176,14 @@ respectively.
.P
The
.B mke2fs
-program constructs a list of fs_types by concatenating the filesystem
+program constructs a list of fs_types by concatenating the file system
type (i.e., ext2, ext3, etc.) with the usage type list. For most
configuration options,
.B mke2fs
will look for a subsection in the
.I [fs_types]
stanza corresponding with each entry in the constructed list, with later
-entries overriding earlier filesystem or usage types.
+entries overriding earlier file system or usage types.
For
example, consider the following
.B mke2fs.conf
@@ -230,7 +237,7 @@ fragment:
.P
If mke2fs started with a program name of
.BR mke2fs.ext4 ,
-then the filesystem type of ext4 will be used. If the filesystem is
+then the file system type of ext4 will be used. If the file system is
smaller than 3 megabytes, and no usage type is specified, then
.B mke2fs
will use a default
@@ -241,30 +248,30 @@ subsection and the floppy subsection define an
.I inode_size
relation, but since the later entries in the fs_types list supersede
earlier ones, the configuration parameter for fs_types.floppy.inode_size
-will be used, so the filesystem will have an inode size of 128.
+will be used, so the file system will have an inode size of 128.
.P
The exception to this resolution is the
.I features
tag, which specifies a set of changes to the features used by the
-filesystem, and which is cumulative. So in the above example, first
+file system, and which is cumulative. So in the above example, first
the configuration relation defaults.base_features would enable an
initial feature set with the sparse_super, filetype, resize_inode, and
dir_index features enabled. Then configuration relation
fs_types.ext4.features would enable the extents and flex_bg
features, and finally the configuration relation
fs_types.floppy.features would remove
-the resize_inode feature, resulting in a filesystem feature set
+the resize_inode feature, resulting in a file system feature set
consisting of the sparse_super, filetype, dir_index,
extents_and flex_bg features.
.P
-For each filesystem type, the following tags may be used in that
+For each file system type, the following tags may be used in that
fs_type's subsection. These tags may also be used in the
.I default
section:
.TP
.I base_features
This relation specifies the features which are initially enabled for this
-filesystem type. Only one
+file system type. Only one
.I base_features
will be used, so if there are multiple entries in the fs_types list
whose subsections define the
@@ -273,7 +280,7 @@ relation, only the last will be used by
.BR mke2fs (8).
.TP
.I enable_periodic_fsck
-This boolean relation specifies whether periodic filesystem checks should be
+This boolean relation specifies whether periodic file system checks should be
enforced at boot time. If set to true, checks will be forced every
180 days, or after a random number of mounts. These values may
be changed later via the
@@ -285,9 +292,9 @@ command-line options to
.TP
.I errors
Change the behavior of the kernel code when errors are detected.
-In all cases, a filesystem error will cause
+In all cases, a file system error will cause
.BR e2fsck (8)
-to check the filesystem on the next boot.
+to check the file system on the next boot.
.I errors
can be one of the following:
.RS 1.2i
@@ -296,7 +303,7 @@ can be one of the following:
Continue normal execution.
.TP
.B remount-ro
-Remount filesystem read-only.
+Remount file system read-only.
.TP
.B panic
Cause a kernel panic.
@@ -305,7 +312,7 @@ Cause a kernel panic.
.I features
This relation specifies a comma-separated list of features edit
requests which modify the feature set
-used by the newly constructed filesystem. The syntax is the same as the
+used by the newly constructed file system. The syntax is the same as the
.B -O
command-line option to
.BR mke2fs (8);
@@ -319,7 +326,7 @@ found in the fs_types list.
This boolean relation, if set to a value of true, forces
.B mke2fs
to always try to create an undo file, even if the undo file might be
-huge and it might extend the time to create the filesystem image
+huge and it might extend the time to create the file system image
because the inode table isn't being initialized lazily.
.TP
.I default_features
@@ -359,9 +366,9 @@ enabled. If lazy_itable_init is true and the uninit_bg feature is
enabled, the inode table will
not be fully initialized by
.BR mke2fs (8).
-This speeds up filesystem
+This speeds up file system
initialization noticeably, but it requires the kernel to finish
-initializing the filesystem in the background when the filesystem is
+initializing the file system in the background when the file system is
first mounted.
.TP
.I lazy_journal_init
@@ -370,7 +377,7 @@ lazily initialized. It only has meaning if the has_journal feature is
enabled. If lazy_journal_init is true, the journal inode will not be
fully zeroed out by
.BR mke2fs .
-This speeds up filesystem initialization noticeably, but carries some
+This speeds up file system initialization noticeably, but carries some
small risk if the system crashes before the journal has been overwritten
entirely one time.
.TP
@@ -395,13 +402,13 @@ This relation specifies the default inode size if the user does not
specify one on the command line.
.TP
.I reserved_ratio
-This relation specifies the default percentage of filesystem blocks
+This relation specifies the default percentage of file system blocks
reserved for the super-user, if the user does not specify one on the command
line.
.TP
.I hash_alg
This relation specifies the default hash algorithm used for the
-new filesystems with hashed b-tree directories. Valid algorithms
+new file systems with hashed b-tree directories. Valid algorithms
accepted are:
.IR legacy ,
.IR half_md4 ,
@@ -410,10 +417,10 @@ and
.TP
.I flex_bg_size
This relation specifies the number of block groups that will be packed
-together to create one large virtual block group on an ext4 filesystem.
+together to create one large virtual block group on an ext4 file system.
This improves meta-data locality and performance on meta-data heavy
workloads. The number of groups must be a power of 2 and may only be
-specified if the flex_bg filesystem feature is enabled.
+specified if the flex_bg file system feature is enabled.
.TP
.I options
This relation specifies additional extended options which should be
@@ -424,12 +431,12 @@ as if they were prepended to the argument of the
option. This can be used to configure the default extended options used
by
.BR mke2fs (8)
-on a per-filesystem type basis.
+on a per-file system type basis.
.TP
.I discard
This boolean relation specifies whether the
.BR mke2fs (8)
-should attempt to discard device prior to filesystem creation.
+should attempt to discard device prior to file system creation.
.TP
.I cluster_size
This relation specifies the default cluster size if the bigalloc file
@@ -449,7 +456,7 @@ blocks of the pre-allocated files will be contiguous.
.TP
.I hugefiles_dir
This relation specifies the directory where huge files are created,
-relative to the filesystem root.
+relative to the file system root.
.TP
.I hugefiles_uid
This relation controls the user ownership for all of the files and
@@ -505,6 +512,13 @@ This relation specifies the base file name for the huge files.
This relation specifies the (zero-padded) width of the field for the
huge file number.
.TP
+.I warn_y2038_dates
+This boolean relation specifies whether mke2fs will issue a warning
+when creating a file system with 128 byte inodes (and so therefore will
+not support dates after January 19th, 2038). The default value is true,
+except for file systems created for the GNU Hurd since it only supports
+128-byte inodes.
+.TP
.I zero_hugefiles
This boolean relation specifies whether or not zero blocks will be
written to the hugefiles while
diff --git a/misc/mke2fs.conf.in b/misc/mke2fs.conf.in
index 01e35cf8..05680992 100644
--- a/misc/mke2fs.conf.in
+++ b/misc/mke2fs.conf.in
@@ -12,16 +12,13 @@
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize
- inode_size = 256
}
small = {
blocksize = 1024
- inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
- inode_size = 128
inode_ratio = 8192
}
big = {
@@ -44,4 +41,5 @@
hurd = {
blocksize = 4096
inode_size = 128
+ warn_y2038_dates = 0
}
diff --git a/misc/mklost+found.8.in b/misc/mklost+found.8.in
index ba0c1c18..d3382394 100644
--- a/misc/mklost+found.8.in
+++ b/misc/mklost+found.8.in
@@ -15,17 +15,17 @@ is used to create a
directory in the current working directory on a Linux second extended
file system. There is normally a
.I lost+found
-directory in the root directory of each filesystem.
+directory in the root directory of each file system.
.PP
.B mklost+found
pre-allocates disk blocks to the
.I lost+found
directory so that when
.BR e2fsck (8)
-is being run to recover a filesystem, it does not need to allocate blocks in
-the filesystem to store a large number of unlinked files. This ensures that
+is being run to recover a file system, it does not need to allocate blocks in
+the file system to store a large number of unlinked files. This ensures that
.B e2fsck
-will not have to allocate data blocks in the filesystem during recovery.
+will not have to allocate data blocks in the file system during recovery.
.SH OPTIONS
There are none.
.SH AUTHOR
diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index b963f30e..979f6c5f 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -4,7 +4,7 @@
.\"
.TH TUNE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
-tune2fs \- adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
+tune2fs \- adjust tunable file system parameters on ext2/ext3/ext4 file systems
.SH SYNOPSIS
.B tune2fs
[
@@ -95,8 +95,8 @@ tune2fs \- adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
device
.SH DESCRIPTION
.B tune2fs
-allows the system administrator to adjust various tunable filesystem
-parameters on Linux ext2, ext3, or ext4 filesystems. The current values
+allows the system administrator to adjust various tunable file system
+parameters on Linux ext2, ext3, or ext4 file systems. The current values
of these options can be displayed by using the
.B -l
option to
@@ -113,21 +113,21 @@ LABEL=home or UUID=e40486c6-84d5-4f2f-b99c-032281799c9d).
.SH OPTIONS
.TP
.BI \-c " max-mount-counts"
-Adjust the number of mounts after which the filesystem will be checked by
+Adjust the number of mounts after which the file system will be checked by
.BR e2fsck (8).
If
.I max-mount-counts
is the string "random", tune2fs will use a random value between 20 and 40.
If
.I max-mount-counts
-is 0 or \-1, the number of times the filesystem is mounted will be disregarded
+is 0 or \-1, the number of times the file system is mounted will be disregarded
by
.BR e2fsck (8)
and the kernel.
.sp
-Staggering the mount-counts at which filesystems are forcibly
-checked will avoid all filesystems being checked at one time
-when using journaled filesystems.
+Staggering the mount-counts at which file systems are forcibly
+checked will avoid all file systems being checked at one time
+when using journaled file systems.
.sp
Mount-count-dependent checking is disabled by default to avoid
unanticipated long reboots while e2fsck does its work. If you
@@ -139,19 +139,19 @@ program. This does require placing the file system on an LVM volume,
however.
.TP
.BI \-C " mount-count"
-Set the number of times the filesystem has been mounted.
+Set the number of times the file system has been mounted.
If set to a greater value than the max-mount-counts parameter
set by the
.B \-c
option,
.BR e2fsck (8)
-will check the filesystem at the next reboot.
+will check the file system at the next reboot.
.TP
.BI \-e " error-behavior"
Change the behavior of the kernel code when errors are detected.
-In all cases, a filesystem error will cause
+In all cases, a file system error will cause
.BR e2fsck (8)
-to check the filesystem on the next boot.
+to check the file system on the next boot.
.I error-behavior
can be one of the following:
.RS 1.2i
@@ -160,14 +160,14 @@ can be one of the following:
Continue normal execution.
.TP
.B remount-ro
-Remount filesystem read-only.
+Remount file system read-only.
.TP
.B panic
Cause a kernel panic.
.RE
.TP
.BI \-E " extended-options"
-Set extended options for the filesystem. Extended options are comma
+Set extended options for the file system. Extended options are comma
separated, and may take an argument using the equals ('=') sign.
The following extended options are supported:
.RS 1.2i
@@ -175,7 +175,7 @@ The following extended options are supported:
.B clear_mmp
Reset the MMP block (if any) back to the clean state. Use only if
absolutely certain the device is not currently mounted or being
-fscked, or major filesystem corruption can result. Needs '-f'.
+fscked, or major file system corruption can result. Needs '-f'.
.TP
.BI mmp_update_interval= interval
Adjust the initial MMP update interval to
@@ -188,25 +188,25 @@ be less than 300 seconds. Requires that the
feature be enabled.
.TP
.BI stride= stride-size
-Configure the filesystem for a RAID array with
+Configure the file system for a RAID array with
.I stride-size
-filesystem blocks. This is the number of blocks read or written to disk
-before moving to next disk. This mostly affects placement of filesystem
+file system blocks. This is the number of blocks read or written to disk
+before moving to next disk. This mostly affects placement of file system
metadata like bitmaps at
.BR mke2fs (2)
time to avoid placing them on a single disk, which can hurt the performance.
It may also be used by block allocator.
.TP
.BI stripe_width= stripe-width
-Configure the filesystem for a RAID array with
+Configure the file system for a RAID array with
.I stripe-width
-filesystem blocks per stripe. This is typically be stride-size * N, where
+file system blocks per stripe. This is typically be stride-size * N, where
N is the number of data disks in the RAID (e.g. RAID 5 N+1, RAID 6 N+2).
This allows the block allocator to prevent read-modify-write of the
parity in a RAID stripe if possible when the data is written.
.TP
.BI hash_alg= hash-alg
-Set the default hash algorithm used for filesystems with hashed b-tree
+Set the default hash algorithm used for file systems with hashed b-tree
directories. Valid algorithms accepted are:
.IR legacy ,
.IR half_md4 ,
@@ -258,44 +258,44 @@ This superblock setting is only honored in 2.6.35+ kernels;
and not at all by the ext2 and ext3 file system drivers.
.TP
.B force_fsck
-Set a flag in the filesystem superblock indicating that errors have been found.
+Set a flag in the file system superblock indicating that errors have been found.
This will force fsck to run at the next mount.
.TP
.B test_fs
-Set a flag in the filesystem superblock indicating that it may be
-mounted using experimental kernel code, such as the ext4dev filesystem.
+Set a flag in the file system superblock indicating that it may be
+mounted using experimental kernel code, such as the ext4dev file system.
.TP
.B ^test_fs
-Clear the test_fs flag, indicating the filesystem should only be mounted
-using production-level filesystem code.
+Clear the test_fs flag, indicating the file system should only be mounted
+using production-level file system code.
.RE
.TP
.B \-f
Force the tune2fs operation to complete even in the face of errors. This
option is useful when removing the
.B has_journal
-filesystem feature from a filesystem which has
+file system feature from a file system which has
an external journal (or is corrupted
such that it appears to have an external journal), but that
-external journal is not available. If the filesystem appears to require
+external journal is not available. If the file system appears to require
journal replay, the
.B \-f
flag must be specified twice to proceed.
.sp
.B WARNING:
-Removing an external journal from a filesystem which was not cleanly unmounted
+Removing an external journal from a file system which was not cleanly unmounted
without first replaying the external journal can result in
-severe data loss and filesystem corruption.
+severe data loss and file system corruption.
.TP
.BI \-g " group"
-Set the group which can use the reserved filesystem blocks.
+Set the group which can use the reserved file system blocks.
The
.I group
parameter can be a numerical gid or a group name. If a group name is given,
it is converted to a numerical gid before it is stored in the superblock.
.TP
.B \-i " \fIinterval-between-checks\fR[\fBd\fR|\fBm\fR|\fBw\fR]"
-Adjust the maximal time between two filesystem checks.
+Adjust the maximal time between two file system checks.
No suffix or
.B d
will interpret the number
@@ -327,39 +327,39 @@ support extended timestamps, project id's, and the ability to store some
extended attributes in the inode table for improved performance.
.TP
.B \-j
-Add an ext3 journal to the filesystem. If the
+Add an ext3 journal to the file system. If the
.B \-J
option is not specified, the default journal parameters will be used to create
-an appropriately sized journal (given the size of the filesystem)
-stored within the filesystem. Note that you must be using a kernel
+an appropriately sized journal (given the size of the file system)
+stored within the file system. Note that you must be using a kernel
which has ext3 support in order to actually make use of the journal.
.IP
-If this option is used to create a journal on a mounted filesystem, an
+If this option is used to create a journal on a mounted file system, an
immutable file,
.BR .journal ,
-will be created in the top-level directory of the filesystem, as it is
-the only safe way to create the journal inode while the filesystem is
+will be created in the top-level directory of the file system, as it is
+the only safe way to create the journal inode while the file system is
mounted. While the ext3 journal is visible, it is not safe to
-delete it, or modify it while the filesystem is mounted; for this
+delete it, or modify it while the file system is mounted; for this
reason the file is marked immutable.
-While checking unmounted filesystems,
+While checking unmounted file systems,
.BR e2fsck (8)
will automatically move
.B .journal
-files to the invisible, reserved journal inode. For all filesystems
-except for the root filesystem, this should happen automatically and
-naturally during the next reboot cycle. Since the root filesystem is
+files to the invisible, reserved journal inode. For all file systems
+except for the root file system, this should happen automatically and
+naturally during the next reboot cycle. Since the root file system is
mounted read-only,
.BR e2fsck (8)
must be run from a rescue floppy in order to effect this transition.
.IP
On some distributions, such as Debian, if an initial ramdisk is used,
-the initrd scripts will automatically convert an ext2 root filesystem
+the initrd scripts will automatically convert an ext2 root file system
to ext3 if the
.B /etc/fstab
-file specifies the ext3 filesystem for the root filesystem in order to
+file specifies the ext3 file system for the root file system in order to
avoid requiring the use of a rescue floppy to add an ext3 journal to
-the root filesystem.
+the root file system.
.TP
.BR \-J " journal-options"
Override the default ext3 journal parameters. Journal options are comma
@@ -368,12 +368,12 @@ The following journal options are supported:
.RS 1.2i
.TP
.BI size= journal-size
-Create a journal stored in the filesystem of size
+Create a journal stored in the file system of size
.I journal-size
-megabytes. The size of the journal must be at least 1024 filesystem blocks
+megabytes. The size of the journal must be at least 1024 file system blocks
(i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.)
-and may be no more than 10,240,000 filesystem blocks.
-There must be enough free space in the filesystem to create a journal of
+and may be no more than 10,240,000 file system blocks.
+There must be enough free space in the file system to create a journal of
that size.
.TP
.BI fast_commit_size= fast-commit-size
@@ -394,7 +394,7 @@ feature set is
+ (
.I fast-commit-size
* 1024) megabytes. The total journal size may be no more than
-10,240,000 filesystem blocks or half the total file system size
+10,240,000 file system blocks or half the total file system size
(whichever is smaller).
.TP
.BI location =journal-location
@@ -405,7 +405,7 @@ suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the
beginning of the file system.
@JDEV@.TP
@JDEV@.BI device= external-journal
-@JDEV@Attach the filesystem to the journal block device located on
+@JDEV@Attach the file system to the journal block device located on
@JDEV@.IR external-journal .
@JDEV@The external
@JDEV@journal must have been already created using the command
@@ -416,9 +416,9 @@ beginning of the file system.
@JDEV@Note that
@JDEV@.I external-journal
@JDEV@must be formatted with the same block
-@JDEV@size as filesystems which will be using it.
+@JDEV@size as file systems which will be using it.
@JDEV@In addition, while there is support for attaching
-@JDEV@multiple filesystems to a single external journal,
+@JDEV@multiple file systems to a single external journal,
@JDEV@the Linux kernel and
@JDEV@.BR e2fsck (8)
@JDEV@do not currently support shared external journals yet.
@@ -440,15 +440,15 @@ beginning of the file system.
@JDEV@.IP
@JDEV@Only one of the
@JDEV@.BR size " or " device
-@JDEV@options can be given for a filesystem.
+@JDEV@options can be given for a file system.
.TP
.B \-l
-List the contents of the filesystem superblock, including the current
+List the contents of the file system superblock, including the current
values of the parameters that can be set via this program.
.TP
.BI \-L " volume-label"
-Set the volume label of the filesystem.
-Ext2 filesystem labels can be at most 16 characters long; if
+Set the volume label of the file system.
+Ext2 file system labels can be at most 16 characters long; if
.I volume-label
is longer than 16 characters,
.B tune2fs
@@ -464,21 +464,21 @@ instead of a block special device name like
.BR /dev/hda5 .
.TP
.BI \-m " reserved-blocks-percentage"
-Set the percentage of the filesystem which may only be allocated
-by privileged processes. Reserving some number of filesystem blocks
+Set the percentage of the file system which may only be allocated
+by privileged processes. Reserving some number of file system blocks
for use by privileged processes is done
-to avoid filesystem fragmentation, and to allow system
+to avoid file system fragmentation, and to allow system
daemons, such as
.BR syslogd (8),
to continue to function correctly after non-privileged processes are
-prevented from writing to the filesystem. Normally, the default percentage
+prevented from writing to the file system. Normally, the default percentage
of reserved blocks is 5%.
.TP
.BI \-M " last-mounted-directory"
-Set the last-mounted directory for the filesystem.
+Set the last-mounted directory for the file system.
.TP
.BR \-o " [^]\fImount-option\fR[,...]"
-Set or clear the indicated default mount options in the filesystem.
+Set or clear the indicated default mount options in the file system.
Default mount options can be overridden by mount options specified
either in
.BR /etc/fstab (5)
@@ -490,16 +490,16 @@ default mount options field in the superblock.
.IP
More than one mount option can be cleared or set by separating
features with commas. Mount options prefixed with a
-caret character ('^') will be cleared in the filesystem's superblock;
+caret character ('^') will be cleared in the file system's superblock;
mount options without a prefix character or prefixed with a plus
-character ('+') will be added to the filesystem.
+character ('+') will be added to the file system.
.IP
The following mount options can be set or cleared using
.BR tune2fs :
.RS 1.2i
.TP
.B debug
-Enable debugging code for this filesystem.
+Enable debugging code for this file system.
.TP
.B bsdgroups
Emulate BSD behavior when creating new files: they will take the group-id
@@ -520,18 +520,18 @@ Disables 32-bit UIDs and GIDs. This is for interoperability with
older kernels which only store and expect 16-bit values.
.TP
.B journal_data
-When the filesystem is mounted with journalling enabled, all data
+When the file system is mounted with journaling enabled, all data
(not just metadata) is committed into the journal prior to being written
-into the main filesystem.
+into the main file system.
.TP
.B journal_data_ordered
-When the filesystem is mounted with journalling enabled, all data is forced
+When the file system is mounted with journaling enabled, all data is forced
directly out to the main file system prior to its metadata being committed
to the journal.
.TP
.B journal_data_writeback
-When the filesystem is mounted with journalling enabled, data may be
-written into the main filesystem after its metadata has been committed
+When the file system is mounted with journaling enabled, data may be
+written into the main file system after its metadata has been committed
to the journal. This may increase throughput, however, it may allow old
data to appear in files after a crash and journal recovery.
.TP
@@ -566,16 +566,16 @@ only supported by the ext4 file system driver in 2.6.35+ kernels.)
.RE
.TP
.BR \-O " [^]\fIfeature\fR[,...]"
-Set or clear the indicated filesystem features (options) in the filesystem.
-More than one filesystem feature can be cleared or set by separating
-features with commas. Filesystem features prefixed with a
-caret character ('^') will be cleared in the filesystem's superblock;
-filesystem features without a prefix character or prefixed with a plus
-character ('+') will be added to the filesystem. For a detailed
+Set or clear the indicated file system features (options) in the file system.
+More than one file system feature can be cleared or set by separating
+features with commas. File System features prefixed with a
+caret character ('^') will be cleared in the file system's superblock;
+file system features without a prefix character or prefixed with a plus
+character ('+') will be added to the file system. For a detailed
description of the file system features, please see the man page
.BR ext4 (5).
.IP
-The following filesystem features can be set or cleared using
+The following file system features can be set or cleared using
.BR tune2fs :
.RS 1.2i
.TP
@@ -585,7 +585,7 @@ Enable the file system to be larger than 2^32 blocks.
.B casefold
Enable support for file system level casefolding.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B dir_index
Use hashed b-trees to speed up lookups for large directories.
@@ -598,17 +598,17 @@ Allow the value of each extended attribute to be placed in the data blocks of a
separate inode if necessary, increasing the limit on the size and number of
extended attributes per file.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B encrypt
Enable support for file system level encryption.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B extent
Enable the use of extent trees to store the location of data blocks in inodes.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B extra_isize
Enable the extended inode fields used by ext4.
@@ -626,8 +626,8 @@ will do when it creates a freshly formatted file system with
enabled.
.TP
.B has_journal
-Use a journal to ensure filesystem consistency even across unclean shutdowns.
-Setting the filesystem feature is equivalent to using the
+Use a journal to ensure file system consistency even across unclean shutdowns.
+Setting the file system feature is equivalent to using the
.B \-j
option.
.TP
@@ -638,20 +638,20 @@ Enable fast commit journaling feature to improve fsync latency.
.B large_dir
Increase the limit on the number of files per directory.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B huge_file
Support files larger than 2 terabytes in size.
.TP
.B large_file
-Filesystem can contain files that are greater than 2GB.
+File System can contain files that are greater than 2GB.
.TP
.B metadata_csum
Store a checksum to protect the contents in each metadata block.
.TP
.B metadata_csum_seed
-Allow the filesystem to store the metadata checksum seed in the
-superblock, enabling the administrator to change the UUID of a filesystem
+Allow the file system to store the metadata checksum seed in the
+superblock, enabling the administrator to change the UUID of a file system
using the
.B metadata_csum
feature while it is mounted.
@@ -672,23 +672,23 @@ Force the kernel to mount the file system read-only.
Reserve space so the block group descriptor table may grow in the
future.
.B Tune2fs
-only supports clearing this filesystem feature.
+only supports clearing this file system feature.
.TP
.B sparse_super
-Limit the number of backup superblocks to save space on large filesystems.
+Limit the number of backup superblocks to save space on large file systems.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B stable_inodes
-Prevent the filesystem from being shrunk or having its UUID changed, in order to
+Prevent the file system from being shrunk or having its UUID changed, in order to
allow the use of specialized encryption settings that make use of the inode
numbers and UUID.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.TP
.B uninit_bg
Allow the kernel to initialize bitmaps and inode tables lazily, and to
-keep a high watermark for the unused inodes in a filesystem, to reduce
+keep a high watermark for the unused inodes in a file system, to reduce
.BR e2fsck (8)
time. The first e2fsck run after enabling this feature will take the
full time, but subsequent e2fsck runs will take only a fraction of the
@@ -697,7 +697,7 @@ original time, depending on how full the file system is.
.B verity
Enable support for verity protected files.
.B Tune2fs
-currently only supports setting this filesystem feature.
+currently only supports setting this file system feature.
.RE
.IP
After setting or clearing
@@ -706,10 +706,10 @@ After setting or clearing
.BR filetype ,
or
.B resize_inode
-filesystem features,
+file system features,
the file system may require being checked using
.BR e2fsck (8)
-to return the filesystem to a consistent state.
+to return the file system to a consistent state.
.B Tune2fs
will print a message requesting that the system administrator run
.BR e2fsck (8)
@@ -718,15 +718,15 @@ if necessary. After setting the
feature,
.B e2fsck -D
can be run to convert existing directories to the hashed B-tree format.
-Enabling certain filesystem features may prevent the filesystem from being
+Enabling certain file system features may prevent the file system from being
mounted by kernels which do not support those features. In particular, the
.B uninit_bg
and
.B flex_bg
-features are only supported by the ext4 filesystem.
+features are only supported by the ext4 file system.
.TP
.BI \-r " reserved-blocks-count"
-Set the number of reserved filesystem blocks.
+Set the number of reserved file system blocks.
.TP
.BI \-Q " quota-options"
Sets 'quota' feature on the superblock and works on the quota files for the
@@ -744,14 +744,14 @@ Sets/clears project quota inode in the superblock.
.RE
.TP
.BI \-T " time-last-checked"
-Set the time the filesystem was last checked using
+Set the time the file system was last checked using
.BR e2fsck .
The time is interpreted using the current (local) timezone.
This can be useful in scripts which use a Logical Volume Manager to make
-a consistent snapshot of a filesystem, and then check the filesystem
+a consistent snapshot of a file system, and then check the file system
during off hours to make sure it hasn't been corrupted due to
-hardware problems, etc. If the filesystem was clean, then this option can
-be used to set the last checked time on the original filesystem. The format
+hardware problems, etc. If the file system was clean, then this option can
+be used to set the last checked time on the original file system. The format
of
.I time-last-checked
is the international date format, with an optional time specifier, i.e.
@@ -761,13 +761,13 @@ is also accepted, in which case the last checked time will be set to the
current time.
.TP
.BI \-u " user"
-Set the user who can use the reserved filesystem blocks.
+Set the user who can use the reserved file system blocks.
.I user
can be a numerical uid or a user name. If a user name is given, it
is converted to a numerical uid before it is stored in the superblock.
.TP
.BI \-U " UUID"
-Set the universally unique identifier (UUID) of the filesystem to
+Set the universally unique identifier (UUID) of the file system to
.IR UUID .
The format of the UUID is a series of hex digits separated by hyphens,
like this:
@@ -778,7 +778,7 @@ parameter may also be one of the following:
.RS 1.2i
.TP
.I clear
-clear the filesystem UUID
+clear the file system UUID
.TP
.I random
generate a new randomly-generated UUID
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index f739f16c..cb5f575a 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -59,6 +59,7 @@ extern int optind;
#include "et/com_err.h"
#include "support/plausible.h"
#include "support/quotaio.h"
+#include "support/devname.h"
#include "uuid/uuid.h"
#include "e2p/e2p.h"
#include "util.h"
@@ -393,6 +394,8 @@ static errcode_t remove_journal_inode(ext2_filsys fs)
_("while clearing journal inode"));
return retval;
}
+ fs->super->s_overhead_clusters -=
+ EXT2FS_NUM_B2C(fs, EXT2_I_SIZE(&inode) / fs->blocksize);
memset(&inode, 0, sizeof(inode));
ext2fs_mark_bb_dirty(fs);
fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
@@ -927,7 +930,7 @@ static void rewrite_inodes(ext2_filsys fs, unsigned int flags)
ext2fs_free_mem(&ctx.ea_buf);
}
-static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
+static errcode_t rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
{
errcode_t retval;
dgrp_t i;
@@ -942,7 +945,9 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
rewrite_inodes(fs, flags);
ext2fs_mark_ib_dirty(fs);
ext2fs_mark_bb_dirty(fs);
- ext2fs_mmp_update2(fs, 1);
+ retval = ext2fs_mmp_update2(fs, 1);
+ if (retval)
+ return retval;
fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS;
if (ext2fs_has_feature_metadata_csum(fs->super))
@@ -950,6 +955,7 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags)
else
fs->super->s_checksum_type = 0;
ext2fs_mark_super_dirty(fs);
+ return 0;
}
static void enable_uninit_bg(ext2_filsys fs)
@@ -1611,8 +1617,12 @@ static int add_journal(ext2_filsys fs)
com_err(program_name, retval, "%s",
_("\n\twhile trying to create journal file"));
return retval;
- } else
- fputs(_("done\n"), stdout);
+ }
+ fs->super->s_overhead_clusters += EXT2FS_NUM_B2C(fs,
+ jparams.num_journal_blocks + jparams.num_fc_blocks);
+ ext2fs_mark_super_dirty(fs);
+ fputs(_("done\n"), stdout);
+
/*
* If the filesystem wasn't mounted, we need to force
* the block group descriptors out.
@@ -1671,8 +1681,9 @@ static int handle_quota_options(ext2_filsys fs)
if (quota_enable[qtype] == QOPT_ENABLE &&
*quota_sb_inump(fs->super, qtype) == 0) {
if ((qf_ino = quota_file_exists(fs, qtype)) > 0) {
- retval = quota_update_limits(qctx, qf_ino,
- qtype);
+ retval = quota_read_all_dquots(qctx, qf_ino,
+ qtype,
+ QREAD_LIMITS);
if (retval) {
com_err(program_name, retval,
_("while updating quota limits (%d)"),
@@ -1767,7 +1778,7 @@ static void parse_e2label_options(int argc, char ** argv)
io_options = strchr(argv[1], '?');
if (io_options)
*io_options++ = 0;
- device_name = blkid_get_devname(NULL, argv[1], NULL);
+ device_name = get_devname(NULL, argv[1], NULL);
if (!device_name) {
com_err("e2label", 0, _("Unable to resolve '%s'"),
argv[1]);
@@ -2067,7 +2078,7 @@ static void parse_tune2fs_options(int argc, char **argv)
io_options = strchr(argv[optind], '?');
if (io_options)
*io_options++ = 0;
- device_name = blkid_get_devname(NULL, argv[optind], NULL);
+ device_name = get_devname(NULL, argv[optind], NULL);
if (!device_name) {
com_err(program_name, 0, _("Unable to resolve '%s'"),
argv[optind]);
@@ -2944,6 +2955,8 @@ int tune2fs_main(int argc, char **argv)
#endif
if (argc && *argv)
program_name = *argv;
+ else
+ usage();
add_error_table(&et_ext2_error_table);
#ifdef CONFIG_BUILD_FINDFS
@@ -3095,9 +3108,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
if (retval) {
com_err("tune2fs", retval,
"while recovering journal.\n");
- printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
- if (fs)
- ext2fs_close_free(&fs);
+ printf(_("Please run e2fsck -fy %s.\n"), device_name);
+ if (!fs)
+ exit(1);
rc = 1;
goto closefs;
}
@@ -3235,6 +3248,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
fputs(_("Error in using clear_mmp. "
"It must be used with -f\n"),
stderr);
+ rc = 1;
goto closefs;
}
}
@@ -3401,8 +3415,14 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
}
}
- if (rewrite_checksums)
- rewrite_metadata_checksums(fs, rewrite_checksums);
+ if (rewrite_checksums) {
+ retval = rewrite_metadata_checksums(fs, rewrite_checksums);
+ if (retval != 0) {
+ printf("Failed to rewrite metadata checksums\n");
+ rc = 1;
+ goto closefs;
+ }
+ }
if (l_flag)
list_super(sb);
@@ -3439,5 +3459,13 @@ closefs:
if (feature_64bit)
convert_64bit(fs, feature_64bit);
- return (ext2fs_close_free(&fs) ? 1 : 0);
+
+ retval = ext2fs_close_free(&fs);
+ if (retval) {
+ com_err("tune2fs", retval,
+ _("while writing out and closing file system"));
+ rc = 1;
+ }
+
+ return rc;
}
diff --git a/misc/util.c b/misc/util.c
index 48e623dc..3e83169f 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -16,6 +16,11 @@
#define _LARGEFILE64_SOURCE
#endif
+#ifdef _WIN32
+#define _POSIX
+#define __USE_MINGW_ALARM
+#endif
+
#include "config.h"
#include <fcntl.h>
#include <setjmp.h>
@@ -45,6 +50,7 @@
#include "ext2fs/ext2_fs.h"
#include "ext2fs/ext2fs.h"
#include "support/nls-enable.h"
+#include "support/devname.h"
#include "blkid/blkid.h"
#include "util.h"
@@ -183,7 +189,7 @@ void parse_journal_opts(const char *opts)
arg ? arg : "NONE");
#endif
if (strcmp(token, "device") == 0) {
- journal_device = blkid_get_devname(NULL, arg, NULL);
+ journal_device = get_devname(NULL, arg, NULL);
if (!journal_device) {
if (arg)
fprintf(stderr, _("\nCould not find "