[G1 Android Development] BrooklynAvi:
XDA user supremeteam256 has written an excellent tutorial on How to Partition SD Card with Ubuntu for Dummies. After reading the tutorial, I asked whether it was possible to repartition an SD card using GParted in Ubuntu without losing any existing data on my ext2 or fat32 partitions (I was not, however, as concerned with my fat32 because it is easily backed up). My goal was to add a linux-swap partition after my existing ext2 partition. Specifically, I wanted to steal 64MB from my ext2 partition and reallocate it to a newly created linux-swap. So, I decided to be the guinea pig and risk losing my data for a greater cause. Well, I didn't end up losing data on either of my partition on either of my phones. I have successfully done this three times--on two G1s and a myTouch.

WARNING: While this worked for me it may not work for you. I am NOT responsible for any and all loss of data that might occur from this process. Proceed at your own risk and ALWAYS back up your SD card before trying this.

Prerequisites

I HIGHLY recommend you first read the tutorial mentioned at the beginning of this post so that you are familiar with installing Ubuntu and using GParted. This tutorial assumes that you have a working version of Ubuntu (I am using version 9.04) on your machine.

Ubuntu

SD Card

Card Reader

Step 1

Open up GParted by clicking System > Administration > Partition Editor. From the drop down menu on the top right-hand side of the GParted screen, selected your SD card. Make sure you select your SD card and NOT your hard drive. You are on your own if you make a mistake here. For this example, I am using a 2GB SD card. Yours may differ so proceed accordingly.

Figure 1: Selecting Your SD Card

Step 2

Once your SD card is selected, right click on each partition and select "Unmount" from the list.

Figure 2: Unmounting Each Partition

Step 3

Once you have unmounted each partition, right click on the ext2/3/4 partition on select "Resize/Move" from the list.

Figure 3: Resizing the ext2 Partition

Step 4

In the dialog box that opens, subtract the number of MB from using the down arrow button on the "New Size (MiB)" box. I would like a 64MB linux-swap partition. My SD card is 500MB (Figure 4) so I will click the down button until the "Free Space Following (MiB)" box reads 64 (Figure 5). An important step is to make sure that the box that reads "Round to cylinders" is UNchecked. This is so there is not partition in between the ext2/3//4 partition and the linux-swap since they must be in order (fat32, ext2/3/4, linux-swap). Once you have resized your partition tot he desired amount, click "Resize/Move."

Figure 4: Resize Dialog Box at 500MB

Figure 5: Resize Dialog Box Resized

Step 5

Next, create the linux-swap partition by right-clicking on the unallocated space that you have just taken from your ext2/3/4 partition and select "New" from the list.

Figure 6: Creating a New Partition

Step 6

The dialog box that opens will be similar to the resize dialog box you used in Step 4. In the "New Size (MiB)" box, enter the number of MB you would like your linux-swap partition to be. Then, select "linux-swap" from the "File System" drop-down menu. Make sure that "Primary Partition" is selected from the "Create as" menu. Again, make sure the "Round to cylinders" box is UNchecked. Once done, click "Add."

Figure 7: Selecting the Size of your New Partition

Step 7

Back in the main GParted screen, click "Apply" from the toolbar to apply the changes.

Figure 8: Applying the Changes

Step 8

When asked if you wish to continue, confirm your changes by clicking "Apply."

Figure 9: Confirm Your Changes

Figure 10: Watch Your Progress

Step 9

You should end up with something similar to what you see in Figure 10.

Figure 11: The Result

If you have any questions regarding this process, feel free to post them here. I don't know how much help I'll be as this is not my expertise but I'll do my best to answer what I can. I have learned, however, that there is always someone on the board who seems to have an answer for most questions. So ask away.