Return to fit2cf.sh CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / default |
1.1 misho 1: #!/bin/sh 2: # 3: # (C)`10 by Michael Pounov <misho@elwix.org> 4: # ELWIX grow disklabel sectors and fit-to-flash whole unused space 5: # 1.2 ! misho 6: # $Id: fit2cf.sh,v 1.1.1.1.24.3 2017/06/22 22:18:39 misho Exp $ 1.1 misho 7: # 8: 9: echo -n "++++ Check existence of fit2cf device ... " 10: if [ -c /dev/ufs/fit2cf ]; then 11: echo "OK" 12: exit 0 13: else 14: echo "Not found!" 15: fi 16: 17: if [ -z $1 ]; then 18: echo "Not specified disk drive ..." 19: exit 1 20: else 21: DEV=$(echo $1 | awk '{ 22: if (!($1 ~ /^\//)) 23: printf("/dev/%s", $1); 24: else 25: printf("%s", $1); 26: }') 27: if ! [ -c $DEV ]; then 28: echo "Wrong device $DEV !!!" 29: exit 1 30: fi 31: fi 32: 33: echo "Fit slice ${DEV}e to whole size of $DEV ..." 1.2 ! misho 34: DEVSIZE=`diskinfo $DEV | awk '{ printf("%d", $4); }'` ! 35: OLDSIZE=`disklabel $DEV | awk '($1 == "c:") { printf("%d", $2); }'` ! 36: disklabel $DEV 2>&- | awk -vdevsize=$DEVSIZE -voldsize=$OLDSIZE '($1 == "c:") { 1.1 misho 37: for (i = 1; i <= NF; i++) 38: printf("%s ", (i == 2) ? devsize : $i); 39: printf("\n"); 40: next; 41: } 42: ($1 == "a:") { 1.2 ! misho 43: printf("e: %d %d unused 0 0 0\n", devsize - oldsize, oldsize); 1.1 misho 44: } 45: { printf("%s\n", $0); }' >/tmp/disklabel.tmp 46: 47: sysctl kern.geom.debugflags=16 48: disklabel -R $DEV /tmp/disklabel.tmp 49: newfs -b8192 -f1024 -m0 -Lfit2cf ${DEV}e 50: sysctl kern.geom.debugflags=0 51: 52: rm -f /tmp/disklabel.tmp 53: echo 54: echo " Now will restart system to activate new schema !!!" 55: echo 1.2 ! misho 56: kill -2 1