yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] LiooO:
So according to your answer i can partiton SD card in 4Ext recovery or GParted and then just do Fat32 formatting according to your guide? Can someone confirm this pls?
[Desire Android Development] sibere:
I personally can't because I don't use this recovery. But you can try it and post here the result of the partitions list with fdisk -lu /dev/xxxxx (xxx is your device like in the tutorial).
[Desire Android Development] madmaxx82:
Yes it does :)

If you partition with 4ext it will look like this for example:

/dev/block/mmcblk1p1 2048 54687487
/dev/block/mmcblk1p2 57028608 58077183
/dev/block/mmcblk1p3 58077184 62271487
/dev/block/mmcblk1p4 62271488 62535679

And yes, as mentioned in my thread, parted plain sucks for formatting fat32.

Planned to drop it long ago, but didn't have time yet. But will soon.. latest 2 weeks :)

If you partition with 4ext, afterwards you should reformat fat32 somewhere else for better performance for your fat32 partition!

Edit: parted is used for formatting fat32 only.

Edit2: great tutorial, thank you Sibere :)

Edit3: regarding alignment of ext4 partitions:

Many users don't know that. I didn't know that either before making 4extrecovery.

If you use a recovery that does not properly do that, you will lose any optimizations when you: restore a backup (or wipe/format of course),

because any CWMR based recovery (maybe Amon Ra too, don't know that) will silently format your partitions everytime before you restore a backup!
[Desire Android Development] sibere:
This clearly shows that 4ext recov is aligning partitions correctly, good job!

The thing is, this tut can be used also to format any USB flash drive or SD Card to get the best out of it :)

If you could add FAT32 alignment to your recovery, it would be even better!
[Desire Android Development] madmaxx82:
Thank you very much Sibere :)

I'm thinking of adding it! But first I need to remove parted to make room for mkfs.vfat :D
[Desire Android Development] Droidzone:
+1 to request for adding it to an already excellent recovery

-

Sent from my Htc Desire running Supernova Extreme - Gingerbread goodness with Unlimited Internal memory
[Desire Android Development] sibere:
Yep 'coz the one included in busybox is a light version, without all options.

Sent from my HTC Desire with DATA2SD :)
[Desire Android Development] madmaxx82:
Don't know about the one the official recovery is using, but at least I don't include it because it's useless anyway.
[Desire Android Development] Droidzone:
Funny thing happened.. After making the partitions as per first section, my erase block size calculated seemed to be an exact multiple of 128 K! So my reserved blocks should be Zero?
[Desire Android Development] sibere:
HA well I came across this situation.

FAT32 has to have a minimum of reserved blocs (I think I read 2 in the guide).

I don't exactly remember what I chose . Easiest way is to make your partition a tad smaller or bigger ;)

I think the solution was to use 256. (next 128K block size)
[Desire Android Development] Rastaman-FB:
dont confuse parted with gparted.

ive used gparted for ages and you can change the blocks to align and it deals with tables correctly including the formatting and alignment of fat32

this guide is excellent and very good to know

Im just saying that gparted live via vmware player or as a usb key is my primary tool for formating and partitioning in a consumer AND corporate environment.

The issues ive seen with gparted have been down to user error where theyve set the partitions the wrong way around showing the ext 1st

other issues with it not being seen by gparted is due to connectivity of the device.

if you are running a linux distro and linux can see the device then gparted should see it.

the times it hasnt is when its a live CD and the device was connected prior to boot.

http://gparted.sourceforge.net/disp...al&lang=C#gparted-specify-partition-alignment

http://gparted.sourceforge.net/features.php
[Desire Android Development] danarama:
Agree

That and ticking "Align to Cylindars" which will create a gap between the FAT32 and EXT partition
[Desire Android Development] Rastaman-FB:
oh yeah forgot about that

still user error
[Desire Android Development] sibere:
Out of topic but do you have enough space with only 3mb of cache to download big apps or to update a bunch of apps in one go? ;)
[Desire Android Development] Rastaman-FB:
06mountdl script found in cm7/redux

it effectively checks the size of cache against the file you download and if its larger than the cache partition it temporarily uses the data partition.

its brilliant
[Desire Android Development] Droidzone:
Again out of topic :).. But, can you attach the file pls?

I was thinking of remounting /cache into /data
[Desire Android Development] Droidzone:
@Sibere, just out of curiosity, why shouldn't we be able to use additional ext partitions for our /system, and /boot too-effectively, we'd have different roms every time we swap cards..

I'm sure changes can easily be made to the kernel init.rc to do that. Is there something in Android which prevents that? Of course that also opens up possibility of multiboot via recovery..
[Desire Android Development] Rastaman-FB:
bo selecta

i have to do this as i run a heavily stipped personal version of cm7 nightly that fits into a 80mb system and limiting cache to 3 makes my data size huge

be warned, if you go lower than 3mb it will mess up
[Desire Android Development] Droidzone:
It does the exact same thing I had in mind.. :) Though it executes a check at each boot.. I thought it was dynamic and kicked in whenever the size went below the min..
[Desire Android Development] sibere:
This can easily be done into data2sd script if I get you right ;)
[Desire Android Development] sibere:
This has to be investigated. But It may be doable. I'll have a look at the initramfs. The only restriction is that we have to make sure that the sd has come alive and can be accessed by the system.

You would then be able to fully run the system from an SD if this what you're thinking of ;)

FYI It's what we're doing on my tablet to run the rooted OS.
[Desire Android Development] Droidzone:
Yup.. In fact I've already added a script which checks cache at boot and clears out any orphan apks (some of which sometimes run into > 20 MB). A bind or rbind to /data should be simple and good. Would solve the market errors..

I'm thinking systems in the plural.. Would be great for the flashmaniacs to boot multiple systems. It would also render redundant the data++ and MTD partitions. Would also solve any bad blocks too.. But I'm thinking that S-off would be essential to this..
[Desire Android Development] sibere:
If the initramfs can mount the sd card, there should be no need for S-OFF. All needed should be the switch_root command for ARM (which is embedded into busybox)

Switch_root can be used on a boot script level and shouldn't need changes into initramfs (so no need to flash anything else)

I just wonder if running the entire system on the SD wouldn't cause even more lags though.

But I think that fladshmaniacs would have to swap SDs because we wouldn't be able to have many roms on the same SD, unless fitted into an ext4 file mounted via a loop (again) ;)

But this is a bit off topic , right? :D
[Desire Android Development] Droidzone:
Quite right..the data2sd thread is apt for this.. :)
[Desire Android Development] sibere:
Hummm, It would become system2sd or Android2SD, or... whatever!
[Desire Android Development] swemoza:
Haha..

Just miss the old days when you, ownhere and melethron discuss about data2sd things..

Sorry for another off topic..
[Desire Android Development] sibere:
I forgive you :D
[Desire Android Development] danarama:
Thats what I thought, but Hadron proved me wrong. It binds regardless of file size (just cache size). Download a 700k file and its still /data/local/download

</ot>
[Desire Android Development] Droidzone:
It seems there is something in Gparted after all.. After aligning everything I miscalculated and left 14GB for fat32 and only 863 MB for ext4, which wasnt enough for me. I couldnt bear to recopy all my data with my USB 1.0 port on the old laptop, so I wanted to preserve data, so used Gparted to resize the end of fat32 to cylinder alignment, and then made a ext4 with cylinder alignment too. Then formatted the ext4 with stripe and stride. Now I have 2500 MB in the ext4, and its very fast and smooth! I havent done Atto tests since my USB 1.0 spoils the test, but in terms of quality of experience, it's very good!
[Desire Android Development] Rastaman-FB:
gparted is by far the best partition manger ive experienced and used and ive used a lot. (this is not "parted" but based on)

it aligns correctly and saves a lot of heart ache as said before. in nearly all instances of problems its user error and not understanding what certain things mean.

if you understand alignment (which you would have to to achieve whats on this thread) then you can understand gparted.

I have it on a usb stick for portable use and i have a vmware player with the iso mounted for home use. never given me an ounce of a problem (its also bloody quick)
[Desire Android Development] Rastaman-FB:
oh really?

i dont know enough about code. i thought it checked each time it initiated a download
[Desire Android Development] sibere:
If you set H64 and S32 the 1st time with fdisk, well, cylinders are 1Mb aligned then :)
[Desire Android Development] sibere:
Actually I looked a bit into it and we may have to do the switch_root at an earlier stage, during the initramfs boot. Not a big deal tho :)
[Desire Android Development] Droidzone:
Doesn't look bad for a class 4 card..this is my famous 3cpro card, after alignment per this guide
[Desire Android Development] danarama:
That app is very inaccurate. Desire can't handle much over 6MB/s even on a class 10 (hardware limitation). I have seen this app post results on the desire of over 10MB/s, which just is not possible.
[Desire Android Development] sibere:
Half true.

Actually unbelievable scores have been posted by people who tweaked the read_ahead_kb to insane values like 2Mb and above.

But with values close to 128k (pretty common on custom roms) the speed is close to the actual speed achieved by the card.

Obviously, this is sequential R/W speed, which doesn't reflect real world usage :)

The best test is to put the SD on a good quality sdcard reader and test with a good software on a PC.
[Desire Android Development] Droidzone:
And on a USB 2.0 port.. I dont have one atm, which is why I had to try the app.So with the data2sd value of 128K, mine is probably more accurate than not? Will recheck next week when I'm back on my PC..
[Desire Android Development] sibere:
I would say so.

You can also try Jdiskbenchmark 3

With this one you can choose the FAT32 or the ext partition :)
[Desire Android Development] Silverexp:
Finally went thru the whole guide, plus a crash course in Linux. Did find a syntax error in the guide.

sudo mkfs.vfat -F 32 -R 78 -n UserData-s 32 -v /dev/sde1

Should be - sudo mkfs.vfat -F 32 -R 78 -n UserData -s 32 -v /dev/sde1

Should be a [space] between UserData and the –s .

Does this also determine the best cluster size in sectors?
[Desire Android Development] sibere:
Well spotted. I copied this part from the given link and was hopping that it was correct. Anyway you corrected it yourself.

Best sect. Size IMHO are 16 & 32k, ie -s 32 or -s 64

Sent from my HTC Desire with DATA2SD :)
[Desire Android Development] angusc:
That is where i had some issues..... About 2 months ago I followed that link guide after reading baad link on partition alignment. The fat 32 alignment guide send to be in. contrast to the earlier steps. As w start by setting h16 and s64 (our if you read the actual original dudes thread he recommend h224 & s56.

But the fat 32 alignment section has you changing all that again.......unless I read it incorrectly?

And beyond that stage I could never get the fat 32 alignment correction to work. Unless that was the "space" error that you just spotted.....

Sent with Desire.
[Desire Android Development] sibere:
Dunno why the guy choose H224 and S56. Maybe it's better for and SSD but to get 1MB alignement, my settings are far better.

H64 S32 is giving 1024 bytes cylinders

H224 S56 is giving 6272 bytes cylinders. Not the best choice IMHO to align easily without going into expert mode.

I have corrected the typo. The rest remains unchanged.
[Desire Android Development] Silverexp:
Jdiskbenchmark isn't available anywhere... Google pulled from the Market Place, then everyone did to.

FYI, my 32GB CL4 Sandisc is working perfect.
[Desire Android Development] Droidzone:
Had my first data partition corruption today.. I saw the ubiquitous "Google Services has crashed..Gmail has crashed" etc.. that some users had reported.. lol

Formatted everything and started anew
[Desire Android Development] Silverexp:
Your card is about to fail on you... start making backup nightly. Been through this before :o
[Desire Android Development] Droidzone:
lol.. I see your signature. What exactly do you mean by "it failed"?
[Desire Android Development] Silverexp:
It starts off innocent as constant FC, then FC off the main OS apps, then apps/ directories disappearing, and then either the card reports its lock and cannot be formatted or it’s just not longer recognizable in any PC. The Lexar was taking out any card readers I would use, which was a nice bonus. The ADATA 32GB/CL4 was replaced, but its replacement made the phone have 2/3 sec delay on everything. The original one was perfect. My new 32GB/CL4 Sandisk is working out perfect. The original ADATA 32GB/CL4 lasted about 6 months. The Lexar lasted 3 weeks. I have a 16GB/CL6 backup for about 2yrs & that’s been rock solid. It’s the quality of cards we’re now getting, just like the capacitors issue the PC & TV manufactures faced a couple years ago.
[Desire Android Development] sibere:
Even a reboot didn't work? must have been a big corruption because you're having a jounalised ext4 partiton... :-/
[Desire Android Development] danarama:
Well thats odd. I have my read ahead set at 2048 too. With that app it shows mega ££££ MB's, but with a proper one, it shows true values.

Unfortunately my SD wiped so the backup of the app I had has gone, which was the best / most accurate and now its paid for, but that app is inaccurate.
[Desire Android Development] angusc:
My card failed and very rapidly, im not even sure that I got much warning before the card went in to an unreadable state:

http://xdaforums.com/showthread.php?t=890484

Sent with Desire.
[Desire Android Development] Droidzone:
Well, I havent got any of the messages that you posted, angusc. And it's not the first time that Apps FC has occured. It was always correctable by reformatting from linux. The tunefs showed partition errors, so it seems more to have been only partition corruption rather than card corruption.
[Desire Android Development] sibere:
Did you try a manual e2fsck from recovery to try to correct errors?

EXT4 with journal should be able to correct most of them unless the journal itself has been corrupted too ;)
[Desire Android Development] Droidzone:
Well, I'd added e2fsck to my Init script, so on about the third reboot the error disappeared. Guess it was automatically corrected by then. As I was in class, I couldn't look at the logs

Sent from my Desire running Supernova Extreme - Gingerbread goodness with Unlimited Internal memory
[Desire Android Development] angusc:
Thanx for the tip...unfortunately i think i already destroyed the card so i would have to try next time if it ever happens to me again.
[Desire Android Development] Droidzone:
I'm trying to do the whole thing from recovery.. Wish me luck! :D
[Desire Android Development] Droidzone:
I have:

Disk /dev/block/mmcblk0p1: 15.9 GB, 15930490880 bytes
64 heads, 32 sectors/track, 15192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

I'd like to have 1.3 GB for ext4

So FAT32

So my FAT32=15.9-1.3=14.6 GB

Sibere's cylinders are 1MB each

So, I'd need 14.6*1024=14950.4 Cylinders

Rounded: 14950 Cylinders

Fat32 starts on Cylinder 2

So, ends in 2+14950=14952 (=last cylinder)

Disk /dev/block/mmcblk0p1: 15.9 GB, 15930490880 bytes
64 heads, 32 sectors/track, 15192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
n
Command action
e extended
p primary partition (1-4)
p
p
Partition number (1-4): 1
1
First cylinder (1-15192, default 1): 2
2
Last cylinder or +size or +sizeM or +sizeK (2-15192, default 15192): 14952
14952

Command (m for help): t
t
Selected partition 1
Hex code (type L to list codes): c
c
Changed system type of partition 1 to c (Win95 FAT32 (LBA))

Next, ext4

First cylinder= Next one after 14952, so = 14953

Last Cylinder=last=default

Command (m for help): n
n
Command action
e extended
p primary partition (1-4)
p
p
Partition number (1-4): 2
2
First cylinder (1-15192, default 1): 14953
14953
Last cylinder or +size or +sizeM or +sizeK (14953-15192, default 15192):
Using default value 15192

Command (m for help): p
p

Disk /dev/block/mmcblk0p1: 15.9 GB, 15930490880 bytes
64 heads, 32 sectors/track, 15192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1p1 2 14952 15309824 c Win95 FAT32 (
LBA)
/dev/block/mmcblk0p1p2 14953 15192 245760 83 Linux

Next, write partition with w..

But exiting brought up an error message:

Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table:
nvalid argument

Will try rebooting recovery and see..

Edit1:

Ah..Doesnt work..Partition table remains unchanged. Will use a live cd and see :)

Edit2:

Now the weirdest of weird things. On my Natty Narwhal livecd, the partitions show up as setup.. Tap..tap..tap! The recovery is crazy!

Now:

Disk /dev/sdb1: 15.9 GB, 15930490880 bytes
64 heads, 32 sectors/track, 15192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1p1 2 14952 15309824 c W95 FAT32 (LBA)
/dev/sdb1p2 14953 15192 245760 83 Linux

However:

mkfs.fat doesnt work:

ubuntu@ubuntu:~$ sudo mkfs.vfat -F 32 -n UserData -s 32 -v /dev/sdb1p1
mkfs.vfat 3.0.9 (31 Jan 2010)
/dev/sdb1p1: No such file or directory
[Desire Android Development] sibere:
Did you type fdisk -H64 -S32 /dev/block/mmcblk0 or fdisk -H64 -S32 /dev/block/mmcblk0p1 ?

Only the 1st is correct.
[Desire Android Development] Droidzone:
Yup, that was my first mistake..

But can you tell me how I miscalculated the size?
[Desire Android Development] sibere:
Wow you're taking it the hard way :)

hash_alg is supported, at least on my linux box. May be not by the recovery. It's not a big thing tho. It's just a faster hash algorithm than the default one.

In the OP I said that this has to be done from a linux box, not recovery, mainly because recovery is not 100% compatible. It's simplified and is not compatible with all commands.

"So.. You've plugged your SD to your linux box and want to align partitions with fdisk?" remember :)
[Desire Android Development] Droidzone:
I know..I was just trying to see what happens if I do it in Recovery.. :D

Well, actually my first post was done in recovery, and it failed.

So the second post was after I booted the latest Natty Narwhal live cd and did it there.. thats when mmcblk0p1 chnged to sdb1
[Desire Android Development] sibere:
your SD is 15192 cyl. 1 Cyl = 1M = 1024KB

1.3Go = 1024x1.3 = 1331 Cyl (rounded)

so you should have

15192 - 1331 = 13861for FAT32 and the rest for ext :)

Keep in mind that manufacturers are cheating and counting MB = 1000 instead of 1024. But computers still counts using 1024.

So actually your SD is not 15.9GB but something like 14.8 GB
[Desire Android Development] Droidzone:
I calculated in reverse:

I started from 15.9 GB (which I now understand is an overestimation!), and found the size that Fat32 needs! I now realize that in doing so I left too little space at the end..

Pls do add a tip about this in the OP.. So that other simpletons wont go wrong again :D
[Desire Android Development] sibere:
Nope. they are cheaters!

It's better to use cylinders to count.
[Desire Android Development] Droidzone:
By the way, 1 Cylinder=1024 or 1048? Isnt it 512*2=1024?
[Desire Android Development] Silverexp:
Yep, this was some of the crash course I got myself into aligning the card last weekend too. Well worth it…
[Desire Android Development] sibere:
OOOOPS yes corrected the 1st bit of my reply. The rest was correct with 1024 ;)

Was getting very tired yesterday ev.

Sent from my HTC Desire with DATA2SD :)
[Desire Android Development] Droidzone:
/system/bin/e2fsck -p -c /dev/block/mmcblk0p2
sh: badblocks: command not found
/dev/block/mmcblk0p2: Updating bad block inode.
/dev/block/mmcblk0p2: 4695/65664 files (1.9% non-contiguous), 237769/262144 bloc
ks
sh-3.2#

Is it true? >90% of my sdcard ext4 partition is bad blocks?
[Desire Android Development] sibere:
Looking at your code, you did from recovery. Unfortunately, the command "badblocks" used by e2fsck doesn't exist. So it did nothing.

1.9% is the fragmentation level (non contiguous files)

You should run a badblocks check from a linux box/live cd
[Desire Android Development] Droidzone:
From my Ubuntu livecd:

ubuntu@ubuntu:~$ mount
aufs on / type aufs (rw)
none on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
/dev/sr0 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/sdb1 on /media/E687-80D0 type vfat (rw,nosuid,nodev,uhelper=udisks,uid=999,gid=999,shortname=mixed,dmask=0077,utf8=1,showexec,flush)
/dev/sdb2 on /media/c3c6f412-519a-4a51-8b89-326f1b19098a type ext4 (rw,nosuid,nodev,uhelper=udisks)
ubuntu@ubuntu:~$ umount /media/E687-80D0
ubuntu@ubuntu:~$ umount /media/c3c6f412-519a-4a51-8b89-326f1b19098a
ubuntu@ubuntu:~$ e2fsck
Usage: e2fsck [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j external_journal]
[-E extended-options] device

Emergency help:
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume "yes" to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
ubuntu@ubuntu:~$ e2fsck -p -c /dev/sdb2
/dev/sdb2 is mounted.

WARNING!!! The filesystem is mounted. If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.

Do you really want to continue (y/n)? no

check aborted.
ubuntu@ubuntu:~$

I did umount before e2fsck. Should I actually umount /dev/sdb2 as well? It's being run on microsd reader

Whoops.. I cant umount ext4

It doesnt umount!!

Tried a -l and -f too.. Nothing I do can umount my ext4 system!

Just pulled it out and reinserted.. Would like to know if there is a more elegant solution :)

e2fsck is proceeding..no output on screen-wondering how long
[Desire Android Development] Droidzone:
Silly 2efsck finished without any output! :)
[Desire Android Development] sibere:
How well maybe it updated the badblocks list, or maybe after formating you got rid of those defective blocks :)