if [ "$min_free_space" -lt "$free_space" ]; then
echo "initrd: found more than 10% free space on disk, resizing ${writable_part}" >/dev/kmsg || true
echo "initrd: partition to full disk size, see ${logfile} for details" >/dev/kmsg || true
# grow our selected partition to max space available
echo ", +"|/sbin/sfdisk -N $partition $device >>$logfile 2>&1
# make sure we re read the partition table in any case
/sbin/blockdev --rereadpt $device >>$logfile 2>&1
# check the filesystem before attempting re-size
/sbin/e2fsck -fy $writable_part >>$logfile 2>&1
# resize the filesystem to full size of the partition
/sbin/resize2fs -f $writable_part >>$logfile 2>&1
fi