[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#804446: initramfs-tools: Do not include fsck tools for non-fscable filesystems



Package: initramfs-tools
Version: 0.120
Severity: normal
Tags: +patch

Dear Maintainer,

Currently partman-xfs|btrfs sets passnum to 1/2 for xfs/btrfs
filesystems, then initramfs-tools includes fsck tools for these, which
then xfs/btrfs utility packages ship, which are no-op shell scripts that
do nothing and are executed on each boot.

Imho, this is a bit silly.

I would like to drop the dummy wrapper script from btrfs package to
achieve that I am proposing the following:

* fix partman-xfs|btrfs to set passnum to 0 unconditionally (done)

* fix initramfs-tools fsck hook to ignore passno 0 fstab entries when
  calculation which fsck tools to include in the initramfs. (this bug)

* make sure repair/recovery tools are included in the initramfs via
  filesystem specific initramfs-tools hooks (ie. xfs_repair / btrfs
  check)

* and finally migrate people to 0 pass number in the /etc/fstab for said
  filesystems.

Please consider applying and uploading this patch into Debian unstable.

Regards,

Dimitri.
From 811c1005d2caf8e395e22a16ea202cb230999a3d Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Date: Sun, 8 Nov 2015 16:01:01 +0000
Subject: [PATCH] Do no include fsck, for filesystems that are non-fsckable
 (passno 0)
Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ

btrfs and xfs are examples of filesystems that do not have an fsck. Or
well, they do have repair/restore utilities, but they are not fsck(8)
compatible nor required to be run periodically on boot. Both packages
currently ship fsck(8) compatible scripts, which do nothing. That's
not useful at all.

partman-xfs & partman-btrfs have been just fixed to set passno in
fstab to 0 on new installations, as indeed it makes no sense to run
no-op scripts for those filesystems.

This patch makes fsck hook to be passno aware, and if it is set to
zero, to decide not to include an fsck script for requested
filesystem.

It is expected that repair/recovery utilities for passno == 0
filesystems are included in the initramfs, via filesystem in question
specific initramfs-hooks (e.g. xfs_repair and `btrfs check')

Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
---
 hooks/fsck | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hooks/fsck b/hooks/fsck
index 6c90996..44292b9 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -23,6 +23,7 @@ _read_fstab_entry () {
 	echo "MNT_FSNAME="
 	echo "MNT_DIR="
 	echo "MNT_TYPE="
+	echo "MNT_PASS="
 
 	fstab_files | while read file; do
 		if [ -f "$file" ]; then
@@ -39,6 +40,7 @@ _read_fstab_entry () {
 					echo "MNT_FSNAME=$MNT_FSNAME"
 					echo "MNT_DIR=$MNT_DIR"
 					echo "MNT_TYPE=$MNT_TYPE"
+					echo "MNT_PASS=$MNT_PASS"
 					break 2
 				fi
 				MNT_DIR=""
@@ -52,6 +54,11 @@ _read_fstab_entry () {
 get_fstype_fstab () {
 	eval "$(_read_fstab_entry "$1")"
 
+	# Do not include fsck for non-fsckable filesystems
+	if [ "$MNT_PASS" = "0" ]; then
+	    return
+	fi
+
 	# Not found by default.
 	if [ "$1" = "$MNT_DIR" ]; then
 		case "$MNT_TYPE" in
-- 
2.5.0


Reply to: