summaryrefslogtreecommitdiffstats
path: root/e2fsck/e2fsck.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--e2fsck/e2fsck.c271
-rw-r--r--e2fsck/e2fsck.conf.5.in501
2 files changed, 772 insertions, 0 deletions
diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c
new file mode 100644
index 0000000..1e295e3
--- /dev/null
+++ b/e2fsck/e2fsck.c
@@ -0,0 +1,271 @@
+/*
+ * e2fsck.c - a consistency checker for the new extended file system.
+ *
+ * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#include "config.h"
+#include <errno.h>
+
+#include "e2fsck.h"
+#include "problem.h"
+
+/*
+ * This function allocates an e2fsck context
+ */
+errcode_t e2fsck_allocate_context(e2fsck_t *ret)
+{
+ e2fsck_t context;
+ errcode_t retval;
+ char *time_env;
+
+ retval = ext2fs_get_mem(sizeof(struct e2fsck_struct), &context);
+ if (retval)
+ return retval;
+
+ memset(context, 0, sizeof(struct e2fsck_struct));
+
+ context->process_inode_size = 256;
+ context->ext_attr_ver = 2;
+ context->blocks_per_page = 1;
+ context->htree_slack_percentage = 255;
+
+ time_env = getenv("E2FSCK_TIME");
+ if (time_env)
+ context->now = (time_t) strtoull(time_env, NULL, 0);
+ else {
+ context->now = time(0);
+ if (context->now < 1262322000) /* January 1 2010 */
+ context->flags |= E2F_FLAG_TIME_INSANE;
+ }
+
+ *ret = context;
+ return 0;
+}
+
+/*
+ * This function resets an e2fsck context; it is called when e2fsck
+ * needs to be restarted.
+ */
+errcode_t e2fsck_reset_context(e2fsck_t ctx)
+{
+ int i;
+
+ ctx->flags &= E2F_RESET_FLAGS;
+ ctx->lost_and_found = 0;
+ ctx->bad_lost_and_found = 0;
+ if (ctx->inode_used_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_used_map);
+ ctx->inode_used_map = 0;
+ }
+ if (ctx->inode_dir_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_dir_map);
+ ctx->inode_dir_map = 0;
+ }
+ if (ctx->inode_reg_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_reg_map);
+ ctx->inode_reg_map = 0;
+ }
+ if (ctx->block_found_map) {
+ ext2fs_free_block_bitmap(ctx->block_found_map);
+ ctx->block_found_map = 0;
+ }
+ if (ctx->inode_casefold_map) {
+ ext2fs_free_block_bitmap(ctx->inode_casefold_map);
+ ctx->inode_casefold_map = 0;
+ }
+ if (ctx->inode_link_info) {
+ ext2fs_free_icount(ctx->inode_link_info);
+ ctx->inode_link_info = 0;
+ }
+ if (ctx->journal_io) {
+ if (ctx->fs && ctx->fs->io != ctx->journal_io)
+ io_channel_close(ctx->journal_io);
+ ctx->journal_io = 0;
+ }
+ if (ctx->fs && ctx->fs->dblist) {
+ ext2fs_free_dblist(ctx->fs->dblist);
+ ctx->fs->dblist = 0;
+ }
+ e2fsck_free_dir_info(ctx);
+ e2fsck_free_dx_dir_info(ctx);
+ if (ctx->refcount) {
+ ea_refcount_free(ctx->refcount);
+ ctx->refcount = 0;
+ }
+ if (ctx->refcount_extra) {
+ ea_refcount_free(ctx->refcount_extra);
+ ctx->refcount_extra = 0;
+ }
+ if (ctx->ea_block_quota_blocks) {
+ ea_refcount_free(ctx->ea_block_quota_blocks);
+ ctx->ea_block_quota_blocks = 0;
+ }
+ if (ctx->ea_block_quota_inodes) {
+ ea_refcount_free(ctx->ea_block_quota_inodes);
+ ctx->ea_block_quota_inodes = 0;
+ }
+ if (ctx->ea_inode_refs) {
+ ea_refcount_free(ctx->ea_inode_refs);
+ ctx->ea_inode_refs = 0;
+ }
+ if (ctx->block_dup_map) {
+ ext2fs_free_block_bitmap(ctx->block_dup_map);
+ ctx->block_dup_map = 0;
+ }
+ if (ctx->block_ea_map) {
+ ext2fs_free_block_bitmap(ctx->block_ea_map);
+ ctx->block_ea_map = 0;
+ }
+ if (ctx->block_metadata_map) {
+ ext2fs_free_block_bitmap(ctx->block_metadata_map);
+ ctx->block_metadata_map = 0;
+ }
+ if (ctx->inode_bb_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_bb_map);
+ ctx->inode_bb_map = 0;
+ }
+ if (ctx->inode_bad_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_bad_map);
+ ctx->inode_bad_map = 0;
+ }
+ if (ctx->inode_imagic_map) {
+ ext2fs_free_inode_bitmap(ctx->inode_imagic_map);
+ ctx->inode_imagic_map = 0;
+ }
+ if (ctx->dirs_to_hash) {
+ ext2fs_u32_list_free(ctx->dirs_to_hash);
+ ctx->dirs_to_hash = 0;
+ }
+ destroy_encrypted_file_info(ctx);
+
+ /*
+ * Clear the array of invalid meta-data flags
+ */
+ if (ctx->invalid_inode_bitmap_flag) {
+ ext2fs_free_mem(&ctx->invalid_inode_bitmap_flag);
+ ctx->invalid_inode_bitmap_flag = 0;
+ }
+ if (ctx->invalid_block_bitmap_flag) {
+ ext2fs_free_mem(&ctx->invalid_block_bitmap_flag);
+ ctx->invalid_block_bitmap_flag = 0;
+ }
+ if (ctx->invalid_inode_table_flag) {
+ ext2fs_free_mem(&ctx->invalid_inode_table_flag);
+ ctx->invalid_inode_table_flag = 0;
+ }
+ if (ctx->casefolded_dirs) {
+ ext2fs_u32_list_free(ctx->casefolded_dirs);
+ ctx->casefolded_dirs = 0;
+ }
+ if (ctx->inode_count) {
+ ext2fs_free_icount(ctx->inode_count);
+ ctx->inode_count = 0;
+ }
+
+ /* Clear statistic counters */
+ ctx->fs_directory_count = 0;
+ ctx->fs_regular_count = 0;
+ ctx->fs_blockdev_count = 0;
+ ctx->fs_chardev_count = 0;
+ ctx->fs_links_count = 0;
+ ctx->fs_symlinks_count = 0;
+ ctx->fs_fast_symlinks_count = 0;
+ ctx->fs_fifo_count = 0;
+ ctx->fs_total_count = 0;
+ ctx->fs_badblocks_count = 0;
+ ctx->fs_sockets_count = 0;
+ ctx->fs_ind_count = 0;
+ ctx->fs_dind_count = 0;
+ ctx->fs_tind_count = 0;
+ ctx->fs_fragmented = 0;
+ ctx->fs_fragmented_dir = 0;
+ ctx->large_files = 0;
+ ctx->large_dirs = 0;
+
+ for (i=0; i < MAX_EXTENT_DEPTH_COUNT; i++)
+ ctx->extent_depth_count[i] = 0;
+
+ /* Reset the superblock to the user's requested value */
+ ctx->superblock = ctx->use_superblock;
+
+ return 0;
+}
+
+void e2fsck_free_context(e2fsck_t ctx)
+{
+ if (!ctx)
+ return;
+
+ e2fsck_reset_context(ctx);
+ if (ctx->blkid)
+ blkid_put_cache(ctx->blkid);
+
+ if (ctx->profile)
+ profile_release(ctx->profile);
+
+ if (ctx->filesystem_name)
+ ext2fs_free_mem(&ctx->filesystem_name);
+
+ if (ctx->device_name)
+ ext2fs_free_mem(&ctx->device_name);
+
+ if (ctx->log_fn)
+ free(ctx->log_fn);
+
+ if (ctx->logf)
+ fclose(ctx->logf);
+
+ if (ctx->problem_log_fn)
+ free(ctx->problem_log_fn);
+
+ if (ctx->problem_logf) {
+ fputs("</problem_log>\n", ctx->problem_logf);
+ fclose(ctx->problem_logf);
+ }
+ ext2fs_free_mem(&ctx);
+}
+
+/*
+ * This function runs through the e2fsck passes and calls them all,
+ * returning restart, abort, or cancel as necessary...
+ */
+typedef void (*pass_t)(e2fsck_t ctx);
+
+static pass_t e2fsck_passes[] = {
+ e2fsck_pass1, e2fsck_pass1e, e2fsck_pass2, e2fsck_pass3,
+ e2fsck_pass4, e2fsck_pass5, 0 };
+
+int e2fsck_run(e2fsck_t ctx)
+{
+ int i;
+ pass_t e2fsck_pass;
+
+#ifdef HAVE_SETJMP_H
+ if (setjmp(ctx->abort_loc)) {
+ ctx->flags &= ~E2F_FLAG_SETJMP_OK;
+ return (ctx->flags & E2F_FLAG_RUN_RETURN);
+ }
+ ctx->flags |= E2F_FLAG_SETJMP_OK;
+#endif
+
+ for (i=0; (e2fsck_pass = e2fsck_passes[i]); i++) {
+ if (ctx->flags & E2F_FLAG_RUN_RETURN)
+ break;
+ if (e2fsck_mmp_update(ctx->fs))
+ fatal_error(ctx, 0);
+ e2fsck_pass(ctx);
+ if (ctx->progress)
+ (void) (ctx->progress)(ctx, 0, 0, 0);
+ }
+ ctx->flags &= ~E2F_FLAG_SETJMP_OK;
+
+ if (ctx->flags & E2F_FLAG_RUN_RETURN)
+ return (ctx->flags & E2F_FLAG_RUN_RETURN);
+ return 0;
+}
diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in
new file mode 100644
index 0000000..e82610d
--- /dev/null
+++ b/e2fsck/e2fsck.conf.5.in
@@ -0,0 +1,501 @@
+.\" -*- nroff -*-
+.\" Copyright 2006 by Theodore Ts'o. All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH e2fsck.conf 5 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
+.SH NAME
+e2fsck.conf \- Configuration file for e2fsck
+.SH DESCRIPTION
+.I e2fsck.conf
+is the configuration file for
+.BR e2fsck (8).
+It controls the default behavior of
+.BR e2fsck (8)
+while it is checking ext2, ext3, or ext4 file systems.
+.PP
+The
+.I e2fsck.conf
+file uses an INI-style format. Stanzas, or top-level sections, are
+delimited by square braces: [ ]. Within each section, each line
+defines a relation, which assigns tags to values, or to a subsection,
+which contains further relations or subsections.
+.\" Tags can be assigned multiple values
+An example of the INI-style format used by this configuration file
+follows below:
+.P
+ [section1]
+.br
+ tag1 = value_a
+.br
+ tag1 = value_b
+.br
+ tag2 = value_c
+.P
+ [section 2]
+.br
+ tag3 = {
+.br
+ subtag1 = subtag_value_a
+.br
+ subtag1 = subtag_value_b
+.br
+ subtag2 = subtag_value_c
+.br
+ }
+.br
+ tag1 = value_d
+.br
+ tag2 = value_e
+.br
+ }
+.P
+Comments are delimited by a semicolon (';') or a hash ('#') character
+at the beginning of the comment, and are terminated by the end of
+line character.
+.P
+Tags and values must be quoted using double quotes if they contain
+spaces. Within a quoted string, the standard backslash interpretations
+apply: "\en" (for the newline character),
+"\et" (for the tab character), "\eb" (for the backspace character),
+and "\e\e" (for the backslash character).
+.P
+The following stanzas are used in the
+.I e2fsck.conf
+file. They will be described in more detail in future sections of this
+document.
+.TP
+.I [options]
+This stanza contains general configuration parameters for
+.BR e2fsck 's
+behavior.
+.TP
+.I [defaults]
+Contains relations which define the default parameters used by
+.BR e2fsck (8).
+In general, these defaults may be overridden by command-line options
+provided by the user.
+.TP
+.I [problems]
+This stanza allows the administrator to reconfigure how e2fsck handles
+various file system inconsistencies.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I [scratch_files]
+@TDB_MAN_COMMENT@This stanza controls when e2fsck will attempt to use
+@TDB_MAN_COMMENT@scratch files to reduce the need for memory.
+.SH THE [options] STANZA
+The following relations are defined in the
+.I [options]
+stanza.
+.TP
+.I allow_cancellation
+If this relation is set to a boolean value of true, then if the user
+interrupts e2fsck using ^C, and the file system is not explicitly flagged
+as containing errors, e2fsck will exit with an exit status of 0 instead
+of 32. This setting defaults to false.
+.TP
+.I accept_time_fudge
+Unfortunately, due to Windows' unfortunate design decision
+to configure the hardware clock to tick localtime, instead
+of the more proper and less error-prone UTC time, many
+users end up in the situation where the system clock is
+incorrectly set at the time when e2fsck is run.
+.IP
+Historically this was usually due to some distributions
+having buggy init scripts and/or installers that didn't
+correctly detect this case and take appropriate
+countermeasures. Unfortunately, this is occasionally
+true even today, usually due to a
+buggy or misconfigured virtualization manager or the
+installer not having access to a network time server
+during the installation process. So by default, we allow
+the superblock times to be fudged by up to 24 hours.
+This can be disabled by setting
+.I accept_time_fudge
+to the
+boolean value of false. This setting defaults to true.
+.TP
+.I broken_system_clock
+The
+.BR e2fsck (8)
+program has some heuristics that assume that the system clock is
+correct. In addition, many system programs make similar assumptions.
+For example, the UUID library depends on time not going backwards in
+order for it to be able to make its guarantees about issuing universally
+unique ID's. Systems with broken system clocks, are well, broken.
+However, broken system clocks, particularly in embedded systems, do
+exist. E2fsck will attempt to use heuristics to determine if the time
+can not be trusted; and to skip time-based checks if this is true. If
+this boolean is set to true, then e2fsck will always assume that the
+system clock can not be trusted.
+.TP
+.I buggy_init_scripts
+This boolean relation is an alias for
+.I accept_time_fudge
+for backwards compatibility; it used to
+be that the behavior defined by
+.I accept_time_fudge
+above defaulted to false, and
+.I buggy_init_scripts
+would enable superblock time field to be wrong by up to 24 hours. When
+we changed the default, we also renamed this boolean relation to
+.IR accept_time_fudge.
+.TP
+.I clear_test_fs_flag
+This boolean relation controls whether or not
+.BR e2fsck (8)
+will offer to clear
+the test_fs flag if the ext4 file system is available on the system. It
+defaults to true.
+.TP
+.I defer_check_on_battery
+This boolean relation controls whether or not the interval between
+file system checks (either based on time or number of mounts) should
+be doubled if the system is running on battery. This setting defaults to
+true.
+.TP
+.I indexed_dir_slack_percentage
+When
+.BR e2fsck (8)
+repacks a indexed directory, reserve the specified percentage of
+empty space in each leaf nodes so that a few new entries can
+be added to the directory without splitting leaf nodes, so that
+the average fill ratio of directories can be maintained at a
+higher, more efficient level. This relation defaults to 20
+percent.
+.TP
+.I inode_count_fullmap
+If this boolean relation is true, trade off using memory for speed when
+checking a file system with a large number of hard-linked files. The
+amount of memory required is proportional to the number of inodes in the
+file system. For large file systems, this can be gigabytes of memory.
+(For example a 40TB file system with 2.8 billion inodes will consume an
+additional 5.7 GB memory if this optimization is enabled.) This setting
+defaults to false.
+.TP
+.I log_dir
+If the
+.I log_filename
+or
+.I problem_log_filename
+relations contains a relative pathname, then the log file will be placed
+in the directory named by the
+.I log_dir
+relation.
+.TP
+.I log_dir_fallback
+This relation contains an alternate directory that will be used if the
+directory specified by
+.I log_dir
+is not available or is not writable.
+.TP
+.I log_dir_wait
+If this boolean relation is true, them if the directories specified by
+.I log_dir
+or
+.I log_dir_fallback
+are not available or are not yet writable, e2fsck will save the output
+in a memory buffer, and a child process will periodically test to see if
+the log directory has become available after the boot sequence has
+mounted the requested file system for reading/writing. This implements the
+functionality provided by
+.BR logsave (8)
+for e2fsck log files.
+.TP
+.I log_filename
+This relation specifies the file name where a copy of e2fsck's output
+will be written. If certain problem reports are suppressed using the
+.I max_count_problems
+relation, (or on a per-problem basis using the
+.I max_count
+relation), the full set of problem reports will be written to the log
+file. The filename may contain various percent-expressions (%D, %T, %N,
+etc.) which will be expanded so that the file name for the log file can
+include things like date, time, device name, and other run-time
+parameters. See the
+.B LOGGING
+section for more details.
+.TP
+.I max_count_problems
+This relation specifies the maximum number of problem reports of a
+particular type will be printed to stdout before further problem reports
+of that type are squelched. This can be useful if the console is slow
+(i.e., connected to a serial port) and so a large amount of output could
+end up delaying the boot process for a long time (potentially hours).
+.TP
+.I no_optimize_extents
+If this boolean relation is true, do not offer to optimize the extent
+tree by reducing the tree's width or depth. This setting defaults to false.
+.TP
+.I problem_log_filename
+This relation specifies the file name where a log of problem codes
+found by e2fsck be written. The filename may contain various
+percent-expressions (%D, %T, %N,
+etc.) which will be expanded so that the file name for the log file can
+include things like date, time, device name, and other run-time
+parameters. See the
+.B LOGGING
+section for more details.
+.TP
+.I readahead_mem_pct
+Use this percentage of memory to try to read in metadata blocks ahead of the
+main e2fsck thread. This should reduce run times, depending on the speed of
+the underlying storage and the amount of free memory. There is no default, but
+see
+.B readahead_kb
+for more details.
+.TP
+.I readahead_kb
+Use this amount of memory to read in metadata blocks ahead of the main checking
+thread. Setting this value to zero disables readahead entirely. By default,
+this is set the size of two block groups' inode tables (typically 4MiB on a
+regular ext4 file system); if this amount is more than 1/50th of total physical
+memory, readahead is disabled.
+.TP
+.I report_features
+If this boolean relation is true, e2fsck will print the file system
+features as part of its verbose reporting (i.e., if the
+.B -v
+option is specified)
+.TP
+.I report_time
+If this boolean relation is true, e2fsck will run as if the options
+.B -tt
+are always specified. This will cause e2fsck to print timing statistics
+on a pass by pass basis for full file system checks.
+.TP
+.I report_verbose
+If this boolean relation is true, e2fsck will run as if the option
+.B -v
+is always specified. This will cause e2fsck to print some additional
+information at the end of each full file system check.
+.SH THE [defaults] STANZA
+The following relations are defined in the
+.I [defaults]
+stanza.
+.TP
+.I undo_dir
+This relation specifies the directory where the undo file should be
+stored. It can be overridden via the
+.B E2FSPROGS_UNDO_DIR
+environment variable. If the directory location is set to the value
+.IR none ,
+.B e2fsck
+will not create an undo file.
+.SH THE [problems] STANZA
+Each tag in the
+.I [problems]
+stanza names a problem code specified with a leading "0x" followed by
+six hex digits.
+The value of the tag is a subsection where the relations in that
+subsection override the default treatment of that particular problem
+code.
+.P
+Note that inappropriate settings in this stanza may cause
+.B e2fsck
+to behave incorrectly, or even crash. Most system administrators should
+not be making changes to this section without referring to source code.
+.P
+Within each problem code's subsection, the following tags may be used:
+.TP
+.I description
+This relation allows the message which is printed when this file system
+inconsistency is detected to be overridden.
+.TP
+.I preen_ok
+This boolean relation overrides the default behavior controlling
+whether this file system problem should be automatically fixed when
+.B e2fsck
+is running in preen mode.
+.TP
+.I max_count
+This integer relation overrides the
+.I max_count_problems
+parameter (set in the options section) for this particular problem.
+.TP
+.I no_ok
+This boolean relation overrides the default behavior determining
+whether or not the file system will be marked as inconsistent if the user
+declines to fix the reported problem.
+.TP
+.I no_default
+This boolean relation overrides whether the default answer for this
+problem (or question) should be "no".
+.TP
+.I preen_nomessage
+This boolean relation overrides the default behavior controlling
+whether or not the description for this file system problem should
+be suppressed when
+.B e2fsck
+is running in preen mode.
+.TP
+.I no_nomsg
+This boolean relation overrides the default behavior controlling
+whether or not the description for this file system problem should
+be suppressed when a problem forced not to be fixed, either because
+.B e2fsck
+is run with the
+.B -n
+option or because the
+.I force_no
+flag has been set for the problem.
+.TP
+.I force_no
+This boolean option, if set to true, forces a problem to never be fixed.
+That is, it will be as if the user problem responds 'no' to the question
+of 'should this problem be fixed?'. The
+.I force_no
+option even overrides the
+.B -y
+option given on the command-line (just for the specific problem, of course).
+.TP
+.I not_a_fix
+This boolean option, it set to true, marks the problem as
+one where if the user gives permission to make the requested change,
+it does not mean that the file system had a problem which has since
+been fixed. This is used for requests to optimize the file system's
+data structure, such as pruning an extent tree.
+@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA
+@TDB_MAN_COMMENT@The following relations are defined in the
+@TDB_MAN_COMMENT@.I [scratch_files]
+@TDB_MAN_COMMENT@stanza.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I directory
+@TDB_MAN_COMMENT@If the directory named by this relation exists and is
+@TDB_MAN_COMMENT@writeable, then e2fsck will attempt to use this
+@TDB_MAN_COMMENT@directory to store scratch files instead of using
+@TDB_MAN_COMMENT@in-memory data structures.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I numdirs_threshold
+@TDB_MAN_COMMENT@If this relation is set, then in-memory data structures
+@TDB_MAN_COMMENT@will be used if the number of directories in the file system
+@TDB_MAN_COMMENT@are fewer than amount specified.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I dirinfo
+@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
+@TDB_MAN_COMMENT@directory is used instead of an in-memory data
+@TDB_MAN_COMMENT@structure for directory information. It defaults to
+@TDB_MAN_COMMENT@true.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I icount
+@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
+@TDB_MAN_COMMENT@directory is used instead of an in-memory data
+@TDB_MAN_COMMENT@structure when tracking inode counts. It defaults to
+@TDB_MAN_COMMENT@true.
+.SH LOGGING
+E2fsck has the facility to save the information from an e2fsck run in a
+directory so that a system administrator can review its output at their
+leisure. This allows information captured during the automatic e2fsck
+preen run, as well as a manually started e2fsck run, to be saved for
+posterity. This facility is controlled by the
+.IR log_filename ,
+.IR log_dir ,
+.IR log_dir_fallback ,
+and
+.I log_dir_wait
+relations in the
+.I [options]
+stanza.
+.PP
+The filename in
+.I log_filename
+may contain the following percent-expressions that will be expanded as
+follows.
+.TP
+.B %d
+The current day of the month
+.TP
+.B %D
+The current date; this is a equivalent of
+.B %Y%m%d
+.TP
+.B %h
+The hostname of the system.
+.TP
+.B %H
+The current hour in 24-hour format (00..23)
+.TP
+.B %m
+The current month as a two-digit number (01..12)
+.TP
+.B %M
+The current minute (00..59)
+.TP
+.B %N
+The name of the block device containing the file system, with any
+directory pathname stripped off.
+.TP
+.B %p
+The pid of the e2fsck process
+.TP
+.B %s
+The current time expressed as the number of seconds since 1970-01-01
+00:00:00 UTC
+.TP
+.B %S
+The current second (00..59)
+.TP
+.B %T
+The current time; this is equivalent of
+.B %H%M%S
+.TP
+.B %u
+The name of the user running e2fsck.
+.TP
+.B %U
+This percent expression does not expand to anything, but it signals that
+any following date or time expressions should be expressed in UTC time
+instead of the local timezone.
+.TP
+.B %y
+The last two digits of the current year (00..99)
+.TP
+.B %Y
+The current year (i.e., 2012).
+.SH EXAMPLES
+The following recipe will prevent e2fsck from aborting during the boot
+process when a file system contains orphaned files. (Of course, this is
+not always a good idea, since critical files that are needed for the
+security of the system could potentially end up in lost+found, and
+starting the system without first having a system administrator check
+things out may be dangerous.)
+.P
+.br
+ [problems]
+.br
+ 0x040002 = {
+.br
+ preen_ok = true
+.br
+ description = "@u @i %i. "
+.br
+ }
+.P
+The following recipe will cause an e2fsck logfile to be written to the
+directory /var/log/e2fsck, with a filename that contains the device
+name, the hostname of the system, the date, and time: e.g.,
+"e2fsck-sda3.server.INFO.20120314-112142". If the directory containing
+/var/log is located on the root file system
+which is initially mounted read-only, then the output will be saved in
+memory and written out once the root file system has been remounted
+read/write. To avoid too much detail from being written to the serial
+console (which could potentially slow down the boot sequence), only print
+no more than 16 instances of each type of file system corruption.
+.P
+.br
+ [options]
+.br
+ max_count_problems = 16
+.br
+ log_dir = /var/log/e2fsck
+.br
+ log_filename = e2fsck-%N.%h.INFO.%D-%T
+.br
+ log_dir_wait = true
+.P
+.SH FILES
+.TP
+.I /etc/e2fsck.conf
+The configuration file for
+.BR e2fsck (8).
+.SH SEE ALSO
+.BR e2fsck (8)