7ba7c83297
To avoid any previous ext4 file system signatures that could have been present from previous installs, add lvcreate options to wipe signatures and zero the first 4KiB of data in the LV. This will avoid requiring user interaction. WARNING: ext4 signature detected on /dev/cgts-vg/scratch-lv at offset 1080. Wipe it? [y/n]: Change-Id: Ifeb0ddf193820a3e5d98006093813355d2494797 Story: 2009101 Task: 44628 Signed-off-by: Robert Church <robert.church@windriver.com>
198 lines
7.1 KiB
Diff
198 lines
7.1 KiB
Diff
From: Robert Church <robert.church@windriver.com>
|
|
Date: Sun, 20 Feb 2022 14:50:05 +0800
|
|
Subject: debian: Add CentOS compatible initial AIO partitioning/formatting
|
|
|
|
Add support for initial AIO partitioning and LVM formatting for AIO
|
|
hosts.
|
|
- Creates platform-backup partition
|
|
- Creates default cgts-vg volume group and physical volume
|
|
- Creates initial logical volumes for scratch-lv and log-lv
|
|
|
|
Signed-off-by: Robert Church <robert.church@windriver.com>
|
|
|
|
Rebase to meta-lat 20220220
|
|
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
|
---
|
|
init-ostree-install.sh | 119 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
1 file changed, 117 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/init-ostree-install.sh b/init-ostree-install.sh
|
|
index c46650f..0a84179 100644
|
|
--- a/init-ostree-install.sh
|
|
+++ b/init-ostree-install.sh
|
|
@@ -86,7 +86,9 @@ OPTIONAL:
|
|
BSZ=# - MB size of boot partition
|
|
RSZ=# - MB size of root partition
|
|
VSZ=# - MB size of var partition (0 for auto expand)
|
|
-
|
|
+ StarlingX
|
|
+ inststx=0 - install StarlingX partitioning
|
|
+ personality=aio - StarlingX install personality (aio,con,wor,sto)
|
|
EOF
|
|
}
|
|
|
|
@@ -108,7 +110,7 @@ conflict_label() {
|
|
local op=$1
|
|
local 'label' 'd' 'devs' 'conflict' 'i' 'fstype'
|
|
conflict=1
|
|
- for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata; do
|
|
+ for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata platform_backup platform_pv; do
|
|
devs=$(blkid -t LABEL=$label -o device |grep -v $INSTDEV)
|
|
if [ "$devs" != "" ] ; then
|
|
i=0
|
|
@@ -547,6 +549,8 @@ IP=""
|
|
MAX_TIMEOUT_FOR_WAITING_LOWSPEED_DEVICE=60
|
|
OSTREE_KERNEL_ARGS=${OSTREE_KERNEL_ARGS=%OSTREE_KERNEL_ARGS%}
|
|
KS=""
|
|
+INSTSTX=${INSTSTX=""}
|
|
+PERSONALITY=${PERSONALITY=""}
|
|
|
|
if [ "$OSTREE_KERNEL_ARGS" = "%OSTREE_KERNEL_ARGS%" ] ; then
|
|
OSTREE_KERNEL_ARGS="ro rootwait"
|
|
@@ -643,6 +647,10 @@ read_args() {
|
|
RSZ=$optarg ;;
|
|
VSZ=*)
|
|
VSZ=$optarg ;;
|
|
+ inststx=*)
|
|
+ INSTSTX=$optarg ;;
|
|
+ personality=*)
|
|
+ PERSONALITY=$optarg ;;
|
|
esac
|
|
done
|
|
# defaults if not set
|
|
@@ -655,6 +663,9 @@ read_args() {
|
|
if [ "$INSTGPG" = "" ] ; then INSTGPG=1 ; fi
|
|
if [ "$INSTFLUX" = "" ] ; then INSTFLUX=1 ; fi
|
|
if [ "$INSTSBD" = "" ] ; then INSTSBD=2 ; fi
|
|
+ if [ "$INSTSTX" = "" ] ; then INSTSTX=0 ; fi
|
|
+ if [ "$PERSONALITY" = "" ] ; then PERSONALITY=aio ; fi
|
|
+
|
|
}
|
|
|
|
shell_start() {
|
|
@@ -779,6 +790,40 @@ grub_partition() {
|
|
fi
|
|
fi
|
|
|
|
+ ############################################
|
|
+ # StarlingX: Temp partitioning compatability
|
|
+ if [ "$INSTSTX" = 1 ] ; then
|
|
+ if [ "$VSZ" = 0 ] ; then
|
|
+ # /var using up the remainder of the disk
|
|
+ echo "WARNING WARNING - Can't allocate StarlingX partitions, /var will use the remainder of the disk"
|
|
+ else
|
|
+ case $PERSONALITY in
|
|
+ aio)
|
|
+ echo "Allocating StarlingX AIO host partitioning"
|
|
+ CGCS_PV_SIZE=183296
|
|
+ PLATFORM_BACKUP_SIZE=30000
|
|
+
|
|
+ grub_pt_update
|
|
+ end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1))
|
|
+ a="$a -n $p:$first:$end -c $p:platform_backup"
|
|
+ grub_pt_update
|
|
+ end=$(($first+($CGCS_PV_SIZE*1024*1024/$lsz)-1))
|
|
+ a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00"
|
|
+ ;;
|
|
+ con)
|
|
+ echo "WARNING WARNING: StarlingX standard controller host partitioning not supported"
|
|
+ ;;
|
|
+ wor)
|
|
+ echo "WARNING WARNING: StarlingX worker host partitioning not supported"
|
|
+ ;;
|
|
+ sto)
|
|
+ echo "WARNING WARNING: StarlingX storage host partitioning not supported"
|
|
+ ;;
|
|
+ esac
|
|
+ fi
|
|
+ fi
|
|
+ ############################################
|
|
+
|
|
sgdisk $a -p ${dev}
|
|
}
|
|
|
|
@@ -943,6 +988,40 @@ if [ -n "${KS}" ]; then
|
|
fi
|
|
fi
|
|
|
|
+############################################
|
|
+# StarlingX: Clean up the volume group
|
|
+if [ "$INSTSTX" = 1 ] ; then
|
|
+ if [ "$VSZ" = 0 ] ; then
|
|
+ # /var using up the remainder of the disk
|
|
+ echo "WARNING WARNING - No volume group info to clean up, /var will use the remainder of the disk"
|
|
+ else
|
|
+ case $PERSONALITY in
|
|
+ aio)
|
|
+ echo "AIO: Clean up the volume group so that the disk can be re-partitioned"
|
|
+ vgremove -f cgts-vg
|
|
+
|
|
+ # Find and wipe any existing PVs
|
|
+ partitions=$(pvs -o pv_name --noheading | grep -v '\[unknown\]')
|
|
+ for p in $partitions
|
|
+ do
|
|
+ echo "Pre-wiping $p (pvs present)"
|
|
+ dd if=/dev/zero of=$p bs=512 count=34
|
|
+ dd if=/dev/zero of=$p bs=512 count=34 seek=$((`blockdev --getsz $p` - 34))
|
|
+ pvremove -f $p
|
|
+ wipefs -a $p
|
|
+ done
|
|
+ ;;
|
|
+ con)
|
|
+ ;;
|
|
+ wor)
|
|
+ ;;
|
|
+ sto)
|
|
+ ;;
|
|
+ esac
|
|
+ fi
|
|
+fi
|
|
+############################################
|
|
+
|
|
# Early curl exec
|
|
|
|
if [ "${ECURL}" != "" -a "${ECURL}" != "none" ] ; then
|
|
@@ -1145,6 +1224,42 @@ if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then
|
|
mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART}
|
|
fi
|
|
fi
|
|
+ ########################################
|
|
+ # StarlingX: Temp VG/PV/LV/FS formatting
|
|
+ if [ "$INSTSTX" = 1 ] ; then
|
|
+ if [ "$VSZ" = 0 ] ; then
|
|
+ echo "WARNING WARNING - Skipping StarlingX default LVM storage, /var will use the remainder of the disk"
|
|
+ else
|
|
+ case $PERSONALITY in
|
|
+ aio)
|
|
+ echo "Creating StarlingX AIO host default LVM storage"
|
|
+ LOG_VOL_SIZE=8000
|
|
+ SCRATCH_VOL_SIZE=16000
|
|
+
|
|
+ pi=$((pi+1))
|
|
+ mkfs.ext4 -F -L platform_backup ${fs_dev}${pi}
|
|
+
|
|
+ pi=$((pi+1))
|
|
+ vgcreate --yes --force cgts-vg ${fs_dev}${pi}
|
|
+ lvcreate --yes -n log-lv --size "${LOG_VOL_SIZE}MB" cgts-vg
|
|
+ mkfs.ext4 -F /dev/cgts-vg/log-lv
|
|
+ lvcreate -n scratch-lv --size "${SCRATCH_VOL_SIZE}MB" cgts-vg
|
|
+ mkfs.ext4 -F /dev/cgts-vg/scratch-lv
|
|
+
|
|
+ ;;
|
|
+ con)
|
|
+ echo "WARNING WARNING: StarlingX standard controller host default LVM storage not supported"
|
|
+ ;;
|
|
+ wor)
|
|
+ echo "WARNING WARNING: StarlingX worker host default LVM storage not supported"
|
|
+ ;;
|
|
+ sto)
|
|
+ echo "WARNING WARNING: StarlingX storage host default LVM storage not supported"
|
|
+ ;;
|
|
+ esac
|
|
+ fi
|
|
+ fi
|
|
+ ########################################
|
|
elif [ "$INSTFMT" != 0 ] ; then
|
|
if [ $INSTSF = 1 ] ; then
|
|
dosfslabel ${fs_dev}${p1} boot
|