#3650 PR closed: Add MKFS_EXT_OPTIONS for ext2/ext3/ext4 filesystems during 'rear recover'

sebastian-koehler opened issue at 2026-10-04 16:05:

Summary

  • Adds MKFS_EXT_OPTIONS, mirroring the existing MKFS_XFS_OPTIONS, so a user can pass extra mkfs/mke2fs options (e.g. -E nodiscard) for ext2/ext3/ext4 filesystems via local.conf/site.conf during rear recover.
  • Motivating case: mke2fs's default block-discard/TRIM pass is slow against thin-provisioned virtual disks, the same problem MKFS_XFS_OPTIONS="-K" already solves for XFS.
  • One flat global variable, no per-device override: the (ext*) case arm in 131_include_filesystem_code.sh is shared by ext2/ext3/ext4 with no per-fstype branching, and unlike XFS there is no saved-raw-options replay tier for a per-device override to take precedence over, so that extra complexity isn't warranted here.

Changes

  • usr/share/rear/layout/prepare/GNU/Linux/131_include_filesystem_code.sh: reads MKFS_EXT_OPTIONS and appends it to the generated mkfs command in both the -U uuid branch (and its no--U-support fallback) and the no-uuid branch.
  • usr/share/rear/conf/default.conf: new documentation block for MKFS_EXT_OPTIONS, placed directly after the existing MKFS_XFS_OPTIONS block and matching its style.

Test plan

  • ☒ bash -n syntax check on the modified script.

  • ☒ Sourced create_fs() directly with stubbed Log/LogPrint/mount_fs and a synthetic disklayout.conf ext4 entry; confirmed the generated mkfs line is byte-identical to before this change when MKFS_EXT_OPTIONS is unset, and correctly includes -E nodiscard right before -U/-F in all three code paths (uuid branch, its fallback, and the no-uuid branch) when set.

  • ☐ End-to-end rear mkbackup/rear recover on a live ext4 client with MKFS_EXT_OPTIONS="-E nodiscard" set.

codacy-production commented at 2026-10-04 16:06:

Up to standards ✅

🟢 Issues 0 issues >
> > **Results:** > `0` new issues > > [View in > Codacy](https://app.codacy.com/gh/rear/rear/pull-requests/3650/issues) >

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.


[Export of Github issue for rear/rear.]