nanobsd disk usage display

Nick Hibma nick at van-laarhoven.org
Thu Jun 18 12:05:17 UTC 2009


We use an extra function to display the amount of free space on the image. 
But it is not entirely accurate:

disk_usage () {
        sync; sync; sync

        set -- `du -sk $NANO_WORLDDIR/`
        used=$1
        set -- `ls -sk $NANO_DISKIMGDIR/_.disk.image`
        size=$1

        avail=$(( $size - $used ))
        availp=$(( ${avail}00 / $size))
        pprint 1 "disk usage: $used of $size used, $avail available 
($availp%)"
}

last_orders () {
        disk_usage
}

Shall I commit this or does anyone have a better idea on how to do this?

Nick

-------------------------------------------------------


More information about the freebsd-embedded mailing list