Russ,
Thanks for reviewing it. I can see now that there were a few spots that I may
have rushed through without thinking of optimizations. Some of the changes you
made were simply style preferences. The overall script wasn't changed. For
those of you interested, here are the differences:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--- grow_sd 2010-06-16 09:45:42.000000000 -0700
+++ ../home/derek/public_html/Grow_SD_Card/grow_sd 2010-05-07
17:07:52.367938274 -0700
@@ -23,7 +23,7 @@
# a 2GB SD card in both JFS and EXT3 filesystem formats.
# CHECK FOR ROOT ACCESS
-if [ `id -u` -ne 0 ]; then
+if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@@ -40,8 +40,8 @@
# CHECK DISK AND PARTITIONS
if [ -e $1 ]; then
DISK=$1
- NUMBER=`fdisk -l $DISK | grep 83 | tail -1 | awk '{print $1}' | sed
"s,$DISK,,g"`
- if [ ! -e ${DISK}$NUMBER ]; then
+ NUMBER=`fdisk -l $DISK | grep 83 | awk '{print $1}' | sed "s,$DISK,,g"`
+ if [ -e $NUMBER ]; then
echo "Valid TS partition not found!"
echo "Exiting"
exit 1
@@ -55,9 +55,8 @@
expand_sd(){
mkdir /mnt/tmp 2> /dev/null
mount ${DISK}$NUMBER /mnt/tmp 2> /dev/null
- TYPE=`df -T /mnt/tmp | awk '{print $2}'`
+ TYPE=`df -T | grep ${DISK}$NUMBER | awk '{print $2}'`
umount ${DISK}$NUMBER 2> /dev/null
- rmdir /mnt/tmp 2> /dev/null
ORIG=`fdisk -l $DISK | grep ${DISK}$NUMBER | awk '{ print $3 }'`
SIZE=`fdisk -l $DISK | grep Disk | awk '{print $5}'`
@@ -84,7 +83,7 @@
echo "Systems customers. There are no guarantees or warranties. Please
backup"
echo "your data before running this. Also, keep in mind that the JFS
filesystem"
echo "can grow, but cannot shrink again."
-echo -n "Do you wish to proceed <y or n>? "
+echo -e "Do you wish to proceed <y or n>? \c"
read WISH
if [ $WISH = "n" ] ; then
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Thanks again, Russ. Overall, have you (or anybody else reading this) found
this script to be useful?
Best Regards,
Derek Hildreth
Embedded Systems Engineer
Technologic Systems
--- In Russ Nelson <> wrote:
>
> Hi, Derek. I made a few changes to your script. I hope you think
> they're improvements. Feel free to share them with the mailing list.
>
>
> On Thu, 2010-05-27 at 00:52 +0000, Derek wrote:
> > Hello,
> >
> > Some of you might find this of use...
> >
> > I have recently taken some time to create a script that will automatically
> > expand the fourth partition of a Technologic Systems SD card to take up the
> > full capacity of your SD card (works with JFS and EXT3).
> >
> > For example, say you have the 512MB SD image for a TS-7350 or TS-7800 and
> > you have just imaged a 4GB SD card with it. Now, you want to take
> > advantage of the additional 3.5GB for Debian. Simply run this script like
> > "grow_sd /dev/sdb" (assuming /dev/sdb is the device node where your SD
> > card was enumerated; use "fdisk -l" to find out) and the script will do it
> > for you.
> >
> > You can download this script here (may need to "right-click -> save target
> > as..." to download):
> >
> > http://oz.embeddedarm.com/~derek/Grow_SD_Card/grow_sd
> >
> > I tested it out on a couple of different cards (both jfs and ext3) with
> > success. Just remember to back up your data. This script doesn't come
> > with any sort of warranty. ;)
> >
> > Be sure to check out the comments within the script for more information.
> >
> > Best Regards,
> > Derek Hildreth
> > Embedded Systems Engineer
> > Technologic Systems
> >
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|