e2fsck.conf - Linux


Overview

e2fsck.conf allows users to configure various aspects of the e2fsck utility, which is used to check and repair ext2/ext3/ext4 filesystems. It provides a convenient way to customize e2fsck’s behavior on a per-system basis.

Syntax

e2fsck.conf [options] [--] [device]

Options/Flags

  • -b backup-file: Specifies a filename to which currently set options are saved. This can be useful for creating backups or sharing configurations.
  • -c: Forces an extended check of the filesystem.
  • -C FD: Specifies an open file descriptor from which to read parameters. Useful for reading settings from other programs or pipes.
  • -d: Runs in debugging mode.
  • -e error-file: Specifies a filename to write any errors to.
  • -f: Forces checking even if the filesystem seems clean.
  • -l list-options: Lists all available options and their current values.
  • -p: Automatically repair any detected filesystem errors.
  • -S size-in-MB: Sets the maximum size of the file system to be checked.
  • -v verbose: Runs in verbose mode, providing detailed output.
  • -V: Prints the version of e2fsck.conf.

Examples

1. Check and repair a filesystem with default options:

e2fsck /dev/sda1

2. Force an extended check:

e2fsck -c /dev/sda1

3. Automatically repair filesystem errors:

e2fsck -p /dev/sda1

4. Save current options to a backup file:

e2fsck -b backup-options.conf /dev/sda1

5. List all available options:

e2fsck -l

Common Issues

1. Error: Bad magic number in superblock

This error indicates that the filesystem is severely damaged. There is a high chance of data loss. Consult with a data recovery specialist to recover as much data as possible.

2. Error: No such device or address

Ensure that the specified device is valid and connected to the system.

Integration

e2fsck.conf can be integrated with other commands and scripts to streamline maintenance tasks. For example, it can be used in a cron job to regularly check and repair filesystems:

0 0 * * * e2fsck -f -p /dev/sda1

Related Commands

  • e2fsck: The core utility for checking and repairing ext2/ext3/ext4 filesystems.
  • fsck: A generic tool for checking and repairing various types of filesystems.
  • tune2fs: A tool for adjusting filesystem parameters.