BIG HONKING DISCLAIMER: I have ONLY tested this on my own personal Kindle Fire. There is some very real potential that you could render your system unbootable if you're not careful, so if you want to try this or something similar, please BE CAREFUL, and please don't try to hold me responsible if something gets messed up. You've been fairly warned! You also stand the chance of losing your data partition by doing this. If you have anything you don't want to lose, please make a backup of some sort. That being said, as long as you're careful when doing this it should be fairly safe and you shouldn't lose your data, either.
1.1 Installing a custom bootloader (FIREFIREFIRE)
Strictly speaking, this is somewhat "optional", but it makes things a whole lot easier. I strongly suggest that you head on over to pokey9000's thread and install his custom bootloader. Not only will this get you into recovery much more easily, but it will give you access to fastboot on every boot up (which will be very helpful if something goes wrong). I won't repeat the installation instructions here, just head over there and follow the instructions!
1.2 Installing a custom recovery (ClockworkMod)
The second thing you'll need is ClockworkMod recovery. Again, the heavy lifting is mostly done, and you can jump over to JackpotCalvin's installation and info thread to get it. Don't worry about the fact that you can't navigate the recovery menu - we won't be using that. The only purpose of the recovery is that it gives us an environment to safely work in with the /data and /cache partitions unmounted (i.e. not being used).
1.3 Root your Kindle Fire
You could do most of this (maybe all of the partitioning, in fact) without rooting, but at best you would lose everything on your /data partition. I'm not even positive if you could do the partitioning without root since...well, I was already rooted when I tried this. In any case, head over to this thread, get SuperOneClick, and root your KF. You'll be voiding your warranty by doing the rest of this anyway
1.4 ADB connection
Make sure you have ADB set up on your computer. You can follow the rooting guide to get this working. You can't do anything else in this post without working ADB.
1.5 (Optional) The parted and e2fsprogs binaries
This is somewhat optional since CWM has the utilities you need already, but it's not a bad idea to have a backup copy of the parted utility and the various e2fsprogs binaries (e2fsck, tune2fs, etc). You can grab this zip file and set it aside somewhere in case you need it. Here is the documentation for parted (applies to both the CWM binaries and the standalone ones).
2. Repartitioning your device
2.1 Backup your data
I cannot stress this enough: backup anything you don't want to lose. And don't just back it up to the external storage, either - move it to your computer or dropbox or something. I also highly recommend following the instructions in the FIREFIREFIRE thread to pull images of your various partitions in their current layout, in case you need to restore through fastboot (or you need them later down the line). Backing up your external data is as simple as copying it to your computer. To backup your /data partition, you can do the following:
C:\> adb shell $ su # cd /data # tar -cvpzf /sdcard/data.tar.gz .
Once you've backed up everything you want, reboot your Kindle by turning off and back on again. You should land at the FIREFIREFIRE bootloader (a yellow triangle with a flame in it). When you see the bootloader come up, press the power button (I had to hold it for a few seconds) to boot into ClockworkMod.
3.1 External storage (/sdcard)
Time for the fun part
Use adb to shell into your device, and then run 'mount' with no parameters to see what's already mounted. You should see /cache has been mounted, and since we'll be moving it later we'll go ahead and unmount it now:
C:\> adb shell ~ # umount /cache
~ # parted /dev/block/mmcblk0 GNU Parted 220.127.116.11.179-aef3 Using /dev/block/mmcblk0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print print print Model: MMC M8G2FA (sd/mmc) Disk /dev/block/mmcblk0: 7734MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 131kB 262kB 131kB xloader 2 262kB 524kB 262kB bootloader 3 524kB 11.0MB 10.5MB dkernel 4 11.0MB 212MB 201MB ext4 dfs 5 212MB 229MB 16.8MB recovery 6 229MB 296MB 67.1MB ext4 backup 7 296MB 307MB 10.5MB boot 8 307MB 312MB 5243kB ext4 splash 9 312MB 849MB 537MB ext4 system 10 849MB 2041MB 1192MB ext4 userdata 11 2041MB 2309MB 268MB ext4 cache 12 2309MB 7690MB 5381MB fat32 media msftres (parted)
Now you can go ahead and resize your external partition, which is block 12 ("media"). Make sure you don't try to make it smaller than its contents, or else it will probably error out. For example, if you have 2 GB of music on your /sdcard storage, you won't want to shrink it to 1 GB. What you want to do to shrink the partition is increase the start value. If you were looking at this graphically, it would be equivalent to moving the start of the partition to the right. So, for example, I moved the start of my external partition from the default 2309 to 5809 (5809 - 2309 = 3500, so I made it 3.5 GB smaller). You can choose whatever size you want, and then set it like this:
(parted) resize 12 5809 7690
3.2 The /cache partition
Since data is partition 10, cache is 11, and media is 12, we now have a gap between the end of cache and the beginning of media. In order to expand the data partition to fill that gap, we need to move the cache partition so that it is next to media again. Unfortunately, parted doesn't support moving an ext4 partition, so we have to make some magic happen first. Basically, we're going to erase the current cache partition, create a new one that is ext2 in the proper spot, and then "upgrade" it to an ext4 partition.
To erase the cache partition (which will erase /cache's data - no big deal), do the following in parted:
(parted) rm 11 (parted) mkpartfs primary ext2 <begin> <end> (parted) name 11 cache
(parted) quit ~ # tune2fs -j /dev/block/mmcblk0p11 ~ # e2fsck -fDp /dev/block/mmcblk0p11 ~ # tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p11 ~ # e2fsck -fDp /dev/block/mmcblk0p11
~ # e2fsck -fD /dev/block/mmcblk0p11
3.3. The userdata partition (/data)
The last thing we need to do is expand the userdata partition to use up the space we freed up by shrinking media. Once again, since we can't resize an ext4 partition directly, we're going to have to delete it, re-create it as an ext2 partition, and then "upgrade" it.
STOP. DO NOT PASS GO. DO NOT COLLECT $200
This will wipe your /data partition. Double check to make sure you have a copy of your backed up data, because it's going to be gone after this.
~ # parted /dev/block/mmcblk0 (parted) rm 10 (parted) mkpartfs primary ext2 849 <end> (parted) name 10 userdata
(parted) quit ~ # tune2fs -j /dev/block/mmcblk0p10 ~ # e2fsck -fDp /dev/block/mmcblk0p10 ~ # tune2fs extents,uninit_bg,dir_index /dev/block/mmcblk0p10 ~ # e2fsck -fDp /dev/block/mmcblk0p10
# parted /dev/block/mmcblk0 parted /dev/block/mmcblk0 GNU Parted 18.104.22.168.179-aef3 Using /dev/block/mmcblk0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print print print Model: MMC M8G2FA (sd/mmc) Disk /dev/block/mmcblk0: 7734MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 131kB 262kB 131kB xloader 2 262kB 524kB 262kB bootloader 3 524kB 11.0MB 10.5MB dkernel 4 11.0MB 212MB 201MB ext4 dfs 5 212MB 229MB 16.8MB recovery 6 229MB 296MB 67.1MB ext4 backup 7 296MB 307MB 10.5MB boot 8 307MB 312MB 5243kB ext4 splash 9 312MB 849MB 537MB ext4 system 10 849MB 5541MB 4692MB ext4 userdata 11 5541MB 5809MB 268MB ext4 cache 12 5809MB 7690MB 1881MB fat32 media msftres
4. Restoring your data from the archive
Don't reboot your Kindle Fire yet! Remember the data we backed up earlier into the data.tar.gz archive? Now we need to restore it to your nice new data partition. First mount your /data partition so you can get at it from the recovery shell:
~ # mount /dev/block/mmcblk0p10 /data
C:\> adb push /path/to/data.tar.gz /data
~ # cd /data /data # tar -xvpzf data.tar.gz /data # rm data.tar.gz /data # reboot
Just want to give a quick thanks to JackpotCalvin and pokey9000 for CWM and the custom bootloader, since I obviously needed those to make this happen. Also thanks to all the other devs working on the KF for all the great work so far!
If something doesn't work, feel free to drop a reply here. I'll see what I can do to help, but bear in mind that this is intended to be for power users or extreme tweakers. I'd definitely be interested in hearing some success stories if anybody else decides to give this a try.
I also want to add a shoutout/plug for the Android Enthusiasts website, hosted by StackExchange. It's a Q&A site dedicated to power users of Android devices. Stop by if you have a question, I'm always hanging around!