Formatting sdcard into fat32 & linux for the LINUX savvy! - G1 Android Development

Ok I finally got a large SDCARD and browsed through all the tutorials on here pertaining to moving apps to sdcard and they all were either windows centric or required that the android build environment be installed.
I don't use windows and I don't have the android build environment loaded. I DO have Linux and a rooted phone. So here goes
Partitioning your sdcard into fat32/linux
What you'll need:
1) linux terminal
2) a micro sd card reader that you can connect to your computer
3) fdisk
From a terminal window as root, plug your sdcard into your computer. You can not do this while the sdcard is mounted, you only want it to be given a device node by linux so we can edit the partitions via fdisk.
So once you have it on connected, check what the device name is. For me 'dmesg' told me the device nodes name was /dev/sdc .
So using good ol FDISK we do the following:
1) fdisk /dev/sdc
2) proceed to delete all the partitions
3) hit 'n' to create a new partition. This will be a primary partition as large as you want it. Be sure and remember to leave some space for the linux partition we'll be creating.
4) Next create the linux partition by once again pressing 'n' and choosing primary partition
5) now we need to fix the system labels for the fat32 partition by pressing 't'
Select partition 1 and change it to HEX code 'c' which is WIN95 FAT32 (LBA)
6) Now that you have both partitions created go ahead and write them by pressing 'w'
Now we need to write a filesystem to the partitions
So you've created the partitions but they are raw with no filesystem. We need to format them to their respective filesystems.
Assuming your device node for the sdcard is /dev/sdc you will have the following partition layout
Device Boot Start End Blocks Id System
/dev/sdc1 1 1816 14586988+ c W95 FAT32 (LBA)
/dev/sdc2 1817 1949 1068322+ 83 Linux
Of course your start/end blocks will be different if you don't have a 16gb microsd card like me.
First we'll format the fat32 partition using the following command
mkfs.vfat /dev/sdc1
Next we'll format the linux partition to ext2. I've noticed a lot of people talk about ext2 as if its a partition type, ITS NOT. It's a filesystem type. It should be worded "Creating a fat32 & linux partition" not "Creating a fat32 & ext2 partition". Anyways, moving along we use the following command to format the linux partition to ext2
mkfs.ext2 /dev/sdc2
You're now ready to proceed to following the other guides for moving apps to the sdcard. If enough people request I can finish this to include actually moving the /data/app to /system/sd . Not really much to it. Anyways enjoy

Nice tutorial, but one thing. You mentioned the difference between a file system and a partition. While that is correct, do you see that knowledge making things easier or harder for the average user? Lots of times we simplify things so we dont have to explain stuff that the user need not know later.

shafty023 said:
Next we'll format the linux partition to ext2. I've noticed a lot of people talk about ext2 as if its a partition type, ITS NOT. It's a filesystem type. It should be worded "Creating a fat32 & linux partition" not "Creating a fat32 & ext2 partition". Anyways, moving along we use the following command to format the linux partition to ext2
mkfs.ext2 /dev/sdc2
Click to expand...
Click to collapse
And fat32 is a file system type and not what you refer to as a partition type either, what is your point? You are creating an ext2 (formatted) partition and a fat32 (formatted) partition. Semantics aside, call one a dos partition and one a linux partition if that would make you happy, either way you are creating two separate partitions and formatting one as fat32 and the other as ext2. What you call them, or how you label the partition type vs. file system, doesn't make you any smarter than anyone else.
The fact that you would take the effort to point out that ext2 is not a partition type, yet neglecting to point out the same about fat32, kind of makes you seem ignorant. I may sound like a prick, but I have had a few drinks tonight, and seriously...... if you took the time to say "fat32 and linux partition", it really seems as if you are trying to make other people look stupid.
I leave you with some "light" reading.
And... file systems.

Darkrift said:
Nice tutorial, but one thing. You mentioned the difference between a file system and a partition. While that is correct, do you see that knowledge making things easier or harder for the average user? Lots of times we simplify things so we dont have to explain stuff that the user need not know later.
Click to expand...
Click to collapse
Oh I completely understand and agree. It's just in my line of work I find that there's still some people that want to know and learn about the gritty details of whats going on. I figured there's plenty of other articles on here explaining things for the simpleminded, I wanted to create one article that actually explained the correct terms. Didn't mean it in any way as a put down to anyone else's tutorials that were in laments terms.

daveid said:
And fat32 is a file system type and not what you refer to as a partition type either, what is your point? You are creating an ext2 (formatted) partition and a fat32 (formatted) partition. Semantics aside, call one a dos partition and one a linux partition if that would make you happy, either way you are creating two separate partitions and formatting one as fat32 and the other as ext2. What you call them, or how you label the partition type vs. file system, doesn't make you any smarter than anyone else.
The fact that you would take the effort to point out that ext2 is not a partition type, yet neglecting to point out the same about fat32, kind of makes you seem ignorant. I may sound like a prick, but I have had a few drinks tonight, and seriously...... if you took the time to say "fat32 and linux partition", it really seems as if you are trying to make other people look stupid.
Click to expand...
Click to collapse
Please take the time to read my previous reply. And the reason I pointed out ext2 was a filesystem type and not for fat32 was no matter where someone in windows tries and creates a partition, either thru disk management or partition magic, it will present them with the option of creating a pre-formatted partition. This means they can create a fat16/fat32/ntfs partition. I doubt anyone can create a 200gb dos partition though I've never tried so won't state that as a fact. I know fat32 within windows limits to 180, then other apps like partition magic are able to utilize more. Only using fdisk are you presented with the option of over 80 different un-formatted partition types. Even in there they list fat32 but do not list ext2 or ext3.
And did you ever stop to think that perhaps some people actually thought ext2 was a partition? That maybe they'd hop into their partitioning tools looking for ext2? Then they'd come back looking all over xda for information why they can't find ext2 as a valid partition? Then they come across my lonely tutorial that explains they need to first format as Linux and then FORMAT as ext2? Did you think about that whilst you were ranting on about me being a prick? No you didn't. I was only trying to help and provide information without bringing anyone else down. Now, let's move past this and do what we're all here to do and that's help those who don't understand these technologies.

daveid said:
And fat32 is a file system type and not what you refer to as a partition type either, what is your point? You are creating an ext2 (formatted) partition and a fat32 (formatted) partition. Semantics aside, call one a dos partition and one a linux partition if that would make you happy, either way you are creating two separate partitions and formatting one as fat32 and the other as ext2. What you call them, or how you label the partition type vs. file system, doesn't make you any smarter than anyone else.
The fact that you would take the effort to point out that ext2 is not a partition type, yet neglecting to point out the same about fat32, kind of makes you seem ignorant. I may sound like a prick, but I have had a few drinks tonight, and seriously...... if you took the time to say "fat32 and linux partition", it really seems as if you are trying to make other people look stupid.
Please take the time to read my previous reply. And the reason I pointed out ext2 was a filesystem type and not for fat32 was no matter where someone in windows tries and creates a partition, either thru disk management or partition magic, it will present them with the option of creating a pre-formatted partition. This means they can create a fat16/fat32/ntfs partition. I doubt anyone can create a 200gb dos partition though I've never tried so won't state that as a fact. I know fat32 within windows limits to 180, then other apps like partition magic are able to utilize more. Only using fdisk are you presented with the option of over 80 different un-formatted partition types. Even in there they list fat32 but do not list ext2 or ext3.
And did you ever stop to think that perhaps some people actually thought ext2 was a partition? That maybe they'd hop into their partitioning tools looking for ext2? Then they'd come back looking all over xda for information why they can't find ext2 as a valid partition? Then they come across my lonely tutorial that explains they need to first partition as Linux and then FORMAT as ext2? Did you think about that whilst you were ranting on about me being a prick? No you didn't. I was only trying to help and provide information without bringing anyone else down. Now, let's move past this and do what we're all here to do and that's help those who don't understand these technologies.
Click to expand...
Click to collapse

shafty023 said:
Please take the time to read my previous reply. And the reason I pointed out ext2 was a filesystem type and not for fat32 was no matter where someone in windows tries and creates a partition, either thru disk management or partition magic, it will present them with the option of creating a pre-formatted partition. This means they can create a fat16/fat32/ntfs partition. I doubt anyone can create a 200gb dos partition though I've never tried so won't state that as a fact. I know fat32 within windows limits to 180, then other apps like partition magic are able to utilize more. Only using fdisk are you presented with the option of over 80 different un-formatted partition types. Even in there they list fat32 but do not list ext2 or ext3.
And did you ever stop to think that perhaps some people actually thought ext2 was a partition? That maybe they'd hop into their partitioning tools looking for ext2? Then they'd come back looking all over xda for information why they can't find ext2 as a valid partition? Then they come across my lonely tutorial that explains they need to first partition as Linux and then FORMAT as ext2? Did you think about that whilst you were ranting on about me being a prick? No you didn't. I was only trying to help and provide information without bringing anyone else down. Now, let's move past this and do what we're all here to do and that's help those who don't understand these technologies.
Click to expand...
Click to collapse
for someone who has never really posted on XDA before you're being a little testy .. not to mention the fact that the guy never called you a prick .. all technicalities aside let's be civil here .. if we need an all out discussion on the differences of linux and dos then feel free to move on to another forum .. because honestly i haven't seen much know-how here on either front
i'm sure the moderators would agree that bickering about OS's wastes effort for everyone

LucidREM said:
for someone who has never really posted on XDA before you're being a little testy .. not to mention the fact that the guy never called you a prick .. all technicalities aside let's be civil here .. if we need an all out discussion on the differences of linux and dos then feel free to move on to another forum .. because honestly i haven't seen much know-how here on either front
i'm sure the moderators would agree that bickering about OS's wastes effort for everyone
Click to expand...
Click to collapse
Agreed. I post heavily on linuxquestions so given that Android's os is linux it made sense to help out on here wherever possible. I was a little stoned when I responded to his message, lol. But anyways if anyone else stumbles on this tutorial feel free to msg me with questions.

shafty..thanks so much.
btw.
i have a few questions.
when setting up my new g1, should i have added the linux partition on the SDcard. if my goal is to use this SDcard for rooting purposes...
which leads to another question (why in tarnation is there a fat32 card on my g1 ?)
btw..
heres some screenshots of the flow...if yall want em.
the write up is perfect and this is the only way i could add to it...
if its too convoluted, i can re-do it with only the terminal screenshots
please disregard the terminals on the right...on the left is the report after typing dmesg, and you can see df -h was not the best choice
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
this highlight reports the found SD cards location for fdisk, and the su command. (yes, i really do have a password)
3rd step (don't laugh..u do it too) i typed the "p" and missed the enter, than tried to fix it with backspace, and i think i missed the delete button too..but enter works regardless as fdisk only sees the 1st entry.
4th i accidentally made the sbc1 a fat 12, and deleted it , remade it w/n and it went dutifully from linux to fat32, and you can see here, that i have more space to fill the rest with linux.
the "p" is for print...i learned long ago to always print before continuing..
5th here it how the end result should be reported after "p" ( in fdisk)
6th, 7th this is the 2 lines to actually formatting commands (and results)

well...
i poked around in the g1, and the card was "unreadable", and asked to "format " it..
so, sure. i hit ok.."format"..it did
then i checked my eterm again.
heres what i got (thinking my pc is right...the formatting is gone.
or
am i just being to much....i shouldn't be poking around the sdcard when i should be rooting it....(think i just answered myself)
is this the 1st step to getting root on my g1 ?? (the vfat32 thing)
and what am i missing ?
or, HOW is fdisk NOT finding ANY type of filesystem AFTER the G1 formats....
does the G1 format an invisible (or new) type of filesytem ?

I think that those drinks went to your head. There are a plethora of different partition "types". In actual fact, a partition is a partition no matter how you look at it, but the different types are an identification byte which can be used to show what type of system/partition type is responsible for or expected to be found within the partition. It helps to keep retards (like mswindoze) on track.
According to the reference YOU provided, fat32 *IS* a partition type. This is true. It is ALSO a filesystem type. I.e., you place a fat32 FILESYSTEM within a fat32 PARTITION.
Here is the list of partition types for your reference:
0 Empty
1 FAT12
2 XENIX root
3 XENIX usr
4 FAT16 <32M
5 Extended
6 FAT16
7 HPFS/NTFS
8 AIX
9 AIX bootable
a OS/2 Boot Manag
b W95 FAT32
c W95 FAT32 (LBA)
e W95 FAT16 (LBA)
f W95 Ext'd (LBA)
10 OPUS
11 Hidden FAT12
12 Compaq diagnost
14 Hidden FAT16 <3
16 Hidden FAT16
17 Hidden HPFS/NTF
18 AST SmartSleep
1b Hidden W95 FAT3
1c Hidden W95 FAT3
1e Hidden W95 FAT1
24 NEC DOS
39 Plan 9
3c PartitionMagic
40 Venix 80286
41 PPC PReP Boot
42 SFS
4d QNX4.x
4e QNX4.x 2nd part
4f QNX4.x 3rd part
50 OnTrack DM
51 OnTrack DM6 Aux
52 CP/M
53 OnTrack DM6 Aux
54 OnTrackDM6
55 EZ-Drive
56 Golden Bow
5c Priam Edisk
61 SpeedStor
63 GNU HURD or Sys
64 Novell Netware
65 Novell Netware
70 DiskSecure Mult
75 PC/IX
80 Old Minix
81 Minix / old Lin
82 Linux swap / So
83 Linux
84 OS/2 hidden C:
85 Linux extended
86 NTFS volume set
87 NTFS volume set
88 Linux plaintext
8e Linux LVM
93 Amoeba
94 Amoeba BBT
9f BSD/OS
a0 IBM Thinkpad hi
a5 FreeBSD
a6 OpenBSD
a7 NeXTSTEP
a8 Darwin UFS
a9 NetBSD
ab Darwin boot
b7 BSDI fs
b8 BSDI swap
bb Boot Wizard hid
be Solaris boot
bf Solaris
c1 DRDOS/sec (FAT-
c4 DRDOS/sec (FAT-
c6 DRDOS/sec (FAT-
c7 Syrinx
da Non-FS data
db CP/M / CTOS / .
de Dell Utility
df BootIt
e1 DOS access
e3 DOS R/O
e4 SpeedStor
eb BeOS fs
ee GPT
ef EFI (FAT-12/16/
f0 Linux/PA-RISC b
f1 SpeedStor
f4 SpeedStor
f2 DOS secondary
fb VMware VMFS
fc VMware VMKCORE
fd Linux raid auto
fe LANstep
ff BBT
Click to expand...
Click to collapse
daveid said:
And fat32 is a file system type and not what you refer to as a partition type either, what is your point? You are creating an ext2 (formatted) partition and a fat32 (formatted) partition. Semantics aside, call one a dos partition and one a linux partition if that would make you happy, either way you are creating two separate partitions and formatting one as fat32 and the other as ext2. What you call them, or how you label the partition type vs. file system, doesn't make you any smarter than anyone else.
The fact that you would take the effort to point out that ext2 is not a partition type, yet neglecting to point out the same about fat32, kind of makes you seem ignorant. I may sound like a prick, but I have had a few drinks tonight, and seriously...... if you took the time to say "fat32 and linux partition", it really seems as if you are trying to make other people look stupid.
I leave you with some "light" reading.
And... file systems.
Click to expand...
Click to collapse

i just made a typo...11 is fat 12..
but thats not the point...
i got through fdish fine (always was fond of fdisk)
everything looks great until this last point.
after i makefilesystem and i return to fdisk, ITS INVISIBLE...
i though fdisk would find it all.
what is happening, or is that normal ?

FAT32 is a partition-type (0x0B/0x0C), and so is Linux (0x83)...
FAT32 is also the filesystem that resides on FAT32 partitions most of the time, while linux-partition usually contains extNfs...
A question to the OP... Why would a "LINUX savvy" need a guide to partition and format a simple block-device?

why do we get the errors (not so savvy am i...but maybe the OP is)
heres the error i don't understand

You can't cd into a block device... You mount the filesystem to a directory, doing something like "mount -t filesystem /dev/sdc1 /mnt/sdc1" (filesystem is the filesystem on the block-device, like "vfat" for fat32, or "ext2" for ext2, and the directory "/mnt/sdc1" have to exist).
You're trying to write a partition-table to a partition... Bad idea!
You're doing it right in the low-res full-screen photo, though... Why are you redoing it wrong?
<Actually i made a weird conclusion here before, as a direct result of too little sleep... But to look less like an idiot, i removed it >
For the not so Unix-savvy, i don't recommend using fdisk/mkfs/parted/CLI stuff like that, but use something like gparted, a gtk frontend to parted. It's easy to use, and does everything for you.
Good luck... Oh yeah, kudos for using Enlightenment as your graphical environment!
Oh yeah, i just had a thought about this thread... How the heck is this related to Android Development? This is a basic Unix-utility tutorial!
People, use the correct forums! >_<

Ok the reason you are getting errors is you are trying to do fdisk on /dev/sdc1 which means you are trying to view the partition table on /dev/sdc partition 1. What you SHOULD be typing is fdisk /dev/sdc so it will show all the partitions you created (/dev/sdc1 /dev/sdc2).

Joushou said:
You can't cd into a block device... You mount the filesystem to a directory, doing something like "mount -t filesystem /dev/sdc1 /mnt/sdc1" (filesystem is the filesystem on the block-device, like "vfat" for fat32, or "ext2" for ext2, and the directory "/mnt/sdc1" have to exist).
It can't get the kernel to reread the partition-table, so you need to force it to do this manually.
You can either reload your kernel (The easiest way would be a reboot...), or just reconnect your device.
After that, you should be able to mount the device.
For the not so Unix-savvy, i don't recommend using fdisk/mkfs/parted/CLI stuff like that, but use something like gparted, a gtk frontend to parted. It's easy to use, and does everything for you.
Good luck... Oh yeah, kudos for using Enlightenment as your graphical environment!
Oh yeah, i just had a thought about this thread... How the heck is this related to Android Development? This is a basic Unix-utility tutorial!
People, use the correct forums! >_<
Click to expand...
Click to collapse
The purpose of placing this here a while back is so many people were trying to partition their cards for use with Android apps2sd and they were posting Windows based tutorials. So I decided to create this one based in the Linux world with Linux tools.
And yes you can not "cd" into a block device. The block device (/dev/sdc1) needs to be mounted first (mount /dev/sdc1 /mnt). If you get errors then you need to make sure you put a filesystem on that partition (mkfs.vfat /dev/sdc1).

Oh, yeah, you're right, he's trying to read the partition-table of sdc1... But, he's doing it right in the picture above! (Which i read, and combined with my tired mind, made the conclusion that it was just the usual "Cannot reread partition-table", which you get if you try to modify the table you're running from, which has absolutely no relation to this problem, but again, i'm tired, sorry )
I said the "Block-device != Directory!" thing because he tries to cd into the device-node afterwards... And of course, he gets an error. I just thought i'd clarify that that's not intended to work that way
laptopdragon: You're doing it right in your full-screen photo, but you're messing it up in your window-shot! Why are you redoing it?
And, shafty023, i don't mind the tutorial, it's always good to have someplace for the newbies to look incase they're stuck with a problem, and i understand why it might have seemed as a good place for the tutorial, but this is "Android Development", afterall, and this definitely isn't a thread related to android development

thanks everyone (esp e16 fans)...
im learning as much as posible...
i learnt today
i never "a" (activated) it too.
and i am now using cli as much as possible...( i want to not live by gui if possible)
i also added
mkfs -t vfat /dev/sdb1
to format it as fat32.
was where i made a mistake, as everytime i loaded the SD card into my g1 it would want to format it. reporting its un-usable or needs to be formatted... now...it at least reads its there and doesn't add any files.... i can mount it, and copy to it...(btw i tried 2 different files of rc29)
i think i am not formatting it thoroughly tho.... (and thank you for posting this linux thread)
to summarize, i am doing this in eterm.
su
root# fdisk /dev/sdc
d
p, print
n
p, for primary
1, for (1-4)
1, for 1st cylinder
1201 for last cylinder (its only a 512mb, and 1201 max, should i make it less)
p, for print
t, for change to
c, for fat32 lba (not b for fat32 ? )
a, for activate bootable
w, for write, (exits fdisK)
root # mkfs -t vfat /dev/sdb1
this is what ive done...
as of now...my g1 only goes to the red/ blue/ white screen and does nothing when i hit the power button...??
but refreshes when i hit the camera, or button left of the on/off power button...(than i cna soft reboot it and it starts normal......
but...is the zipped file corrupt ? or is my sdcard not formatted thoroughly ??
any more help folks...(all is appreciated greatly)

There's one problem... You're fdisk'ing sdc, but throwing fat32 on sdb1... That's 2 different devices! you should fdisk and mkfs on the same device! (So if the device is sdc, it should be "fdisk sdc", and "mkfs -t vfat /dev/sdc1"...)
Incase that's just a typo...
It's throwing you into the bootloader... Did you copy the DREAIMG.NBH into the root, with that name? If so, check the md5sum of the file on the SD, and the downloaded file. Alzo, it's not intended to be zipped, inflate it before you copy it to the SD!
If your pc is capable of r/w to the sd, it should be fine... But try to check syslog for errors after you mounted it...
If the wrong device is just a typo, it should be formatted correctly...
I think parted would probably have been a better choice of utility...

Related

How do you create the FAT32 / EXT2 combo partitions??

i need help on this to install apps on my sd card
I've been meaning to ask this for a while as well, but was shy to ask and make a thread about it.
How would you create one on a mac?
im wondering how to create them on WINDOWS XP
I have read all around on this subject and from what I've read its not possible for windows xp users.
you can create it on windows using Paragon Partition Manager 9. Make sure you partition the sd card using a microSD reader, because issues will arise if you try to partition with your memory card still connected to your G1.
85Mario85 said:
im wondering how to create them on WINDOWS XP
Click to expand...
Click to collapse
Use Paragon Patition Manager 9 for XP then you can make all the partitions you want
Is this the program i need? I want to be sure you say use a disk reader i have the one built into my P.C is that o.k?
http://www.partition-manager.com/
I had problems with this to both the ubuntu live cd and partition maneger works for me. But i had to make sure my init.rc had
mount ext2 /dev/mmcblk0p2 /system/sd noatime nodiratime
not
mount ext2 /dev/mmcblk0p2 /sd noatime nodiratime
Finaly to mwke the partitions in windows i used HP USB format tool to format the card as fat16 and then detleted the partition in partiton maneger and created my FAT32 and EXT2 partitions (*make shure you hit apply*) in partition maneger
manup456 said:
Is this the program i need? I want to be sure you say use a disk reader i have the one built into my P.C is that o.k?
http://www.partition-manager.com/
Click to expand...
Click to collapse
Yes that is the program you use. It is very easy to use. Good Luck!
cchap07 said:
Yes that is the program you use. It is very easy to use. Good Luck!
Click to expand...
Click to collapse
I used this program to try to partition my sd card, I made the partitions, applied them, it finished. I put all my stuff back on my sd card, put it back in my G1 I tried to flash the update.zip and it said no update.zip. I was like wtf, so I put the sd card back in my comp and it said this card is not formatted. I had to use a program to recover everything on it, and havent tried again since. What went wrong?
do you got root? if so, then check the partition table using fdisk:
# fdisk /dev/block/mmcblk0
Command (m for help): p
the "p" option prints the partition table for the device you specified when invoking fdisk (your SD card). you should have two partitions listed - one using a Win95 FAT32 filesystem (hex ID "b"), and a second partition labeled as a Linux partition (hex ID "83). Here's my partition table if you want to try to match it up to your own:
Code:
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 218751 7000024 b Win95 FAT32
/dev/block/mmcblk0p2 218752 249296 977440 83 Linux
So long as that all looks good, it *should* work. I think i used gparted when i partitioned my SD card. I have a theory that you can do it through fdisk too, directly on the G1, but i didn't really spend too much time trying this.
.haNk said:
do you got root? if so, then check the partition table using fdisk:
# fdisk /dev/block/mmcblk0
Command (m for help): p
the "p" option prints the partition table for the device you specified when invoking fdisk (your SD card). you should have two partitions listed - one using a Win95 FAT32 filesystem (hex ID "b"), and a second partition labeled as a Linux partition (hex ID "83). Here's my partition table if you want to try to match it up to your own:
Code:
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 218751 7000024 b Win95 FAT32
/dev/block/mmcblk0p2 218752 249296 977440 83 Linux
So long as that all looks good, it *should* work. I think i used gparted when i partitioned my SD card. I have a theory that you can do it through fdisk too, directly on the G1, but i didn't really spend too much time trying this.
Click to expand...
Click to collapse
Thanks, but wtf, it says I have 4 partitions, and it doesnt know the system, on Partition Manager it says 1 last time I checked
AsaSpades said:
I used this program to try to partition my sd card, I made the partitions, applied them, it finished. I put all my stuff back on my sd card, put it back in my G1 I tried to flash the update.zip and it said no update.zip. I was like wtf, so I put the sd card back in my comp and it said this card is not formatted. I had to use a program to recover everything on it, and havent tried again since. What went wrong?
Click to expand...
Click to collapse
I have no idea, but the same thing happened to me and I just repartitioned it and retried it with only the update.zip and it worked. If you dont have your sd card partitioned just copy everything you have on it to your computer, erase the current formatting and try it again. It should work. Good luck!
AsaSpades said:
Thanks, but wtf, it says I have 4 partitions, and it doesnt know the system, on Partition Manager it says 1 last time I checked
Click to expand...
Click to collapse
You can try to follow these instructions that I wrote on another thread.
Back up any data that you can because this will erase it all.
Ok so Open Paragon, click ADVANCED PARTITIONING on bottom right, on your sd card right click on the partition and click Delete partition. Then Delete all other partitions on the SD card.
After you have deleted them all, click on the apply button on the top of Paragon. Then after that is finished, right click on the sd card and click create partition. The first drop down box will say: Create Partition as: and select Primary Partition. Then select the size you want the FAT32 Partition to be and on the Second drop down box select FAT 32. Then click yes.
Then Right click on the sd card again on the part that says (unallocated) and click Create partition. Select the partition as primary, and this time select the Linux Ext2 option of the second drop down box. Then click yes. Finally, Click on the top button to apply changes (Green Check mark) and you are done partitioning. Then just follow these instructions.
BTW the Ext2 partition has to be less than 2GB.
Good Luck!
yeah dude, i would say just give it another try in partition manager. if that don't work, then i guess you can try using a Linux live CD (or USB...) to partition it. just don't accidentally reformat your hard drive. make sure you select the option to manually setup your partition table, and then make sure you're working with the SD card and not your HDD. i've seen too many people wipe their hard drives on accident.
alright ill jus try it again, after its partitoned correctly will the sd card directory be different? Like would there be a folder for Ext2 or no?
nah, you won't see an additional folder. the second partition (EXT2) will be mounted under /system/sd, so you won't see it unless you specifically browse to it. if you want to make sure that it partitioned and mounted correctly, run the 'mount' command as root on your phone. you should see /dev/block/mmcblk0p2 mounted to /system/sd.
hmmm its not letting me create a partition after I deleted what was on it. When I click the sd card in "Create Partition" it says "A new partition cannot be created on this hard disk. Most probably/all primary slots are occupied and there is no extended partiton."
Hi Asa,
Check out this diagram I made when I was transferring my apps and caches to the sdcard.
You should run the busybox command and see if your ext2 partition shows.
In the diagram, it is the one that has a size of 1.6 gb.
So you should see something similar in your phone.
After I transfered all my caches and apps the ext2 partition no longer shows up in partition manager but I know it is working and present by the busybox output shown in the diagram.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Let me know if it helps.
Do i need the full version? Because the demo does not give the create partition option its there but disabled.

SDSPLIT repartition your SDcard on phone (w/o a PC)

!!!OBSOLETE!!! 2009-11-26: This script was very useful in the beginning, but is now obsolete. There are superior methods such as sdparted using better tools, and this script likely no longer works properly on modern builds.
As the title says, this script will repartition your sdcard so that you will have a FAT and an EXT2 partition. This is particularly useful for running apps off of the sdcard.
The app is called sdsplit, it has a strong focus on error prevention and recovery. Use at your own risk and please do let me know if you have any problems. As partitioning your card is inherently risky (especially if you are trying to preserve data from it), this script may help backup your data and any system config scripts which it modifies.
Instead of describing all of the features of the script, I will simply post the help message here since I spent a lot of time trying to make it comprehensive. The design of the script tries to make it easy for you to understand where a failure occurs if one does, and to pick up where you may have left off due to the failure after you work around it.
See the HowTo for Dummies for exact steps, but here is the general idea:
* Download sdsplit to your phone and give it execute permissions.
* Run script as root
* Do not run it from a subdirectory of /sdcard
* Run it with as few applications running as possible (to avoid having files open on the sdcard.)
The script logs its output to /data/sdsplit.log, please post the relevant bits from here if you encounter a problem and want help. But first, check out the FAQ for answers to most questions!!!
Code:
# sdsplit --help
Usage(v1.7): sdsplit [options]
'sdsplit' will by default perform all of its default actions in sequence. Specifying a
specific action will tell sdsplit to only perform that action and skip the others. You
may instead prefix an action with 'no' to prevent that specific action from being
performed while all the others are run. For debugging purposes, all output of sdsplit
will be logged (appended) to /data/sdsplit.log
PREREQUISITES:
* This is desgined to work with the Jesus Freke updates (tested on JF1.43ADP/JF1.5).
Here is why you need a JF update: for busybox, DNS, so the /init.rc invokes /system/init.rc,
and so the ext2.ko module is under /system/modules/2.6.27-00392-g8312baf/kernel/fs/ext2.
* If you are making a FAT partition greater than 2GB and have a pre1.5 android
environment, you will likely need a new 'mkdosfs' executable or internet access
from your phone so that sdsplit can download and install it for you. If a capable
mkdosfs is not found somewhere in your path (or where specified by --pmkdosfs),
sdsplit will attempt to download and install it for you from my repo. This executable
came from a Haykuro 1.5 build.
* Additionally, you will need a 'mke2fs' executable for arm-eabi or internet access
from your phone so that sdsplit can download and install it for you. If mke2fs is
not found somewhere in your path (or where specified by --pmke2fs), sdsplit will
attempt to download and install it for you from my repo. I got this executable from
here: http://sites.google.com/site/juanjosec/android
ACTIONS:
--backup|-b Perform a backup of the /sdcard directory to /data/sdcard
--nobackup|-nb (See --pbackup)
--config|-c Configure the system to handle a new ext2 partition on the
--noconfig|-nc sdcard. This involves adding mount options to /system/init.rc and
to /system/etc/mountd.conf along with creating the /system/sd mount
point for the ext2 partition on (see --pext2). Backups of the
original files will be made (.orig). You should use this for
a JF1.5 build.
--partition|-p Wipe the partition table of the sdcard and create two new
--nopartition|-np partitions, first a 500M FAT32 one (see --fatsize) and then
a Liunx one (for EXT2) on the remainder of the sdcard (see --ext2size).
--mkfs|-mk Make the FAT32 (see --fat[16|32]) and EXT2 filesystems. (partitioning
--nomkfs|-nm only allocates the space for them). This requires the mke2fs
exectuable on the G1/ADP (see --pmke2fs).
--restore|-r Restore the original sdcard backup from /data/sdcard back to /sdcard
--norestore|-nr
Along with the above actions there is one additional action if you do not care to
save your original sdcard data:
--nodata|-nd Equivalent to: --nobackup --norestore
OPTIONS:
-h|--help Usage (short) | Help (this)
--forces|-f Force exectution without prompting up front
--forcemkfs|-fm Force even if the mke2fs executable cannot be found and/or
if the mkdosfs executable is not suitable for large
partitions.
--forceumount|-fu Force even if partition already mounted at /system/sd.
Use with care, if you have an already existing EXT2
partition this will delete everything on it!!
--fatsize|-fs SIZE[KM] Set the size of the FAT partition in bytes, K or M.
(defaults to 500M)
--ext2size|-es SIZE[KM] Set the size of the EXT2 partition in bytes, K or M.
(default to the remainder) If you set this, it will not
set the FAT parition to the remainder, it will remain
500M unless you explicitly set it to something else.
The only reason to use this is if you want to leave space
for another partition.
--fat[16|32] Make the FAT partition of type 16 or 32. The default is
32 since 16 does not seem to work with my ADP.
--pbackup|-pb PATH Set the location of the sdcard backup dir.
--pmke2fs|-pme PATH Set the path to the mke2fs executable (if not already in
your PATH.)
--pmkdosfs|-pmd PATH Set the path to the mkdosfs executable (if not already in
your PATH.)
--pext2|-pe PATH Set the mount point for the new ext2 partition (defaults
to /system/sd)
COPYRIGHT: Martin Fick <[email protected]> GNU GPL2 or above
ChangeLog:
v1.7 2009-05-10 (usability improvements)
* Prompt on startup (confirm requested actions), use -f to override.
* Log invocation string to sdsplit.log
* Removed error when sdcard is empty
* If no ext2.ko is found output a message instead of an error.
more...
WOW i don't need the script since i have my card partitioned, but i didn't even know this was possible. i congratulate your efforts and hope that this works for everyone. would certainly help people that have bad computers or USB lower than 2.0 on their computers. i really don't know what to say, i am looking at the script right now and it's about 10 levels above my coding ability. great job on this
I was reluctant to try partitioning my SD card again after two failures, now I'll have to try this tomorrow. Thank you very much, MartinFick!
i was beginning to wonder why this hasn't been done before...
i applaud you in your efforts sir, ill be sure try this tomorrow.
thank you
Has anyone tried this yet? I already have mine set up but I'm dying to know.
This could make LucidREM's job easier too!
MartinFick said:
Well, here is my paltry contribution to the community. I spent entirely too much time on this! I hope it can help at least one person.
Click to expand...
Click to collapse
ok .. so maybe you DID spend entirely too much time but i would hardly call it paltry .. just skimming thru the code .. looks pretty nice .. i'm sure people will be happy to have the assistance
Great work MartinFick!!! I also have a partitioned card, but this is a great addition to the wonderful mods that already exsist in our community. I do hope it works and I'm sure it will help out many.
I refused an offer of $$$ to mod two phones (from root to apps on sd) because I lost the ability to use paragon (trial over), and "customers" not wanting to give their email address. Now that this may take care of that I might start doing it. I'll wait for reviews. Thanks again MartinFick!!!
Wow, I'm very impressed. Nice work.
So if I read this correctly. Using the following command would give me a 1gig EXT2 partion and the rest goes to FAT32?
sdsplit -es 1000[M]
I'm not ready to try it since I don't have my 8gig card yet, but Id be willing to give it a go.
Another question I notice it sets the default of the FAT to 500meg. Shouldn't that be the other way around? I mean if I dump tons of songs, videos and what not you would think that the majority of the card should be FAT to use it opposed to EXT2.
So if I read this correctly. Using the following command would give me a 1gig EXT2 partion and the rest goes to FAT32?
sdsplit -es 1000[M]
Click to expand...
Click to collapse
No, there is no simple way (that I know of) with fdisk to make the frist partition take a remainder of the disk, so that feature is only available to the second partition. Since the first partition (I believe) will need to be FAT for most hacks to work (and my script currently), that makes EXT2 the second one.
So you must figure out how big you want your FAT partition no matter what (default is 500M). The EXT2 partition can then either be the remainder of the disk or a smaller amount (if you later wanted a third partition.) If you have an 8G disk and you want only 1000M for the EXT2 partition, simply use:
Code:
sdsplit -fs 7000M
which will give you a 7G FAT and a remainder of 1G for the EXT2. Make sense? Since this was confusing, I will try to add a note about this.
Another question I notice it sets the default of the FAT to 500meg. Shouldn't that be the other way around? I mean if I dump tons of songs, videos and what not you would think that the majority of the card should be FAT to use it opposed to EXT2.
Click to expand...
Click to collapse
I guess that is probably a personal decision, I am not sure why we even need the FAT at all (except for interoperability with other devices)?
Due to the limitations that I explained in the first section, I could only hardcode a limit on the FAT partition, not the EXT2. And, since I figured that people with a 1G card would probably want at least 500M EXT2, I opted for the 500M FAT default.
If I figure out a clean way to specify the EXT2 size and let FAT be the remainder, I will consider your suggestion. I was basing the fact that FAT should be first on rules that I read in other threads (this is not an inherent disk partitioning limit). If someone could explain to me why (I assume other components in the android system expect this), perhaps this could be worked around? Another solution if FAT absolutely needs to be P1 and EXT2 P2, is to try and simply put P2 first on the partition (fdisk will usually let you do this.) This way, the EXT2 partition could be set to a fixed size and the FAT one could use the remainder (be second on disk,) but stay numbered P1. Anyone have any thoughts on that suggestion?
Awesome. So basically set the FAT and the EXT2 would set its self to the rest. I by no means was questioning why you did it the way you did it. I just didn't have a clue and it makes complete sense now.
Like I said I can't try this the 7th because the cards I ordered do not arrive until then.
Can somebody
Can somebody post a how to execute this coz i downloaded it and can't understand wat to do next
So if we do select 7GB for the first partition, it'll format it FAT32 correct? As FAT can't use that much space.
Bug Fix Release Update
I update the original post with v1.1 which has some bug fixes in it. The partitioning worked fine in the original script, but my repeated testing seems to have masked some bugs in the automounting of the new partition.
Can somebody post a how to execute this coz i downloaded it and can't understand wat to do next
Click to expand...
Click to collapse
While I am more confident about this version (more personal testing), I would be happier if someone who knew how to recover from potential disasters (someone knows how to use recovery mode) and with a basic linux understanding tried it first.
But, to answer your question, download the new one first (v1.1 which I uploaded after you posted your question), then save this file (perhaps remove the .txt extension) to somewhere in your path (/data/local/bin), and give it execute permissions: chmod 777 /data/local/bin/sdsplit and run it specifying the size of the FAT partition that you want (sample for a 1G FAT partition):
Code:
sdsplit -fs 1000M 2>&1 | tee /data/local/tmp/sdsplit.log
So if we do select 7GB for the first partition, it'll format it FAT32 correct? As FAT can't use that much space.
Click to expand...
Click to collapse
Regardless of size, it will format it as FAT 32 unless you specifically tell it to try FAT 16 (which did not seem to work for me)
MartinFick said:
But, to answer your question, download the new one first (v1.1 which I uploaded after you posted your question), then save this file (perhaps remove the .txt extension) to somewhere in your path (/data/local/bin), and give it execute permissions: chmod 777 /data/local/bin/sdsplit and run it specifying the size of the FAT partition that you want (sample for a 1G FAT partition):
Code:
sdsplit -fs 1000M 2>&1 | tee /data/local/tmp/sdsplit.log
Click to expand...
Click to collapse
Hmm, you need to simplify it further for simpletons like myself.
What we need is a step by step (and I mean step by step, i.e. every single thing you need to do to your phone no matter how obvious) guide on what to to from downloading the app, to ending up with a partitioned SD card.
So, e.g, I have an 8gb SD card, I have some data on that card, I wish to make a partition of 1gb for the EXT2 part, and 7gb for the FAT32. I also dont wish to lose my data.
Should I manually copy my data to my computer, then format the SD card and run the app, or is there a built in thing in the app to backup the SD card (on what though?) and allow you to transfer it back after the partition?
Some questions to clarify (which is why the step by step guide for idiots is needed):
1) do you download the app via the app store, and install it on the phone, or do you download the app onto your computer and transfer to your SD card via USB cable?
2) Do you need to change the file (you say you MAY want to remove the .txt. extension, that a yes or a no?)
3) save the file to somewhere in your path? What does that mean? and where exactly?
4) How do you give it 'execute' permissions? By typing in "chmod 777 /data/local/bin/sdsplit", where do you type this in?
5) are all of these instructions carried out in the command / dos type area of the phone, where you can type in these controls? I am assuming so.
These are just some of the things I do not understand (sorry for my ignorance), which is why we need someone to really clarify the whole process so even a monkey can follow it.
I hope someone has the time and inclination, since I am really pissed of with the android since I ran out of space on my internal memory, makes me want to throw the phone away.
Please be step-by-step specific please.
yeah i have the same questions as him ^^^^^
i have an 8 gig sd card. i want to have my EXT2 to have 800 MB and the rest FAT32. how much do i give the FAT32 portion?
First of all, THANK YOU! This is just what many people need. Great job on making it as simple as possible.
I too would second the request to give us a step by step directions on using this (ie press this button and then....(have to say this in Homer Sipmson's voice))
I could most likely figure it out myself but I don't want to take chances, especially since my card is alrealdy fomatted and works, I wouldn't mind changing the size of my partitions at some point but don't want to take risk of losing 110+ apps..
Once more, BIG THANKS for this piece, I'm sure a lot of people will use it.
Martin I just want to say thank you on behalf of the community.
I reset my phone this evening and tested this out on JF rc33. It's brilliant. You've done a great thing here.
I hope you don't mind but I've posted a how to over on the android section of nokia apps at the request of a few users! Of course i linked to this page and gave full credit!

[HOWTO] Repartitioning Your SD Card with GParted Using Ubuntu

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.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
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.
Reserved
Reserved for possible future use.
aaronratner said:
Reserved for possible future use.
Click to expand...
Click to collapse
yo, thanks alot bro. i was trying to figure out how to resize my linux swap. i already have a 32 mb linux swap. so, would it be better to delete the linux-swap and do the steps you did or do you just recommend me resizing my linux-swap. currently i have an 8gb class 6 transcend sd card. i currently have about 6.62gb fat32, about 1000mb (if i remember correctly) for my ext3, and 32mb for my linux-swap. thanks
I would--and this is more opinion that previous knowledge or expertise, delete the linux-swap--resize the ext3 and re-create the linux-swap. However, I don't think it would really make a difference which way you go. They are both essentially the same thing. Remember, there is a chance of data loss, particularly if your ext3 partition is full (the free space would have to come from somewhere). I have, however, successfully done this twice, both on a G1 and a myTouch. Hope it works and report back results if you try it.
EDIT: Did it a third time to another G1.
ubuntu and gparted
Ok, dl'ed the iso, burnt it, loaded into live cd, got my 4gb sdcard in the reader, started gparted and tried to follow along with superteam256's partition instructions for dummies (found here : http://forum.xda-developers.com/showthread.php?t=535914. The fat 32 partition gets "created" fine, but when I try to add a second, it gives me an error saying only one can be "primary" and that I have to create an extended partition even if that means removing the primary. So I tried to create just an extended, using the whole card, and then logicals afterwards, which didn't work. I tried to create the ext2/3 (not primary) and add the fat32 after, still gives me the same error.
*EDIT: When the first primary partition is created, it does not give me anything but "New" when I right click so I can't even tell it this one will be "extended".
On a side note, I have tried adb, but for some reason after the frist 2 commands it stops working and I have to reboot, unplug my phone, and then it works...for another 2 commands. I really want to run hero on my rooted mt3g US 32B. So far the only ROM I have been able to load is some weird hacked version of the original OS (it's cool, but I wanna try HERO!!)
Anyone got some commandline (linux preferrably) directions on creating the sdcard partitions and filesystems?
Thanks!
I partioned my 8GB SD with gparted, and apps2SD is working now. But everything is moving to main FAT32 partion. How can I access or use other 3 partitions (ext3, linux-swap, fat32 at end). Any help
ykhehra1 said:
I partioned my 8GB SD with gparted, and apps2SD is working now. But everything is moving to main FAT32 partion. How can I access or use other 3 partitions (ext3, linux-swap, fat32 at end). Any help
Click to expand...
Click to collapse
Access it how? Through the phone? PC? Only the fat32 shows up in Windows and in non-root file explorers on the device. The files on the ext partition are usually located in /system/sd depending on the ROM. This can only be accessed via linux using a root explorer on the device, terminal emulator or ADB.
rmarquez1974 said:
Ok, dl'ed the iso, burnt it, loaded into live cd, got my 4gb sdcard in the reader, started gparted and tried to follow along with superteam256's partition instructions for dummies (found here : http://forum.xda-developers.com/showthread.php?t=535914. The fat 32 partition gets "created" fine, but when I try to add a second, it gives me an error saying only one can be "primary" and that I have to create an extended partition even if that means removing the primary. So I tried to create just an extended, using the whole card, and then logicals afterwards, which didn't work. I tried to create the ext2/3 (not primary) and add the fat32 after, still gives me the same error.
*EDIT: When the first primary partition is created, it does not give me anything but "New" when I right click so I can't even tell it this one will be "extended".
On a side note, I have tried adb, but for some reason after the frist 2 commands it stops working and I have to reboot, unplug my phone, and then it works...for another 2 commands. I really want to run hero on my rooted mt3g US 32B. So far the only ROM I have been able to load is some weird hacked version of the original OS (it's cool, but I wanna try HERO!!)
Anyone got some commandline (linux preferrably) directions on creating the sdcard partitions and filesystems?
Thanks!
Click to expand...
Click to collapse
use the command: fdisk
for instructions how to use fdisk
type fdisk --help(or fdisk -help or something)
or man fdisk
Excellent tutorial. Unfortunately, it doesn't work for me. My SD card is already partioned using ROM Manager / Clockwork Recovery. I currently have 15 GB FAT32 and 1 GB ext2 (I guess).
Running Ubuntu 10.10, I've connected the phone via USB and I can access the FAT 32 partition via Nautilus/Explorer.
Using GParted, I can only see 15 GB of unallocated space (as /dev/sdb). The FAT 32 is not recognized as such and the 2nd partition doesn't even show.
Using the Ubuntu Disk Utility, /dev/sdb is reported as 15 GB on HTC Android Phone but unpartioned.
Any idea of how to proceed without wiping everything and with working on the whole 16 GB?

[CONCEPT] Single Partition No-Format Apps2SD

So I was using Slax. Great LiveCD/USB linux, extremely customizable, modular, fast, and small, and has the capability of either:
- saving changes to its rootfs onto an AUFS mounted on a non-linux FS (FAT32, NTFS) using posixovl (POSIX Overlay FS) with metadata (permissions, etc.) being held in files
- saving changes to a fixed-size loop mount image.
This got me thinking.
If we could insert all the necessary modules, code, etc. for posixovl into the Android linux, and make a modified a2sd script that takes advantage of posixovl, we could effectively do away with the requirement for crazy partitioning.
It should be simple enough for ROM devs to implement, assuming it's ready and installed:
1. Create folder on main partition if it doesn't exist, something like /sdcard/system/[app, app-private, dalvik-cache, app_s]
2. In the init scripts, before the a2sd stuff, mount /sdcard/system with posixovl on /system/sd
3. Run a2sd as normal, it should automatically just work.
I'll hopefully test this once I get my phone to a stable development/testing stage, and I don't need to make phone calls for a while. Anyone else is welcome to try to implement this idea.
My current test environment:
- HTC Dream (T-mo G1) with the deadly SPL of doom
- Cyanogen Experimental, latest build
- Amon_RA's modded recovery
- Wipe /data, move all existing apps to backup, remove a2sd partition, Backup for Root Users to restore some settings and data
Anyone with ideas or improvements, please let me know.
To be tested:
- Feasibility (can it work?)
- Functionality (does it work?)
- Portability (Can it work on other ROMs and devices like Hero, Pulse, Blur etc.? If so, will likely be moved to XDA's new Android board)
- Stability (Will everything Force Close on boot? Does it run fast enough? Does anything get corrupted over time?)
Links:
- http://sourceforge.net/projects/posixovl - Sourceforge page for posixovl
In desktop linux you can create a file with the touch command, and mount the file to a mountpoint after formatting it to ext4 for example.
Maybe this is the easier way?
I have done this about 5 years ago, but I will try it today and report if it worked.
edit: ok done already:
1. create a file of the desired size, eg: dd if=/dev/zero of=filename bs=filesize count=1
2. use mke2fs to format the file
3. create a mountpoint and mount the file
thats all. Now I have a 128MB file on my PC, mountable and usable like a partition.
Archont said:
In desktop linux you can create a file with the touch command, and mount the file to a mountpoint after formatting it to ext4 for example.
Maybe this is the easier way?
I have done this about 5 years ago, but I will try it today and report if it worked.
Click to expand...
Click to collapse
As far as I know, you can do that on the mobile Android, too, and that does work in theory. This technique involves mounting a loop filesystem, and it too will allow one-partition apps2sd, but it's less flexible, and I would think slower, than the overlay method.
For a 512MB apps image:
Create empty 512MB file
# dd if=/dev/zero of=/sdcard/apps.img bs=1024k count=512
Format it to Ext2
# mke2fs -L Apps2SD /sdcard/apps.img
Unmount existing a2sd
# umount /system/sd
mount new a2sd image
# mount -t ext2 -o loop /sdcard/apps.img /system/sd
Make the usual directories, and a mountpoint for the old a2sd partition
# mkdir /system/sd/app; mkdir /system/sd/app-private; mkdir /system/sd/dalvik-cache; mkdir /system/sd/apps-tmp
Mount the old a2sd partition
# mount -t ext2 /dev/mmcblk0p2 /system/sd/apps-tmp/
Move all files from the old partition to the image file
# mv /system/sd/apps-tmp/* /system/sd/
Unmount and remove the mountpoint, we don't need it anymore
# umount /system/sd/apps-tmp
# rmdir /system/sd/apps-tmp
Finally, you add the following line to the init script where the a2sd auto mount happens, and comment out the old line.
Code:
[...]
mount -t ext2 -o loop /sdcard/apps.img /system/sd
#mount -t ext2 /dev/mmcblk0p2 /system/sd/
[...]
This should do what you described, in theory. I can't say whether it will work or not. I can't tell whether it will or won't screw up your phone, I can't be held responsible if you screw something up or overlook the details. Either of us might have made a typo somewhere; apply common sense before doing anything.
This sounds great! I think this would also be usefull for someone like me, who has a sd card that doesn't want to be partitioned anymore (cross-linked files??). Only thing possible is fat32 or ntfs.
Am I correct with my assumption?
This sounds a lot harder and more complicated then partioning. Your also talking about a lot of work needing to be done just so people can avoid doing a simple thing like partioning a sd card. I would say it would be very difficult alone to get the os to run a virtual mounting service especially since that will take up resources and slow down the phone. There is a reason they only use this technique on live cds is it works but its slow. most of the computers they are running on have 1gig of ram and 2ghz cpu's. i really dont think the g1 can push this.
I do not think that this is great, it definitely is slower than a ext4 partition on a good class 6 microSD card. And it is more vulnerable to data loss since 2 different filesystems including a 20 year old non-journaling fs at the base of this construct are involved.
Another problem that came to my mind: when you mount your SD card as external USB device to a PC, the file containing your apps will no longer be accessible, or Android will make using the phone as external data storage impossible.
Interesting.
There is, however, a major problem: What happens when you unmount the fat partition on the phone in order to connect with a computer using UMS? Answer: everything on the phone will crash and burn since the apps filesystem will suddenly disappear = BAD.
posixovl is a nice find though...
Note that aufs, loopmount linux filesystems, etc., wouldn't be needed with this since posixovl appears to be vfat with posix extensions, so you should be able to just use posixovl directly on the sdcard.
There are several problems with that though... i.e. how reliable is posixovl regarding users tampering with it?
In any case, a prerequisite for use of it would be certain other changes being planned...
You might want to contribute to this thread:
http://forum.xda-developers.com/showthread.php?t=577941
(note: the thread links to a thread at android-platform, the one here has, as expected, gone off on a tangent... just ignore the junk.)
TylTru said:
So I was using Slax. Great LiveCD/USB linux, extremely customizable, modular, fast, and small, and has the capability of either:
- saving changes to its rootfs onto an AUFS mounted on a non-linux FS (FAT32, NTFS) using posixovl (POSIX Overlay FS) with metadata (permissions, etc.) being held in files
- saving changes to a fixed-size loop mount image.
This got me thinking.
If we could insert all the necessary modules, code, etc. for posixovl into the Android linux, and make a modified a2sd script that takes advantage of posixovl, we could effectively do away with the requirement for crazy partitioning.
It should be simple enough for ROM devs to implement, assuming it's ready and installed:
1. Create folder on main partition if it doesn't exist, something like /sdcard/system/[app, app-private, dalvik-cache, app_s]
2. In the init scripts, before the a2sd stuff, mount /sdcard/system with posixovl on /system/sd
3. Run a2sd as normal, it should automatically just work.
I'll hopefully test this once I get my phone to a stable development/testing stage, and I don't need to make phone calls for a while. Anyone else is welcome to try to implement this idea.
My current test environment:
- HTC Dream (T-mo G1) with the deadly SPL of doom
- Cyanogen Experimental, latest build
- Amon_RA's modded recovery
- Wipe /data, move all existing apps to backup, remove a2sd partition, Backup for Root Users to restore some settings and data
Anyone with ideas or improvements, please let me know.
To be tested:
- Feasibility (can it work?)
- Functionality (does it work?)
- Portability (Can it work on other ROMs and devices like Hero, Pulse, Blur etc.? If so, will likely be moved to XDA's new Android board)
- Stability (Will everything Force Close on boot? Does it run fast enough? Does anything get corrupted over time?)
Links:
- http://sourceforge.net/projects/posixovl - Sourceforge page for posixovl
Click to expand...
Click to collapse
lbcoder said:
Interesting.
There is, however, a major problem: What happens when you unmount the fat partition on the phone in order to connect with a computer using UMS? Answer: everything on the phone will crash and burn since the apps filesystem will suddenly disappear = BAD.
Click to expand...
Click to collapse
I kinda overlooked that point. Oops.
Though this same problem does exist on regular apps2sd when you remove the card without dismounting it, killing all apps and their processes, and freezing Dalvik's method of autostarting some apps.
I do tend to swap cards every now and then, but only after a reboot. Dalvik re-enumerates and caches dex, which makes for a slow boot, but it seems to just work in most cases that the apk install doesn't drop the app's functional payload (helper Linux/shell utils, libraries, NDK .so's) in /data/data (like some emulators, the Android Scripting Environment)
lbcoder said:
There are several problems with that though... i.e. how reliable is posixovl regarding users tampering with it?
Click to expand...
Click to collapse
As far as I know, the metadata files are marked as hidden and system files, and begin with a '.'. And I haven't tried this, but I think modifying the actual files under Windows has no negative effects, but moving, deleting, or copying files would likely be a no-no.
Also, I don't think there's a 'fsck' for posixovl, meaning that if any metadata files were screwed with the wrong way, the entire overlay FS would be trashed.
lbcoder said:
In any case, a prerequisite for use of it would be certain other changes being planned...
You might want to contribute to this thread:
http://forum.xda-developers.com/showthread.php?t=577941
(note: the thread links to a thread at android-platform, the one here has, as expected, gone off on a tangent... just ignore the junk.)
Click to expand...
Click to collapse
I checked that out. It was actually a small inspiration for what I was thinking of.
In any case, Android's package management system needs an overhaul. The package storage needs to be de-Linuxified, as all it is is a bunch of .apk files and .dex/.odex files, the UIDs of apps are in the AndroidManifest.xml, right?
In a somewhat unrelated note, app data needs to be moved to a specified folder structure on the sdcard. My card is full of folders in the root directory with random names.
If I'm understanding you correctly, you're talking about storing an image file on the normal SD card partition(which has to be FAT32 as far as I've seen) and then mounting it, correct? This idea has been talked about at length before on at least 3 separate occasions(2 of which were on this very forum) and found to be a bad idea due primarily to massive security risks since FAT32 has no permissions.
Also, I believe cyanogen ended up dumping unionfs/aufs due to rampant memory issues.
If you are talking about mounting an image from the FAT32 partition, please don't endorse this. We don't want to be throwing in security bugs into android, especially ones such as this which can't be plugged up.
As a modification to what I said: If you're suggesting doing this(or something similar) on a separate filesystem, after that project to change the AOSP to support one with permissions is finished, then I'm in full support.
If you want to go for a single partition on the sd card, why don't you just make the entire card use ext4? Your linux desktop reads it anyway, it uses journaling and so on, I guess it would be faster compared to fat32 and it is definitely safer to use.
And i guess it is not too complicated to mount this partition and use it for pictures, music and so on.
I have not tried this (yet) and I go to bed in 20 minutes, but maybe I will start testing something in that direction tomorrow.
[email protected] said:
If I'm understanding you correctly, you're talking about storing an image file on the normal SD card partition(which has to be FAT32 as far as I've seen) and then mounting it, correct? This idea has been talked about at length before on at least 3 separate occasions(2 of which were on this very forum) and found to be a bad idea due primarily to massive security risks since FAT32 has no permissions.
Also, I believe cyanogen ended up dumping unionfs/aufs due to rampant memory issues.
If you are talking about mounting an image from the FAT32 partition, please don't endorse this. We don't want to be throwing in security bugs into android, especially ones such as this which can't be plugged up.
As a modification to what I said: If you're suggesting doing this(or something similar) on a separate filesystem, after that project to change the AOSP to support one with permissions is finished, then I'm in full support.
Click to expand...
Click to collapse
UNIX permissions don't do anything in the way of "security" unless you have no access to the actual storage device from another computer (as is the case with the unrooted Dream's internal memory), or unless encryption is used. The posixovl driver OVERLAYS Unix permissions over Fat32 filesystems. But even still, with Unix permissions, nothing's stopping someone else from mounting the Ext2 partition and using chown and chmod.
And the image file on the SD card's Fat32 partition is a complete Ext2 partition complete with Permissions. Nothing is lost.
Archont said:
If you want to go for a single partition on the sd card, why don't you just make the entire card use ext4? Your linux desktop reads it anyway, it uses journaling and so on, I guess it would be faster compared to fat32 and it is definitely safer to use.
And i guess it is not too complicated to mount this partition and use it for pictures, music and so on.
I have not tried this (yet) and I go to bed in 20 minutes, but maybe I will start testing something in that direction tomorrow.
Click to expand...
Click to collapse
We'd just have to find the part in the Android that mounts /sdcard/, and change 'vfat' to 'ext2'. The only reason I wouldn't do this, is because it would immediately make it incompatible with Windows and Mac's default FS drivers. As far as I know, the only FS's that are supported universally within Linux, Mac, and Windows, are FAT and NTFS. And NTFS can be made to have crude support for permissions through security descriptors. Although, the Dream SPL, the Recovery images, and most of Android only uses FAT32.
This is discussed in android-platform Group :
http://groups.google.com/group/andr...read/thread/bf0709c157451cd9/f6aee1830c84620f
The goal is to be able to integrate this in android.
And not having to partition the SDCard is one of the requirements so far...
Unix permissions are not stored using fat or vfat, and ntfs is not really supported in desktop linux and i guess it cannot be used in android linux.
I would not use windows anyway so this is no problem to me, and there are drivers around to mount ext systems in windows. As Mac OS is based on unix there will be a solution for this too.
Access usind adb push and pull, via ftp and so on is not touched by using ext4 on the entire sd card I guess.
And if you don't go the easy way using gparted on a live cd or usb device to create 2 partitions, you will have to live with some disadvantages anyway.
Finally I want to say that my ideas are far from being perfect or usable at all, I see this thread as a kind of brainstorming.
im not as linux or android savvy as probably any of you but before the current method of creating a swap partition became the "standard", people used a swap file on the sdcard and linked that. seems similar to what you are suggesting here.
ofcourse when mounting the fat partition elsewhere (ums in windows for example) that swap file could no longer be used within android. i dont see a way to get passed the same issue, but worse here, due to android not having crucial apps when the fat partition is mounted.
then again, i am pretty much over my head in this conversation and could be over looking something...
I'm kind of fascinated by the FUSE + posixovl method of doing this. In the long run I have a feeling that it's going to perform like ****, but I think it's worth testing.
I managed to get both libfuse and mount.posixovl built and running on Android.
posix-overlay(/sdcard/fuse) on /sdcard/fuse type fuse.posixovl (rw,nosuid,user_id=0,group_id=0,default_permissions)
Giving this a little testing now, it definitely works.
Code:
/sdcard/fuse # ls -l
drwxr-xr-x 2 1000 1000 4096 Nov 5 17:17 test
TylTru said:
UNIX permissions don't do anything in the way of "security" unless you have no access to the actual storage device from another computer (as is the case with the unrooted Dream's internal memory), or unless encryption is used. The posixovl driver OVERLAYS Unix permissions over Fat32 filesystems. But even still, with Unix permissions, nothing's stopping someone else from mounting the Ext2 partition and using chown and chmod.
And the image file on the SD card's Fat32 partition is a complete Ext2 partition complete with Permissions. Nothing is lost.
We'd just have to find the part in the Android that mounts /sdcard/, and change 'vfat' to 'ext2'. The only reason I wouldn't do this, is because it would immediately make it incompatible with Windows and Mac's default FS drivers. As far as I know, the only FS's that are supported universally within Linux, Mac, and Windows, are FAT and NTFS. And NTFS can be made to have crude support for permissions through security descriptors. Although, the Dream SPL, the Recovery images, and most of Android only uses FAT32.
Click to expand...
Click to collapse
Ya, I meant more from the standpoint of a rogue app. Since FAT32 has no permissions, what would prevent such an app from modifying the stored image file to, say, change a trusted app with superuser permissions to some new code of its own making to, for example, watch for credit card numbers and send them back to the person who made the original rogue app? I'm always hesitant with any ideas that suggest storing an image file on the sdcard for appstosd for this reason.
Forget it, it's useless.
An overlay filesystem prevents you from enabling USB storage.
If you want to play around with FUSE on Android, here's a repository for my port of libfuse..
http://github.com/cyanogen/android_external_fuse
Hi,
I have an idea. I used symbian S60 of Nokia, Symbian can install app to sdcard. I see that when I mount sdcard to PC, my phone immediately hold all activations of all applications on my phone. And they have a PC sync software that help us access sdcard but not mount sdcard (like that we copy file from computer to sdcard via debug mode on android).
I think we should find out how symbian can do it and we will use their way .
I'm not a developer, I'm just an user.
I talked to a few people about this, and some deep kernel voodoo is going to be needed for this to really happen without partitioning.
Another idea is to forge ahead with this, and ditch the "unmount fs for usb storage" and use RNDIS + Samba or something like that instead to access files on SD. I kind of like this idea.

[Q&A] 2 GB External Data -- Hefe Hook Kernel and others

The Hefe Hook kernel allows you to mount a partition of your microSD as /data, getting 2 GB (or more) for your apps and their data.
Please ask your questions here about installation, use, or general approach.
This is great @jeffsf and can u show me how to re-partition the "real internal" storage? I mean expanding the /system since u put the /data out of it. Thanks man
Sent from my GT-N7000 using Tapatalk 2
daothanhduy1996 said:
This is great @jeffsf can u show me how to re-partition the "real internal" storage? I mean expanding the /system since u put the /data out of it.
Click to expand...
Click to collapse
Yes, you've hit on another of the reasons I've been exploring using the microSD for "live" storage. It's one thing to use potentially slow storage for photos that you basically write once or "app to SD" where you read the APK at boot time, make sure your ODEX in the Davlik cache is good, then generally read from the internal-flash cache. It is another when that memory is being read and written "constantly" when your phone is running.
The good thing is that once /data is not part of the internal flash filesystem, you don't have to worry about one ROM (kernel) thinking it begins at one place and another saying it starts at another. Previously, if one ROM had one /system size and another and a different one, the next partition, /data, would look to be corrupt when you swapped ROMs.
As a warning, not all users have fast microSD cards. Some that say "Class 10" on them really are dogs, especially for small reads/writes. The "Class" ratings are for sustained writes, as you would have with a camera recording video. If your ROM is "external /data" only, or even defaults to that, be prepared for a slew of "Your ROMs sucks. It is so slow." complaints.
You'll also need a way to automate formatting the card. It can be done on the phone, as long as you aren't trying to preserve any data.
As I recall, the layout of the MTD partitions is done in drivers/mtd/onenand/samsung_galaxys4g.h I would be careful not to move the partition boundary for efs, as you'd have to move the data it contains in your updater script. Repeating the warning about not moving the boot and recovery partitions is probably a good idea as well!
Your build tree may need some of these values, or at least think it needs some of these values. For example, device/samsung/aries-common from the CyanogenMod/cm-11.0 (KitKat) branch calls out NAND page sizes, partition sizes, and flash block sizes. I haven't looked in detail at your build tree so I can't comment on how it might handle things differently than the CyanogenMod one.
itzik2sh said:
Hi
I hope I don't ask anything silly, but please let me know if any of my assumptions is wrong :
1. I take FBi's251's AOKP milestone 6 (ICS 4.0.4)
2. 8GB SDCard was formatted to FAT32 (4GB) and EXT3 (4GB) using TWRP kernel
(Beastmode's proton kernel to be exact).
3. I would flash this kernel and it would move apps and their data to the sd-ext
without any special additions.
Thanks. I read the thread, but unfortunately 8GB SD is what i have and I think it should be enough.
Thanks again.
P.S - it's for 2 guys I already sold them my SGS4Gs. I want them to be happy...
Click to expand...
Click to collapse
AOKP should be fine. I haven't tried it recently, but it was the tree in which I did the early Hefe Kernel development.
As I understand it, you have a microSD with
partition 1: 4 GB FAT32
partition 2: 4 GB ext3
So that can work, but will need some tweaking of the init-on-fs.sh script. I intentionally didn't use the second partition as so many scripts gobble that up as sd-ext and do who knows what to it.
My first preference would be to reformat the cards, perhaps:
6 GB FAT32
1 MB ext2/3/4 (Yes, 1 MB, a sliver, choice of ext2, ext3, ext4 up to you)
2 GB ext4
since then the script will work without modification and if they install a third-party script that uses the second partition, it won't corrupt their data.
If you were to keep the formatting the way that it is now, you'd need to edit the mount commands in the script to look something like:
Code:
/system/xbin/busybox umount /data
/system/xbin/busybox mount -t ext3 -o noatime /dev/block/mmcblk0p2 /data
(removing the sd-ext mount)
I'm not sure what your expectations are, but all that the kernel and that script will do is mount a different disk partition on /data -- you need to manually move the data over (or restore from something like Titanium Backup). There may be some trickery in renaming that could be used with TWRP backups to restore from data.yaffs2.win to the new /data partition, but I haven't tried that at all.
Hi Jeff
Thanks for your quick reply, and sorry again for not seeing the Q&A thread.
I think making it :
partition 1: 4 GB FAT32 (sdcard)
partition 2: 2 GB ext3 (sd-ext)
partition 3: 2 GB ext3 (data)
partition 4: 1 MB (spare)
would be better and handle data as well. don't you think ?
Would it be worth doing with a "Team" micro-SD card (class 6 I believe) ?
Thanks.
I haven't tried a Class 6 card, but my gut feeling is that it will be dicey. I didn't "commit" to using /data on microSD until I had tried it for several days using Titanium Backup's ability to move both apps and app data to the external card. I would try that first, especially as the phones in question aren't going to be in your hands (I consider you an expert user, able to manage things outside the UI with ease).
I've attached some testing I did a while ago with Transcend and SanDisk cards. When you look at them, realize that the speed scale changes between them. I have a feeling that the real "performance" on a device is going to be related to relatively small reads and writes, not the ability to stream video to the card. I also don't know much about the Team brand, but I found that even some well-known brands didn't have the performance of the Transcend or SanDisk in the same category.
However you configure your cards, I would definitely recommend a journaling filesystem of some sort. I've had my microSD come loose inside the phone. The journal will at least help to reduce any filesystem corruption should that happen.
You don't need the fourth partition -- I have it there to be able to keep rsync backups for fast ROM swapping.
.
Regarding the apps data, have you tried exploring the Mount2SD script ?
sent from me
I've tried a couple of the scripts out there in the past. Since backing up my data is very important to me, I trust the scripts in Titanium Backup to work well with its backup/restore strategies.
Mounts2SD looks like it has gotten a lot more sophisticated than it was when I tried it in the past. It sounds like something worth trying in its current state. At a quick glance (and not looking at the code), I'd personally make some different choices about features; enabling journaling, and being concerned about why lost+found was filling up (things should only appear there if the file system is found to be corrupt).

Categories

Resources