]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
partresize: enable journal on ssd's and vm's
authorArne Fitzenreiter <arne_f@ipfire.org>
Mon, 5 Jun 2023 07:30:29 +0000 (09:30 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 15 Jun 2023 09:25:59 +0000 (09:25 +0000)
the flashimage is build without journal to not destroy
usb thumbdrives or sd cards. On real ssd's and virtual
machines it should enabled for higher data security.

So this patch add the journal is drive support smart.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/partresize

index 832bc7237f6509f1526bdd177708afd6697d67ab..df9c439919c5083d08f994de6c5cba49bb5d1081 100644 (file)
@@ -48,6 +48,7 @@ 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
@@ -109,6 +110,18 @@ 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