Date: Wed, 03 Nov 2010 19:54:58 -0000 From: Nick Hibma <nick@van-laarhoven.org> To: Warner Losh <imp@village.org> Subject: NanoBSD: Disk usage function to check how full the image is Message-ID: <B084FCBC-46EF-4CAF-8EA9-0BA30C1FDEBC@van-laarhoven.org> Resent-Message-ID: <20101103195457.DA875106564A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
As part of the last_orders() function we use an aditional function which = produces information on the amount of disk space used on the image (so I = can make sure they are no more than 80% full when burnt). (run_finalise is run_customize but from last_orders; not used very much = by us). Feel free to include this function in nanobsd.sh if someone feels like = it. Nick disk_usage () { = =20 sync; sync; sync = =20 set -- `du -sk $NANO_WORLDDIR/` = =20 used=3D$1 = =20 set -- `ls -sk $NANO_DISKIMGDIR/_.disk.image` = =20 size=3D$1 = =20 avail=3D$(( $size - $used )) = =20 availp=3D$(( ${avail}00 / $size)) = =20 pprint 1 "disk usage: $used of $size used, $avail available = ($availp%)" =20 } = =20 last_orders () { = =20 if test -f ${NANO_DISKIMGDIR}/_.disk.image; then = =20 run_finalise = =20 disk_usage = =20 fi = =20 } = =20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B084FCBC-46EF-4CAF-8EA9-0BA30C1FDEBC>