7d4d3c78be
The persistent backup partition will be resized if it's detected to be smaller than it should be. Story: 2007403 Task: 39548 Change-Id: I6809a7c3a8363c8ee7f26bc9c8d61ed97451d29d Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com>
96 lines
3.4 KiB
INI
Executable File
96 lines
3.4 KiB
INI
Executable File
|
|
## NOTE: updates to partition sizes need to be also reflected in
|
|
## _controller_filesystem_limits() in sysinv/api/controllers/v1/istorconfig.py
|
|
|
|
ROOTFS_SIZE=20000
|
|
LOG_VOL_SIZE=8000
|
|
SCRATCH_VOL_SIZE=8000
|
|
PLATFORM_BACKUP_SIZE=10000
|
|
BOOT_SIZE=500
|
|
EFI_SIZE=300
|
|
|
|
ROOTFS_OPTIONS="defaults"
|
|
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
|
|
if [ -n "$profile_mode" ]; then
|
|
# Enable iversion labelling for rootfs when IMA is enabled
|
|
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
|
|
fi
|
|
|
|
if [ -d /sys/firmware/efi ] ; then
|
|
BACKUP_PART=${ROOTFS_PART_PREFIX}1
|
|
BACKUP_PART_NO=1
|
|
START_POINT=1
|
|
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
|
BACKUP_END_POINT=$END_POINT
|
|
if [ $BACKUP_CREATED -eq 0 ] ; then
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
fi
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $EFI_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary fat32 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /boot/efi --fstype=efi --onpart=${ROOTFS_PART_PREFIX}2
|
|
EOF
|
|
else
|
|
BACKUP_PART=${ROOTFS_PART_PREFIX}2
|
|
BACKUP_PART_NO=2
|
|
parted -s $ROOTFS_DISK mkpart primary 1MiB 2MiB
|
|
|
|
START_POINT=2
|
|
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
|
BACKUP_END_POINT=$END_POINT
|
|
if [ $BACKUP_CREATED -eq 0 ] ; then
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
fi
|
|
cat<<EOF>>/tmp/part-include
|
|
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
|
EOF
|
|
fi
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $BOOT_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $ROOTFS_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
START_POINT=$END_POINT
|
|
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB 100%
|
|
|
|
if [ $BACKUP_CREATED -ne 0 ] ; then
|
|
BACKUP_CURRENT_SIZE=$(parted -s $BACKUP_PART unit MiB print | grep $BACKUP_PART | awk '{print $3}' | sed 's/[^C0-9]*//g')
|
|
if [ $BACKUP_CURRENT_SIZE -lt $PLATFORM_BACKUP_SIZE ] ; then
|
|
# parted will throw an error about overlapping with the next partition if we don't do this
|
|
BACKUP_END_POINT=$(($BACKUP_END_POINT - 1)).9
|
|
parted -s $ROOTFS_DISK resizepart $BACKUP_PART_NO ${BACKUP_END_POINT}MiB
|
|
e2fsck -p -f $BACKUP_PART
|
|
resize2fs $BACKUP_PART
|
|
fi
|
|
cat<<EOF>>/tmp/part-include
|
|
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
else
|
|
cat<<EOF>/tmp/backup-guid-change.sh
|
|
flock $ROOTFS_DISK sgdisk --change-name=${BACKUP_PART_NO}:"${BACKUP_PART_LABEL}" --typecode=${BACKUP_PART_NO}:"${BACKUP_PART_GUID}" $ROOTFS_DISK
|
|
EOF
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /opt/platform-backup --fstype=ext4 --asprimary --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
fi
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /boot --fstype=ext4 --asprimary --onpart=${ROOTFS_PART_PREFIX}3 --fsoptions="$ROOTFS_OPTIONS"
|
|
part pv.253004 --onpart=${ROOTFS_PART_PREFIX}5
|
|
volgroup cgts-vg --pesize=32768 pv.253004
|
|
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
|
|
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
|
|
part / --fstype=ext4 --asprimary --onpart=${ROOTFS_PART_PREFIX}4 --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
|
|
%end
|
|
|