########################################################################
# Begin $rc_base/init.d/fsresize
#
-# Description : Resize the /var filesystem
+# Description : Resize the root filesystem in the background
#
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
#
-# Version : 1.00
+# Version : 1.01
#
# Notes :
#
case "${1}" in
start)
- boot_mesg "Autoresize /var partition to use the whole drive ..."
-
- # Ensure that / is writeable
- mount
-
- # Detect device
- ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
- DRV=${ROOT::`expr length $ROOT`-1}
- boot_mesg " * check filesystem on ${DRV}4 before resize ..."
- fsck -f ${DRV}4
-
- boot_mesg " * resize ${DRV}4 ..."
- resize2fs -p ${DRV}4
- evaluate_retval
-
- # Erase symlink, it should run only once
- rm -f /etc/rc.d/rcsysinit.d/S26fsresize
-
- exit 0;
+ if [ -e "/.resizefs" ]; then
+ boot_mesg "Re-sizing root partition..."
+
+ # Find root device
+ while read -r dev mountpoint fs options; do
+ # Skip generic entries
+ [ "${dev}" = "rootfs" ] && continue
+
+ if [ "${mountpoint}" = "/" ]; then
+ # Resize filesystem
+ resize2fs -p "${dev}"
+
+ # Remove marker
+ rm -f /.resizefs
+ break
+ fi
+ done < /proc/mounts
+ fi
;;
+
*)
echo "Usage: ${0} {start}"
exit 1