Partitioning the filesystem on Android

RyanZA picture RyanZA · Sep 6, 2010 · Viewed 8.5k times · Source

I'm trying to re-partition an SDCard on Android, with root access.

I have the 512 byte MBR file, and it shows up as this:

 Pos MBRndx Type/Name  Size Active Hide Start Sector   Sectors
 --- ------ ---------- ---- ------ ---- ------------ ------------
  0    0    0C-FAT32X  5.9G   No    No            64   12,124,096
  1    1    0C-FAT32X  1.9G   No    No    12,124,160    3,932,160

What I'm trying to do is resize the 5.9GB partition into 3GB, and then make an EXT partition with the remaining space. I can think of two ways to do this, but I'm a bit stumped in doing either of them:

1) Cross-compile GNU parted, and run it on Android to modify the filesystem in place. This would be my preferred method, but I've been trying to statically compile parted using scratchbox and haven't had much luck, and I haven't been able to dynamically compile for Android in scratchbox either.

2) Directly modify the 512 byte MBR using some utility on my computer, and then dd the file on Android. I have a tool to view the MBR (mbrwiz), but I don't know how to edit it.

Does anybody have any suggestions for either, or possibly a third route?

Answer

Dubu picture Dubu · Sep 6, 2010

Maybe I'm not seeing the problem, but it does not look like you want to automate this or make a program with that functionality. So, why not take the SD card out of the Android device and partition it in a card reader on your desktop machine? You could even do a full backup beforehand and avoid losing any data with the partitioning.