armbian-build/scripts/resize2fs
2017-01-14 23:35:53 +03:00

28 lines
777 B
Bash

#!/bin/bash
### BEGIN INIT INFO
# Provides: resize2fs
# Required-Start: $local_fs
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Resize the root filesystem to fill whole rootfs partition
# Description:
### END INIT INFO
case "$1" in
start)
local rootpart=$(findmnt -n -o SOURCE /) # i.e. /dev/mmcblk0p1
# if ext4 and rootfs should be resized then do it
if [[ $(findmnt -n -o FSTYPE /) == ext4 && ! -f /root/.no_rootfs_resize ]]; then
echo -e "\n### [resize2fs] Start resizing partition now\n" >>/var/log/armhwinfo.log
/sbin/resize2fs $rootpart >>/var/log/armhwinfo.log 2>&1
fi
# disable further executions of this script
update-rc.d -f resize2fs remove >/dev/null 2>&1
;;
esac