[clue-tech] increase root part after install?

Will will.sterling at gmail.com
Tue Nov 30 13:09:07 MST 2010


Mike,

  It is filling your root partition because it is compressing the file three
times and writing the compressed file to /tmp before deciding which one is
smallest and coping the smallest file to the directory the original file
was located in.

You can skip all of the headaches and just change the location of the
scratch directory so that everything is written into /home


change the following:
Zout="/tmp/bestcompress.$$.Z"
gzout="/tmp/bestcompress.$$.gz"
bzout="/tmp/bestcompress.$$.bz"

to:
Zout="~/tmp/bestcompress.$$.Z"
gzout="~/tmp/bestcompress.$$.gz"
bzout="~/tmp/bestcompress.$$.bz"

and make sure to create a directory named tmp in your home directory.

On Tue, Nov 30, 2010 at 12:55 PM, Mike Bean <beandaemon at gmail.com> wrote:

> 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
>
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue-tech/attachments/20101130/dc22d86a/attachment.html 


More information about the clue-tech mailing list