yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] woti23:
its in init.rc not in source code

first it creats rootfs rw

makes the root directories

mounts rootfs ro

and then

# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save acheckpoint
mount yaffs2 mtd@system /system
mount yaffs2 mtd@system /system ro remount

# We chown/chmod /data again so because mount is run as root + defaults
mount yaffs2 mtd@userdata /data nosuid nodev
chown system system /data
chmod 0771 /data
[Desire Android Development] Billys_gr:
Is it working with oxygen 1.0.4??
[Desire Android Development] moebius83:
that's exactly what I meant, I know that in order to change that I'll need to reflash a new boot.img with the changed init.rc because it gets overwritten at every boot, but it can be done, I was just wondering what problems could it cause and if anybody already tried this way...

I know that but unfortunately, since I rebooted the phone right after the problem appeared, the second e2fscklog.txt overwrote the first one where the problems probably showed...maybe I'll change the script slightly so at least two e2fscklog.txt are kept, so if it happens again I'll be able to inspect what happened.

EDIT: re-reading it I totally understand my previous post was not really clear...when I wrote about e2fsck error output I actually meant the exit code that I just found by reading "man e2fsck":

EXIT CODE
The exit code returned by e2fsck is the sum of the following conditions:
0 - No errors
1 - File system errors corrected
2 - File system errors corrected, system should
be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - E2fsck canceled by user request
128 - Shared library error

so maybe it's possible to handle them in the data2whatever script, like if exit code is 0 or 1 we proceed, if 2 we reboot the phone, for the other values I don't know what we could do :)

And when I wrote "change the init script" I meant the original init.rc not the init.d scripts :)
[Desire Android Development] xavierjohn22:
OKAY since there is NO easy way to uninstall "data2whatever" yet i will flash this in MIUI 12.24 and post i fit works just for kicks.
[Desire Android Development] iinga:
Its already been confirmed as working on MIUI 12-24

And just like apps2sd this can be "deactivated" by reflashing your rom over the top. And just like apps2sd it won't move all the stuff back to the NAND partition.
[Desire Android Development] bluelavender:
Melethron, you may update your OP in the first page... Auraxtsense works really really well... no lag.
[Desire Android Development] xavierjohn22:
yeah that reflashing over the top is still a lot of work to get back

I'll try it in MIUI Au, there's a different horse every now and then so if i try it it would confirm for MIUI Au 12.24 as well
[Desire Android Development] fisha21:
Cannot get this to work with Leedroid 2.2f. Tried wiping then installing as per instructions, and just get the white HTC screen after the phone has booted. If I try doing it without wiping, the phone won't boot past the very first splash screen.

Don't want to change my ROM just to get this working!! Anyone any ideas?
[Desire Android Development] bemymonkey:
Has anyone noticed a difference (speed-wise) between this and Firerat's scripts? I've been using Firerat's scripts (a2sdext 1.36c) for quite a while now, and they're not really noticably slower than using no A2SD at all...
[Desire Android Development] iinga:
I can't comment on whether or not its the same speed as no a2sd (only ever had it before i rooted) and i can't comment on firerat's script.

What I can say is that most of the time this runs smoothly, with only the occasional lag spike. I like it. I like having my whole data partition on ext storage.
[Desire Android Development] bemymonkey:
Did you notice any slowdown compared to no DATA2EXT?
[Desire Android Development] iinga:
Well if i'm not running data2ext, i'm running apps2sd. There are occasional lag spikes.

I think it may lag slightly more than apps2sd but not by much (on my card/setup).
[Desire Android Development] Orka82:
Did not find any option to "align to mb" in gparted but somthing about sector alignment. Is that the one? :)
[Desire Android Development] iinga:
I think so. Should be MB.

Also, gparted live cd tested and works (using virtual box - so should be even more straight forward when booting from it)
[Desire Android Development] Orka82:
New partition gives me "round to cylinders". Cant find anything about alignment. :)

I'll try the Live CD. :)
[Desire Android Development] iinga:
Check out the image i've attached. Just screenshotted it. See "Align to:"
[Desire Android Development] Orka82:
Hmm. I don't have that.

I'll try the live cd.

Edit: Live CD worked. :)
[Desire Android Development] woti23:
i'm looking forward to someone getting on this, and make the init process more configurable

eg. tmpfs mounted on /app-ache (= 8 MB ram) doesn't make sense if one doesn't use com.android.browser, and even if, could be more flexible

(it is a symlink in bootcomplete.bravo.rc, that file is not writeable)

why this removing directory and linking to app-cache isn't done in init.d script is beyond me?

or utilisize a /etc/shutdown.d with run-parts similar to init.d?

or just mount /system and mount other things later
[Desire Android Development] melethron:
Now i get what you meant. Well if init.rc gets overwritten on every boot this doesnt look like a solution. About your log suggestion. Ill take a look at it to make 1 log of the last boot and separete logs (with date and time) if an error is found.

It is slower in most cases (depends on sd controller - not on class). You will get lags for sure on downloads (market, internet through wifi, copy from pc). You have to test if it is ok for you. Maybe you notice no slowdowns at all. I cant even give you info on how it will behave since it is impossible to get informations of the controllers used in sd-cards.

Just give it a try ...

Never used gparted live-cd since i have ubuntu i dont need this ....

BUT .... i just finished my alignment script. Data2whatever will check if the partition is aligned and if not it will recreate it with a 1024k alignment.

Im just about to test it. After i did some tests i'll update the OP with the data2whatever v0.3 pre-alpha.

If you want to try it .... PLEASE BACKUP YOUR SD-CARD BEFORE. Since it will change the partition table it could mess things up and so you'll have to repartition the sd-card. That is not a problem and can be done with recovery, but as you might know this will erase all data on the sdcard.
[Desire Android Development] melethron:
:( hmmm ... thought i have the first test subject for the new version ....
[Desire Android Development] Orka82:
Got no speed improvement.

Do you know if amonra's recovery reformats my ext4 without the alignment?

I'll try your script for sure.

TitaniumBackup and sd backed up to computer. :)

Edit:

In logcat, i cant see anything about life-on-the-edge now..
[Desire Android Development] moebius83:
so I assume you're just going to check if the partition is aligned, if it's not you delete it and re-create it, so if the ext partition already exists, it's not aligned and it has stuff on it nothing is possible unless you wipe it...

for what I can say, formatting doesn't change partition alignment, it changes only if you delete and re-create a partition
[Desire Android Development] woti23:
it's overwritten by the bootimage, if the rc script in bootimage would be altered and the bootimage flashed, it stays permanent, doesn't it?
[Desire Android Development] moebius83:
yes it does, but of course this will fork from the purpose of this data2whatever script, it's going to be something else

EDIT: and most importantly, it will not be universal since the boot.img differs from rom to rom
[Desire Android Development] woti23:
yes, it is going to something melethron thought about before, eg replacing yaffs for data and cache with another filesystem
[Desire Android Development] melethron:
Hmm.... seems like an issue with your busybox (busybox mount) in conjunction with the missing mtab. mtab is fixed in v0.3 and i also added busybox 1.17.2 to assure compatibility.

New version worked on first test but i want to check something else first.
[Desire Android Development] Orka82:
Nice. I'm waiting. :)
[Desire Android Development] woti23:
mtab must e a writable file and contains the actually mounted files, so /system/etc would have to be writable or mtab a symlink

fstab contains the mountpoints and filesystems and options to use

btw: there are two mount commands

in

/system/bin

/system/xbin

first is symlink to toolbox, second to busybox, whatever PATH contains first would be executed
[Desire Android Development] Orka82:
Good work. I'll try when the new version is up. :)
[Desire Android Development] wollyka:
hi first I want to thank you for the script.you are doing a great job :)

I tested both your script and sibere on leedroid 2.2f. Both worked ok but I noticed that when using any data2sd script,the sdcard speed (i mean the first fat32 partition) is a lot slower than when using a2sd+. I used sst program to benchmark the speed.

Leedroid with a2sd+: write 9 mb/s read 15mb/s

Leedroid with data2whatever or data2sd: write 4 mb/s read 15mb/s!

Why the script is affecting the first partition speed? is this normal? I know that any data2sd will cause lags but should it affect the write speed?

ps:i have a class 10 card
[Desire Android Development] xavierjohn22:
i can confirm this working on 12.24 MIUI AU but i am going back as normal. i can feel the difference in drag speed of icon when moving an icon from desktop to launcher, it pause for a while.

Uploaded with ImageShack.us
[Desire Android Development] melethron:
OP updated .... no more messing with gparted now. Partition gets aligned if its not. Please read the warning ... do a backup .... and test it.

Thanks for the tips. Everthing is already respected in v0.3. mtab is on internal data and symlinked to /etc/mtab. Also mount is always called with "busybox mount" and i added busybox 1.17.2 to the zip to assure compatibility. Apart from that i remove the 3 binaries (or symlinks) from /system/xbin and /system/bin.

The reason is this. On app2sd there are only apps on the sd-ext partition. On data2sd there is also the /data/data partition on the sd-ext. The only times there will be writes to the sd-ext partition on app2sd is when you install an app. If /data/data (the database for the apps) is on sd-ext there will be much more writes. If some app now writes stuff to /data/data while you run the benchmark you'll see a lower speed (and maybe even the benchmark uses /data/data while it is running). So yes this normal.
[Desire Android Development] melethron:
From what i see you dont need the space anyway ;) .

The life-on-the-edge mod reduces lags on some sd-cards by the way. People get different results there.
[Desire Android Development] Orka82:
Does not look good when copying from windows. ;)

Edit: Got this now:

The process com.htc.bgp has stopped unexpectedly. Please try again.

hmm

Edit2: Did not come back after reboot. :)
[Desire Android Development] xavierjohn22:
Yeah, that's a clean install though. Informations here are great. It's always fun for me to try somethng new to this phone, and it amazes me everytime, i'll continue to explore. great work!
[Desire Android Development] MrDevil:
just tested the new script worked flawlessly on cm 6 on the first try. unlike the 0.2 version. hmmm... could it be the busy box? notice alot of speed difference from the old patch. great work!

edit: i just noticed i have much more "internal" memory than in 0.2e. About 100mb additional. Could someone tell me what does it mean when a partition becomes "unclean"?
[Desire Android Development] _bryan_:
nice

I will try the new version today, and I will also try reiserfs.

Is reiserfs better than ext4?

I read the v0.3 if I use reiserfs and not aligned then the script format the second partition to ext4.
[Desire Android Development] Ninolina:
I will try this v0.3 version on Leedroid ROM and let you know how that work.. Just had to wait to finish backuping..:-) :-) :-)
[Desire Android Development] vivmar:
so,just for clarify: the 0.3 version don't touch/erase the Sd-fat32 partition,right?
[Desire Android Development] MrDevil:
Yup. And it's problem free for me. Unlike the previous version where i get fcs from market or other gapps from fresh install.
[Desire Android Development] alirezaafkar:
Hi.

my sd card is patriot 16 gb class 4.

im using version 0.2e and my phone specialy in settings has low speed !

any suggestion ?
[Desire Android Development] melethron:
The issue was either the mtab file or busybox. Both is fixed.

More memory comes from the reserved blocks. The partition gets formated with ext4 with the option "-m 0" (like in ownheres script - thx ownhere ;) ). Here is a quote from the mkfs.ext4 manual:

Fragmentation isn't a problem on a sd card since it is not a "rotational device" (for the same reason i use "noop" schedule instead of cfq/bfq).

If you have a 2GB ext partition the default 5% would be 100 mb reserverd space with a default formatation.

Btw i dont know if clockwork reformats with "default" options on a wipe of sd-ext (amon ra doesn't).

If you format in reiserfs you will use gparted anyway for this. Select "align to Mib" in gparted and it will be aligned then. Also repartitioning is only needed once. If the partitioning with gparted was wrong for some reason and you end up with a ext4 partition you can reformat that partition (without changing the partition) with mkfs.reiserFS.

It doesnt change fat32 partition. But it changes the partitiontable. In case something goes wrong it could make the whole partitiontable unreadable. This shouldn't be the case and i doubt this will ever happen to someone using this. But i still recommend a backup just to be sure.
[Desire Android Development] iinga:
Melethron: what happens if i use ReiserFS, but don't have the kernel supporting ReiserFS for one boot? Would I boot loop?
[Desire Android Development] melethron:
Stuck on splash1 (htc white screen / alpharev screen then). The reason is that the reiserfs can't be mounted to /data (and also the symlinks to the internal in /system/data_internal aren't there - /data is empty and read only then). The dalvikVM will not be able to create/access the dex files in /data/dalvik-cache and the system apps wont even start.

For sense you can use neophytes test kernel and for AOSP you can use benee's vorkkernel (since xmas update).

I plan to make a SVS Kernel with "deadline" scheduler from coutts source but i never messed with kernel source and this may take quite some time to figure out how i change stuff for the kernel.
[Desire Android Development] woti23:
yes, would bootloop, check kernel first

zcat /proc/config.gz |grep REISERFS

(if kernel supports config.gz in proc)
[Desire Android Development] alirezaafkar:
@melethron

do u read my previous post ?
[Desire Android Development] iinga:
Ok that's what i thought would happen.

Another question: how would i move the dalvik-cache to the cache partition. Everything I try seems to fail
[Desire Android Development] MrDevil:
thanks for the informative answer. but what about the unclean partitions u mention on leedroids thread, the ones caused by adb reboot recovery or the reboot menu, does it affect anything? what exactly is an unclean partition?
[Desire Android Development] sibere:
I tried this but I do not recommend it mainly because /cache is used by market to download apps
[Desire Android Development] Gaspedal:
Can I install data2whatever v0.3 over data2whatever v0.2 or is it required to reinstall the rom and v 0.3 ?
[Desire Android Development] sibere:
What I see is that you 1st partition is not aligned ;)

And because mtdblock5 is mounted and used by services/apps at boot time before 01data is started, I'm not sure that this bit of code is working properly on every ROM

busybox umount /data;
busybox sleep 1;
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mtdblock5 /system/data_internal;

I can tell you that at least on stock HTC froyo rom S-ON, it's not possible to unmount mtdblock5: "device or resource busy"

Just a quick question. Why do you chose 1024Kb alignment?

The maximum per SD standards is 256kb (http://www.mail-archive.com/devel@lists.laptop.org/msg20644.html)

Apparently this python scripts returns the actual erase block size of the card

#!/usr/bin/env python
import sys

def unstuff(x, start, size):
return (x >> start) & (2**size - 1)

def main(name, args):
if len(args) != 1:
print "Syntax: %s <card>" % (name, )
print "Example: %s mmcblk0" % (name, )
return 100

card = args[0]
dev = "/sys/class/block/%s/device/csd" % (card, )
csd = int(file(dev).read(), 16)
write_block_size = 2**unstuff(csd,22,4)
erase_block_size = write_block_size*(unstuff(csd,39,7)+1)
print "Erase block size of %s is %d bytes." % (card, erase_block_size)

sys.exit(main(sys.argv[0], sys.argv[1:]))

This could help to improve you script :)
[Desire Android Development] moebius83:
I wouldn't suggest to enable data2whatever or data2sd script with stock htc rom using the recovery-install trick to enable init.d, as I wrote on one of my previous post, that way of enabling init.d is dangerous and will most probably break things because init is asynchronous and while this or your data2sd scripts are running, the system keep booting, what can happen (it happened to me more than one time before I decided to flash a boot.img with a correct init.d implementation) is that if e2fsck or something else take too long to finish, your system will start with /data still mounted on mtblock5, or if you find a way to cleanly umount /data like I did using fuser to kill the keymapper process that's using /data at that moment, you'll risk booting the system with no /data mounted.

So, to summarize, these scripts are completely unsafe on stock htc rom unless a proper init.d is implemented.
[Desire Android Development] sibere:
True but partially.

On stock htc roms /data is unmounted cleanly on shutdown. Thsi changes a hell lot of things!

Never had any kind of bad issues with my data2sd script so far even after a lot of shutdown for testing things.
[Desire Android Development] kraml:
I use the stock rom from HTC. I modified by boot image to support init.d script, then flashed this. I use a Sandisk C2 16G TF, with second partition MiB aligned, formatted as ext3. So far so good, no much speed/lag feelings yet. The SD card speed test has dropped from 7MB/s to 5~6, but this is expected and explained in several earlier posts. THANK you and now I have room to play around!
[Desire Android Development] moebius83:
maybe it's because I'm using ext2 but my /data is never unmounted cleanly, at boot I always get some minor error reported, none of them seems to be seroius, even if I just use the stock htc menu to poweroff the phone:

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

userdata: ***** FILE SYSTEM WAS MODIFIED *****

4322 inodes used (5.58%)
293 non-contiguous inodes (6.8%)
# of inodes with ind/dind/tind blocks: 264/16/0
89156 blocks used (28.71%)
0 bad blocks
1 large file

3447 regular files
859 directories
0 character device files
0 block device files
0 fifos
0 links
7 symbolic links (7 fast symbolic links)
0 sockets
--------
4313 files
[Desire Android Development] moebius83:
I added some more control over the e2fsck output, this basically for me to understand the glitches I had if they're gonna happen again, but it may be useful for somebody else:

/system/bin/e2fsck_recvy -yvf /dev/block/mmcblk0p2 > /system/data_internal/e2fscklog.txt;
FSCHECK=$?;
# check output and save it to sdcard
busybox mount /dev/block/mmcblk0p1 /sdcard;
if [ $FSCHECK -ne 0 ]; then
if [ $FSCHECK -eq 1 ]; then
echo " - Filesystem errors detected and corrected";
elif [ $FSCHECK -eq 2 ]; then
echo " - Major filesystem errors detected, reboot needed!";
else
echo " - e2fsck exited with exit code: $FSCHECK unhandled serious error!";
fi
echo "--BEGIN" >> /sdcard/e2fscklog.txt;
date >> /sdcard/e2fscklog.txt;
echo "Filesystem errors detected, more info in the following log:" >> /sdcard/e2fscklog.txt;
echo >> /sdcard/e2fscklog.txt;
cat /system/data_internal/e2fscklog.txt >> /sdcard/e2fscklog.txt;
echo "--END" >> /sdcard/e2fscklog.txt;
echo >> /sdcard/e2fscklog.txt;
else
echo " - Filesystem is clean";
echo "--BEGIN" >> /sdcard/e2fscklog.txt;
date >> /sdcard/e2fscklog.txt;
echo "Filesystem is clean" >> /sdcard/e2fscklog.txt;
echo "--END" >> /sdcard/e2fscklog.txt;
echo >> /sdcard/e2fscklog.txt;
fi
busybox rm /system/data_internal/e2fscklog.txt;
busybox umount /sdcard;

if you substitute this part on the 01data2whatever you'll have a partial error handling.

This will keep an e2fscklog.txt history on the sdcard, meaning that it will keep all the outputs of e2fsck instead of overwriting the last one with the newer one.

The next test will be to automatically reboot the phone in case e2fsck returns with "2" meaning a reboot is required, but I want to test it before implementing it :)
[Desire Android Development] kraml:
As one of the post in this thread suggested, use a on property clause in init.rc and set that property in init.d script, could make the init.rc wait for scripts in init.d to finish first before it moves on. I also have modified my HTC stock rom in this way, so far it is OK for several reboots and I believe that is what it suppose to be.
[Desire Android Development] moebius83:
yep that was my post after looking how init.d was implemented on popular roms but in order to do that you'll need to flash a new boot.img :)
[Desire Android Development] kraml:
:D just have replied too quickly before go back find out the author of that post. In fact modify a boot img is not very complex and I think it could be done by a script that wrapped in an update.zip. I am not sure if anyone in this forum have already done that.
[Desire Android Development] woti23:
most of the custom roms have a 99complete script in init.d with

set property cm.filesystem.ready=1;

and in init.rc:

start sysinit

on property:cm.filesystem.ready=1

class_start default
[Desire Android Development] sibere:
your FS is OK.

It reports "modified" b/c of the -f flag (forced)

reboot into recovery, mount sd-ext and try tune2fs -l /sd-ext/ext2 and see if it shows clean or unclean status.
[Desire Android Development] melethron:
hmmm, i just thought about that i could make a separate the "alignment" zip that does the alignment while installing in recovery. So it could also be used for app2sd......

EDIT: Or well... not for now..... i have no idea how i get recovery to give some output when it runs a script. I dont think "uiprint" can get variables from a running script.....
[Desire Android Development] sibere:
Ho I see. I must have missed this info at some stage.

So basically those roms have a modified init.rc without setprop cm.filesystem.ready 1; to allow init.d scripts to run before using the FS, right?

This means that you can't use a simple stock rooted froyo ROM. It has to be at least tweaked to have a proper init.d enabled init.rc ramdisk file
[Desire Android Development] sibere:
If I get it right, init.rc stops here before it gets the right status after init.d has finished.

I'd like to have a look at a tweaked init.rc to compare with my stock rom. Any link for that?