UPDATE August 05, 2010:
I added a tiny bit more verbosity in the error messages given. Also, I included another alternative line for determinig the last partition of the SD card using "ls -la $DISK*" instead of "fdisk -l $DISK". This was just in case "fdisk -l" output gives different output on different machines. If you're getting error messagse about "Valid T.S. partition not found!", try uncommenting the alternative line and commenting out the original line.
md5sum: d41961d8c3114cbcb4eea3a347ffc6b6
UPDATE June 16, 2010:
I'm not sure what happened, but for a while there a different, non-working version of the grow_sd script was published here. I have corrected it and made some changes/modifications/corrections to make it more robust. I tested it out on a 16GB SD card and it worked well. So, if you were having issues with the script before, or it just didn't work for you, give it another shot. It's actually a pretty neat script if I do say so myself. ;)
Again, you can download it here:
grow_sd.
md5sum: 189c9683b732cda13d5a6ab58d01fd0d
UPDATE May 07, 2010:
I had taken some time to create a script that will take care of all this
automatically (and without the gparted dependancy). It can be found here (right-click and "save link as" to download):
grow_sd.
Simply call it like grow_sd /dev/sdb and it will resize the
last partition to the end of the disk. It works with both JFS and EXT3 partitions. As always, backup your data!
This tutorial will walk you through how to use gparted to expand the fourth partition of a Technologic Systems image. Most commonly, this is desired when copying an image meant for a 512MB SD card to a larger SD card like 2GB and you want to take advantage of the full 2GB capacity.
You'll need administrative access to a Linux box and the USB SD card reader. Be sure that your SD card has been inserted into the Linux box and a terminal window is open and we'll get to it...
{content in brackets are comments not to be typed into the terminal}
{if running Debian based distro:}
su
{if running Red Hat based distro:}
su -
{if running Debian based distro:}
apt-get install gparted jfsutils
{if running Red Hat based distro:}
yum install gparted jfsutils
{This is assuming that your SD card is located at "/dev/sdb". Use 'fdisk -l'
to verify this location}
umount /dev/sdb*
{Verify that all partitions have been unmounted. The output should look like
the following if they are. If not, run the above command until all four are
listed as not mounted}
[root@DerekLinux ~]# umount /dev/sde*
umount: /dev/sde: not mounted
umount: /dev/sde1: not mounted
umount: /dev/sde2: not mounted
umount: /dev/sde3: not mounted
umount: /dev/sde4: not mounted
gparted
At this point, simply allow the gparted program to do its magic and you'll be finished.
If you have problems or errors, it's more than likely a corrupted partition. In this case, you'll need to run the following command:
jfs_fsck -f /dev/sdb4