Skip to content

Commit 29b6f62

Browse files
authored
[202012] Run tune2fs during initramfs instead of image install (#10558)
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 <[email protected]>
1 parent 6e17ef3 commit 29b6f62

File tree

6 files changed

+2
-24
lines changed

6 files changed

+2
-24
lines changed

files/Aboot/boot0.j2

-3
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,6 @@ extract_image() {
355355
local rootdev="$(echo $mountstr | cut -f1 -d' ')"
356356
rootfs_type="$(echo $mountstr | cut -d' ' -f3)"
357357

358-
## Don't reserve any blocks just for root
359-
tune2fs -m 0 -r 0 $rootdev
360-
361358
info "Extracting $dockerfs from swi"
362359
## Unpacking dockerfs delayed
363360
## 1. when disk is vfat as it does not support symbolic link

files/initramfs-tools/mke2fs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ copy_exec /usr/sbin/mke2fs /usr/local/sbin/
2121
copy_exec /sbin/sfdisk
2222
copy_exec /sbin/fdisk
2323
copy_exec /sbin/resize2fs
24+
copy_exec /sbin/tune2fs
2425
copy_exec /sbin/findfs
2526

2627
fstypes="ext4 ext3"

files/initramfs-tools/union-mount.j2

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ case "${ROOT}" in
129129
*)
130130
## Mount the raw partition again
131131
mount ${ROOT} ${rootmnt}/host
132+
tune2fs -m 0 -r 0 ${ROOT}
132133
;;
133134
esac
134135

installer/arm64/install.sh

-5
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ elif [ "$install_env" = "sonic" ]; then
117117
rm -rf $f
118118
fi
119119
done
120-
121-
demo_dev=$(findmnt -n -o SOURCE --target /host)
122-
123-
# Don't reserve any blocks just for root
124-
tune2fs -m 0 -r 0 $demo_dev
125120
fi
126121

127122
# Create target directory or clean it up if exists

installer/armhf/install.sh

-5
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ elif [ "$install_env" = "sonic" ]; then
117117
rm -rf $f
118118
fi
119119
done
120-
121-
demo_dev=$(findmnt -n -o SOURCE --target /host)
122-
123-
# Don't reserve any blocks just for root
124-
tune2fs -m 0 -r 0 $demo_dev
125120
fi
126121

127122
# Create target directory or clean it up if exists

installer/x86_64/install.sh

-11
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,6 @@ if [ "$install_env" = "onie" ]; then
434434
# Make filesystem
435435
mkfs.ext4 -L $demo_volume_label $demo_dev
436436
437-
# Don't reserve any blocks just for root
438-
tune2fs -m 0 -r 0 $demo_dev
439-
440437
# Mount demo filesystem
441438
demo_mnt=$(${onie_bin} mktemp -d) || {
442439
echo "Error: Unable to create file system mount point"
@@ -469,20 +466,12 @@ elif [ "$install_env" = "sonic" ]; then
469466
rm -rf $f
470467
fi
471468
done
472-
473-
demo_dev=$(findmnt -n -o SOURCE --target /host)
474-
475-
# Don't reserve any blocks just for root
476-
tune2fs -m 0 -r 0 $demo_dev
477469
else
478470
demo_mnt="build_raw_image_mnt"
479471
demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%"
480472
481473
mkfs.ext4 -L $demo_volume_label $demo_dev
482474
483-
# Don't reserve any blocks just for root
484-
tune2fs -m 0 -r 0 $demo_dev
485-
486475
echo "Mounting $demo_dev on $demo_mnt..."
487476
mkdir $demo_mnt
488477
mount -t auto -o loop $demo_dev $demo_mnt

0 commit comments

Comments
 (0)