Persistent backup partition resizing
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>
This commit is contained in:
parent
24499f8f25
commit
7d4d3c78be
@ -117,7 +117,10 @@ if [ -d /sys/firmware/efi ] ; then
|
|||||||
BACKUP_PART_NO=1
|
BACKUP_PART_NO=1
|
||||||
START_POINT=1
|
START_POINT=1
|
||||||
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
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
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
||||||
|
fi
|
||||||
|
|
||||||
START_POINT=$END_POINT
|
START_POINT=$END_POINT
|
||||||
END_POINT=$(($START_POINT + $EFI_SIZE))
|
END_POINT=$(($START_POINT + $EFI_SIZE))
|
||||||
@ -133,8 +136,10 @@ else
|
|||||||
|
|
||||||
START_POINT=2
|
START_POINT=2
|
||||||
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
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
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
||||||
|
fi
|
||||||
cat<<EOF>>/tmp/part-include
|
cat<<EOF>>/tmp/part-include
|
||||||
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
||||||
EOF
|
EOF
|
||||||
@ -153,6 +158,14 @@ END_POINT=$(($START_POINT + $CGCS_PV_SIZE))
|
|||||||
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB ${END_POINT}MiB
|
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB ${END_POINT}MiB
|
||||||
|
|
||||||
if [ $BACKUP_CREATED -ne 0 ] ; then
|
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
|
cat<<EOF>>/tmp/part-include
|
||||||
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
||||||
EOF
|
EOF
|
||||||
|
@ -21,7 +21,10 @@ if [ -d /sys/firmware/efi ] ; then
|
|||||||
BACKUP_PART_NO=1
|
BACKUP_PART_NO=1
|
||||||
START_POINT=1
|
START_POINT=1
|
||||||
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
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
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
||||||
|
fi
|
||||||
|
|
||||||
START_POINT=$END_POINT
|
START_POINT=$END_POINT
|
||||||
END_POINT=$(($START_POINT + $EFI_SIZE))
|
END_POINT=$(($START_POINT + $EFI_SIZE))
|
||||||
@ -37,8 +40,10 @@ else
|
|||||||
|
|
||||||
START_POINT=2
|
START_POINT=2
|
||||||
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
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
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
||||||
|
fi
|
||||||
cat<<EOF>>/tmp/part-include
|
cat<<EOF>>/tmp/part-include
|
||||||
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
||||||
EOF
|
EOF
|
||||||
@ -56,6 +61,14 @@ START_POINT=$END_POINT
|
|||||||
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB 100%
|
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB 100%
|
||||||
|
|
||||||
if [ $BACKUP_CREATED -ne 0 ] ; then
|
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
|
cat<<EOF>>/tmp/part-include
|
||||||
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user