[2/2] flash-image: Create a journal when the filesystem is being created

Message ID 20241214120547.863221-2-michael.tremer@ipfire.org
State Accepted
Commit 0d774f0db56882073254973bd25da32c50f12801
Headers
Series [1/2] installer: Remove the option to install without journal |

Commit Message

Michael Tremer Dec. 14, 2024, 12:05 p.m. UTC
  We recently started to have problems when a new installation was
launched from the flash image that creating the journal corrupted the
filesystem on the next mount operation.

Since we would like all IPFire installations to have a journal, we
create this now when we create the image and won't try to add it later.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 lfs/flash-images                  |  2 +-
 src/initscripts/system/partresize | 13 -------------
 2 files changed, 1 insertion(+), 14 deletions(-)
  

Comments

Adolf Belka Dec. 14, 2024, 12:58 p.m. UTC | #1
Reviewed-by: Adolf Belka <adolf.belka@ipfire.org>

On 14/12/2024 13:05, Michael Tremer wrote:
> We recently started to have problems when a new installation was
> launched from the flash image that creating the journal corrupted the
> filesystem on the next mount operation.
>
> Since we would like all IPFire installations to have a journal, we
> create this now when we create the image and won't try to add it later.
>
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
>   lfs/flash-images                  |  2 +-
>   src/initscripts/system/partresize | 13 -------------
>   2 files changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/lfs/flash-images b/lfs/flash-images
> index 30513f0bc..27d3a89d7 100644
> --- a/lfs/flash-images
> +++ b/lfs/flash-images
> @@ -126,7 +126,7 @@ endif
>   ifeq "$(EFI)" "1"
>   	mkfs.vfat $(PART_EFI)
>   endif
> -	mkfs.ext4 -O ^has_journal,extent -F $(PART_ROOT)
> +	mkfs.ext4 -F $(PART_ROOT)
>   
>   	# Most systems that use Flashimages has no RTC at boot
>   	# so the interval check should disables
> diff --git a/src/initscripts/system/partresize b/src/initscripts/system/partresize
> index df9c43991..832bc7237 100644
> --- a/src/initscripts/system/partresize
> +++ b/src/initscripts/system/partresize
> @@ -48,7 +48,6 @@ case "${1}" in
>   			# Azure and Google Compute Platform
>   			if running_on_ec2 || running_on_oci || running_on_azure || running_on_gcp; then
>   				scon="on"
> -				journal="on"
>   			fi
>   
>   			mount /boot > /dev/null
> @@ -110,18 +109,6 @@ case "${1}" in
>   						root_dev="${dev::-2}"
>   					fi
>   
> -					# Check if the device support smart
> -					smartctl --smart=on "${root_dev}" > /dev/null
> -					if [ ${?} = 0 ]; then
> -						journal="on"
> -					fi
> -
> -					# Enable journal
> -					if [ "${journal}" = "on" ]; then
> -						boot_mesg "Create journal on "${dev}" ..."
> -						tune2fs -O has_journal "${dev}"
> -					fi
> -
>   					boot_mesg "Growing root partition to maximum size..."
>   					echo -e ',+' | sfdisk --no-reread -f -N${part_num} "${root_dev}" 2>/dev/null
>
  

Patch

diff --git a/lfs/flash-images b/lfs/flash-images
index 30513f0bc..27d3a89d7 100644
--- a/lfs/flash-images
+++ b/lfs/flash-images
@@ -126,7 +126,7 @@  endif
 ifeq "$(EFI)" "1"
 	mkfs.vfat $(PART_EFI)
 endif
-	mkfs.ext4 -O ^has_journal,extent -F $(PART_ROOT)
+	mkfs.ext4 -F $(PART_ROOT)
 
 	# Most systems that use Flashimages has no RTC at boot
 	# so the interval check should disables
diff --git a/src/initscripts/system/partresize b/src/initscripts/system/partresize
index df9c43991..832bc7237 100644
--- a/src/initscripts/system/partresize
+++ b/src/initscripts/system/partresize
@@ -48,7 +48,6 @@  case "${1}" in
 			# Azure and Google Compute Platform
 			if running_on_ec2 || running_on_oci || running_on_azure || running_on_gcp; then
 				scon="on"
-				journal="on"
 			fi
 
 			mount /boot > /dev/null
@@ -110,18 +109,6 @@  case "${1}" in
 						root_dev="${dev::-2}"
 					fi
 
-					# Check if the device support smart
-					smartctl --smart=on "${root_dev}" > /dev/null
-					if [ ${?} = 0 ]; then
-						journal="on"
-					fi
-
-					# Enable journal
-					if [ "${journal}" = "on" ]; then
-						boot_mesg "Create journal on "${dev}" ..."
-						tune2fs -O has_journal "${dev}"
-					fi
-
 					boot_mesg "Growing root partition to maximum size..."
 					echo -e ',+' | sfdisk --no-reread -f -N${part_num} "${root_dev}" 2>/dev/null