From df225b13cd3a586765dd0bce2f7b56f4c8a18989 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Mon, 11 Apr 2022 14:55:17 -0700 Subject: [PATCH] Run tune2fs during initramfs instead of image install If it is run during image install, it's not guaranteed that the installation environment will have tune2fs available. Therefore, run it during initramfs instead. Signed-off-by: Saikrishna Arcot --- files/Aboot/boot0.j2 | 3 --- files/initramfs-tools/mke2fs | 1 + files/initramfs-tools/union-mount.j2 | 1 + installer/arm64/install.sh | 5 ----- installer/armhf/install.sh | 5 ----- installer/x86_64/install.sh | 11 ----------- 6 files changed, 2 insertions(+), 24 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 7306c36cfc0..2510695d136 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -355,9 +355,6 @@ extract_image() { local rootdev="$(echo $mountstr | cut -f1 -d' ')" rootfs_type="$(echo $mountstr | cut -d' ' -f3)" - ## Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $rootdev - info "Extracting $dockerfs from swi" ## Unpacking dockerfs delayed ## 1. when disk is vfat as it does not support symbolic link diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs index 1f98f20c23c..2c6d45ea5bc 100644 --- a/files/initramfs-tools/mke2fs +++ b/files/initramfs-tools/mke2fs @@ -21,6 +21,7 @@ copy_exec /usr/sbin/mke2fs /usr/local/sbin/ copy_exec /sbin/sfdisk copy_exec /sbin/fdisk copy_exec /sbin/resize2fs +copy_exec /sbin/tune2fs copy_exec /sbin/findfs fstypes="ext4 ext3" diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 7a64f71d70b..c9dd1920440 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -133,6 +133,7 @@ case "${ROOT}" in *) ## Mount the raw partition again mount -t ext4 ${ROOT} ${rootmnt}/host + tune2fs -m 0 -r 0 ${ROOT} ;; esac diff --git a/installer/arm64/install.sh b/installer/arm64/install.sh index 249c5b52170..dee3ceec903 100755 --- a/installer/arm64/install.sh +++ b/installer/arm64/install.sh @@ -139,11 +139,6 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh index 8cffa755734..9ade40d5149 100755 --- a/installer/armhf/install.sh +++ b/installer/armhf/install.sh @@ -139,11 +139,6 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 950d765d241..dbab4d54ab7 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -477,9 +477,6 @@ if [ "$install_env" = "onie" ]; then # Make filesystem mkfs.ext4 -L $demo_volume_label $demo_dev - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev - # Mount demo filesystem demo_mnt=$(${onie_bin} mktemp -d) || { echo "Error: Unable to create file system mount point" @@ -512,20 +509,12 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done - - demo_dev=$(findmnt -n -o SOURCE --target /host) - - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" mkfs.ext4 -L $demo_volume_label $demo_dev - # Don't reserve any blocks just for root - tune2fs -m 0 -r 0 $demo_dev - echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt mount -t auto -o loop $demo_dev $demo_mnt