Last try to fix partition resize in firstrun script

This commit is contained in:
ThomasKaiser 2016-06-08 23:30:58 +02:00
parent 2ff6fc6819
commit 8fa2471e8c

View file

@ -202,11 +202,17 @@ do_expand_rootfs() {
# Start resizing
echo -e "\n### [firstrun] ${ResizeLog}. Start resizing Partition now:\n" >>${Log}
cat /proc/partitions >>${Log}
echo -e "\nAnd then:\n" >>${Log}
((echo d; echo $PARTITIONS; echo n; echo p; echo ; echo $STARTFROM; echo ${LASTSECTOR} ; echo w;) | fdisk ${DEVICE}) >/dev/null || true
echo -e "\nExecuting fdisk, fsck and partprobe:\n" >>${Log}
if [ "X${DISTRIBUTION}" = "Xxenial" -a "X${PARTITIONS}" = "X1" ]; then
((echo d; echo n; echo p; echo ; echo $STARTFROM; echo ${LASTSECTOR} ; echo w;) | fdisk ${DEVICE}) >>${Log} 2>&1 || true
else
((echo d; echo $PARTITIONS; echo n; echo p; echo ; echo $STARTFROM; echo ${LASTSECTOR} ; echo w;) | fdisk ${DEVICE}) >>${Log} 2>&1 || true
fi
echo -e "\nNew partition table:\n" >>${Log}
s=0
fsck -f $root_partition >/dev/null 2>&1 || true
partprobe ${DEVICE} >/dev/null 2>&1 || s=$?
fsck -f $root_partition >>${Log} ll 2>&1 || true
partprobe ${DEVICE} >>${Log} ll 2>&1 || s=$?
echo -e "\nNew partition table:\n" >>${Log}
cat /proc/partitions >>${Log}
echo -e "\nNow executing resize2fs to enlarge ${root_partition} to the maximum\n:" >>${Log}
resize2fs $root_partition >>${Log} 2>&1 || true