Mike,<div><br></div><div> 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.</div>
<div><br></div><div>You can skip all of the headaches and just change the location of the scratch directory so that everything is written into /home</div><div><br></div><div><br></div><div>change the following: </div><div>
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Zout="/tmp/bestcompress.$$.Z"<br>gzout="/tmp/bestcompress.$$.gz"<br>bzout="/tmp/bestcompress.$$.bz"</span><br>
<br></div><div>to:</div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Zout="~/tmp/bestcompress.$$.Z"<br>gzout="~/tmp/bestcompress.$$.gz"<br>
bzout="~/tmp/bestcompress.$$.bz"</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">and make sure to create a directory named tmp in your home directory.</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font><div class="gmail_quote">On Tue, Nov 30, 2010 at 12:55 PM, Mike Bean <span dir="ltr"><<a href="mailto:beandaemon@gmail.com">beandaemon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The group told me once that I shouldn't ever have to reformat, made me think to ask first.<br><br>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.<br>
<br>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. <br>
<br>@fozzie:~/Dropbox/bin/scripts$ df -h<br>Filesystem Size Used Avail Use% Mounted on<br>/dev/sda1 9.2G 4.8G 4.0G 55% /<br>none 2.9G 336K 2.9G 1% /dev<br>none 2.9G 216K 2.9G 1% /dev/shm<br>
none 2.9G 344K 2.9G 1% /var/run<br>/dev/sda4 446G 120G 303G 29% /home<br><br><br>!/bin/sh<br><br>Z="compress" gz="gzip" bz="bzip2"<br>Zout="/tmp/bestcompress.$$.Z"<br>
gzout="/tmp/bestcompress.$$.gz"<br>bzout="/tmp/bestcompress.$$.bz"<br>skipcompressed=1<br><br>if [ "$1" = "-a" ] ; then<br> skipcompressed=0 ; shift<br>fi<br><br>if [ $# -eq 0 ]; then<br>
echo "Usage: $0 [-a] file or files to optimally compress" >&2; exit 1<br>fi<br><br>trap "/bin/rm -f $Zout $gzout $bzout" EXIT<br><br>for name<br>do<br> if [ ! -f "$name" ] ; then<br>
echo "$0: file $name not found. Skipped." >&2<br> continue<br> fi<br> <br> if [ "$(echo $name | egrep '(\.Z$|\.gz$|\.bz2$)')" != "" ] ; then<br> if [ $skipcompressed -eq 1 ] ; then<br>
echo "Skipped file ${name}: it's already compressed."<br> continue<br> else<br> echo "warning: trying to 2x compress $name"<br> fi<br> fi<br> <br>
$Z < "$name" > $Zout &<br> $gz < "$name" > $gzout & <br> $bz < "$name" > $bzout &<br><br> wait # run compressions in paralell for speed. wait until all are done<br>
<br> smallest="$(ls -l "$name" $Zout $gzout $bzout | \<br> awk '{print $5"="NR}' | sort -n | cut -d= -f2 | head -1)"<br><br> case "$smallest" in<br> 1) echo "No space savings by compressing $name. Left as is."<br>
;;<br> 2) echo Best compression is with compress. File renamed ${name}.Z<br> mv $Zout "${name}.Z" ; rm -f "$name"<br> ;;<br> 3) echo Best compression is with gzip. File renamed ${name}.gz<br>
mv $gzout "${name}.gz" ; rm -f "$name"<br> ;;<br> 4) echo Best compression is with bzip2. File renamed ${name}.bz2<br> mv $bzout "${name}.bz2" ; rm -f "$name"<br>
esac<br><br>done<br>exit 0<br>
<br>_______________________________________________<br>
clue-tech mailing list<br>
<a href="mailto:clue-tech@cluedenver.org">clue-tech@cluedenver.org</a><br>
<a href="http://cluedenver.org/mailman/listinfo/clue-tech" target="_blank">http://cluedenver.org/mailman/listinfo/clue-tech</a><br></blockquote></div><br></div>