[clue-tech] increase root part after install?

Mike Bean beandaemon at gmail.com
Tue Nov 30 12:55:55 MST 2010


The group told me once that I shouldn't ever have to reformat, made me think
to ask first.

I'm experimenting with some shell scripting and butting my head on 100% root
too often.  Think the 10GB I allocated is just too low.  What I'm not sure
about is how to redo it without reinstalling.  Currently I'm running 10G
root, 250mb boot, 4GB swap. 485 GB home.  I'll have to shrink the home, but
that will be fine.  I suspect...(blink), sorry, thinking about this as I
go.  Clearly I have to shrink home, so I'm backing it up now, but can I
mount more then one device to the same mount point?  I wonder if maybe I
could just mount more space to root.

Well, I guess, I'm asking for advice on the most efficient manner to
increase root.  Fundamentally, I don't particularly understand why my shell
script is causing root to run out of space either. It's a 6G laptop and the
files it compresses are sitting on the home partition.  To help illustrate,
here's the contents.

@fozzie:~/Dropbox/bin/scripts$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.2G  4.8G  4.0G  55% /
none                  2.9G  336K  2.9G   1% /dev
none                  2.9G  216K  2.9G   1% /dev/shm
none                  2.9G  344K  2.9G   1% /var/run
/dev/sda4             446G  120G  303G  29% /home


!/bin/sh

Z="compress"    gz="gzip"    bz="bzip2"
Zout="/tmp/bestcompress.$$.Z"
gzout="/tmp/bestcompress.$$.gz"
bzout="/tmp/bestcompress.$$.bz"
skipcompressed=1

if [ "$1" = "-a" ] ; then
    skipcompressed=0 ; shift
fi

if [ $# -eq 0 ]; then
    echo "Usage: $0 [-a] file or files to optimally compress" >&2; exit 1
fi

trap "/bin/rm -f $Zout $gzout $bzout" EXIT

for name
do
    if [ ! -f "$name" ] ; then
        echo "$0: file $name not found. Skipped." >&2
        continue
    fi

    if [ "$(echo $name | egrep '(\.Z$|\.gz$|\.bz2$)')" != "" ] ; then
        if [ $skipcompressed -eq 1 ] ; then
            echo "Skipped file ${name}: it's already compressed."
            continue
        else
            echo "warning: trying to 2x compress $name"
        fi
    fi

    $Z < "$name" > $Zout    &
    $gz < "$name" > $gzout    &
    $bz < "$name" > $bzout  &

    wait # run compressions in paralell for speed. wait until all are done

    smallest="$(ls -l "$name" $Zout $gzout $bzout | \
       awk '{print $5"="NR}' | sort -n | cut -d= -f2 | head -1)"

    case "$smallest" in
        1) echo "No space savings by compressing $name. Left as is."
        ;;
        2) echo Best compression is with compress. File renamed ${name}.Z
        mv $Zout "${name}.Z" ; rm -f "$name"
        ;;
        3) echo Best compression is with gzip. File renamed ${name}.gz
        mv $gzout "${name}.gz" ; rm -f "$name"
        ;;
        4) echo Best compression is with bzip2. File renamed ${name}.bz2
        mv $bzout "${name}.bz2" ; rm -f "$name"
    esac

done
exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue-tech/attachments/20101130/7213fbcc/attachment.html 


More information about the clue-tech mailing list