armbian-build/scripts/resize2fs

28 lines
777 B
Plaintext
Raw Normal View History

#!/bin/bash
2014-10-08 05:39:24 +00:00
### BEGIN INIT INFO
# Provides: resize2fs
# Required-Start: $local_fs
# Required-Stop:
# Should-Start:
2014-10-12 07:26:41 +00:00
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Resize the root filesystem to fill whole rootfs partition
2014-10-08 05:39:24 +00:00
# Description:
### END INIT INFO
case "$1" in
start)
2017-01-14 20:35:53 +00:00
local rootpart=$(findmnt -n -o SOURCE /) # i.e. /dev/mmcblk0p1
2014-10-08 05:39:24 +00:00
# if ext4 and rootfs should be resized then do it
2017-01-14 20:35:53 +00:00
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
2017-01-14 20:35:53 +00:00
/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
;;
2014-10-08 05:39:24 +00:00
esac