[HOWTO] Convert ext4 partitions to No-Journaling mode - Galaxy S I9000 Android Development

WARNING: This procedure is risky and may result in loss of data.
This is a follow up to findings made in this thread: http://forum.xda-developers.com/showthread.php?t=819580
Many people have been asking for an ext2 lagfix. You can get something similar but (arguably) better: ext4 with no journaling. Ext4 no-journal performs as fast or faster than ext2 because of performance improvements made in ext4.
Quadrant comparison for ext4 /data-only lagfix:
ext4 scores about 1500, ext4 no-journal scores about 1650.
This should work with existing kernels that support ext4 lagfixes. It's tested on a ULFK kernel (SpeedMod).
WARNING: Turning off journaling makes your data more susceptible to getting corrupted, although the risk is small.
Disclaimer: No promises that this will work for you, or that it won't corrupt your data. Try this at your own risk.
Step 0: You start off by applying an ext4 lagfix. If you are already using an ext4 lagfix, you can skip this step.
For ULFK kernels, this is either:
- "Voodoo" ext4 /data
- No-RFS advanced ext4
After the lagfix has been successfully applied and your phone is up and running properly, then you can proceed to convert the ext4 partitions.
Step 1: Make a backup of your data, using CWM (recommended). If anything goes wrong, you can restore the backup later.
Step 2: Download the tune2fs file attached to this post (works for FROYO roms only), and copy it to /data as /data/tune2fs:
adb push tune2fs /sdcard/
adb shell
# su
# cp /sdcard/tune2fs /data/
Procedure if your kernel has ro.debuggable enabled:
Step 3: If your kernel has ro.debuggable enabled, then boot your phone into recovery mode. Then run adb in root mode:
adb root
(wait for adbd to restart)
adb shell
Copy tune2fs to the /tmp folder.
# cp /data/tune2fs /tmp/
If you don't have ro.debuggable enabled, "adb root" will give you an error. Go to Step 3A in the next section.
Step 4: Now in ADB shell, find out which partitions are ext4:
# mount | grep ext4
mount | grep ext4
/dev/block/mmcblk0p2 on /data type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
/dev/block/stl10 on /dbdata type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
/dev/block/stl11 on /cache type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
In this example, the 3 partitions are:
/dev/block/mmcblk0p2 (/data)
/dev/block/stl10 (/dbdata)
/dev/block/stl11 (/cache)
Repeat Steps 5 to 9 for every partition you want to remove the journal from.
The next steps show the procedure for /dev/block/mmcblk0p2 (/data).
Step 5: Unmount the partition:
umount partition_mount_point
for example:
# umount /data
Step 6: Check if there is a journal:
# /tmp/tune2fs -l /dev/block/mmcblk0p2 | grep features
You should see something like this:
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
You should see "has_journal" in the features. It means this partition has a journal.
Step 7: Fsck the partition:
# e2fsck -f /dev/block/mmcblk0p2
Step 8: Remove the journal:
# /tmp/tune2fs -O ^has_journal /dev/block/mmcblk0p2
(this is a capital "O"!)
Step 9: Check if the journal was removed:
# /tmp/tune2fs -l /dev/block/mmcblk0p2 | grep features
You should see something like this:
Filesystem features: ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
You should see "has_journal" is NOT there.
Done for this partition.
Step 10: After you've remove the journal from all the partitions you wanted to, shutdown the phone by pressing the power button.
DONE. You only need to do this procedure once and it'll "stick" until the next time you re-format the partition.
--------------------------------------------------
Procedure if you don't have ro.debuggable enabled:
Step 3A: If you kernel does not have ro.debuggable enabled, then you can try doing this using normal adb with su while the phone is running. But this is much more risky.
To lower the risk, do this right after booting, wait for the Media Scan to complete.
adb shell
# su
Step 4A: Now in ADB shell, find out which partitions are ext4:
# mount | grep ext4
mount | grep ext4
/dev/block/mmcblk0p2 on /data type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
/dev/block/stl10 on /dbdata type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
/dev/block/stl11 on /cache type ext4 (rw,noatime,barrier=0,data=writeback,noauto_da_alloc)
In this example, the 3 partitions are:
/dev/block/mmcblk0p2 (/data)
/dev/block/stl10 (/dbdata)
/dev/block/stl11 (/cache)
Repeat Steps 5A to 8A for every partition you want to remove the journal from.
The next steps show the procedure for /dev/block/mmcblk0p2 (/data).
Step 5A: Check if there is a journal:
# /data/tune2fs -l /dev/block/mmcblk0p2 | grep features
You should see something like this:
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
You should see "has_journal" in the features. It means this partition has a journal.
Step 6A: Fsck the partition:
# e2fsck -f /dev/block/mmcblk0p2
WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.
Do you really want to continue (y/n)?
Answer yes.
Step 7A: Remove the journal:
# /data/tune2fs -O ^has_journal /dev/block/mmcblk0p2
(this is a capital "O"!)
Step 8A: Check if the journal was removed:
# /data/tune2fs -l /dev/block/mmcblk0p2 | grep features
You should see something like this:
Filesystem features: ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
You should see "has_journal" is NOT there.
Done for this partition.
Step 9A: After you've remove the journal from all the partitions you wanted to, shutdown the phone by pressing the power button. Reboot the phone and hope everything works.
DONE. You only need to do this procedure once and it'll "stick" until the next time you re-format the partition.

Nice one!
Going to try this tomorrow!
__________________________
Device: GT-I9000 16GB
Rom: Doc's V8 Nude&Raw v3
Kernel: Hardcore's Speedmod K9A - 500 Hz
Modem: JPP
Lagfix: No RFS, ext4-ext2, no binds
Tweaks: I/O Sched, Kernel VM Management, Kernel sched

Please ignore.

danzgrace said:
http://www.mjmwired.net/kernel/Documentation/filesystems/ext4.txt#364
Data Mode
=========
There are 3 different data modes:
* writeback mode
In data=writeback mode, ext4 does not journal data at all. This mode provides a similar level of journaling as that of XFS, JFS, and ReiserFS in its default mode - metadata journaling. A crash+recovery can cause incorrect data to appear in files which were written shortly before the crash. This mode will typically provide the best ext4 performance.
* ordered mode
In data=ordered mode, ext4 only officially journals metadata, but it logically groups metadata information related to data changes with the data blocks into a single unit called a transaction. When it's time to write the new metadata out to disk, the associated data blocks are written first. In general,
this mode performs slightly slower than writeback but significantly faster than journal mode.
* journal mode
data=journal mode provides full data and metadata journaling. All new data is written to the journal first, and then to its final location.
In the event of a crash, the journal can be replayed, bringing both data and metadata into a consistent state. This mode is the slowest except when data needs to be read from and written to disk at the same time where it outperforms all others modes. Currently ext4 does not have delayed allocation support if this data journalling mode is selected.
Click to expand...
Click to collapse
Applying writeback mode is the best option.

danzgrace said:
Applying writeback mode is the best option.
Click to expand...
Click to collapse
Hi danzgrace. Those options you quoted are for journaled modes. data=writeback is still a journaled mode.
This procedure is for non-journaled mode (none of the above). Its faster than all of the above because there is *no* journal.

hardcore said:
Hi danzgrace. Those options you quoted are for journaled modes. data=writeback is still a journaled mode.
This procedure is for non-journaled mode (none of the above). Its faster than all of the above because there is *no* journal.
Click to expand...
Click to collapse
Yes. Just stumbled upon lots of docu about ext4 and you are right about the performance gain when there's no journal involve but kind of risky.
https://ext4.wiki.kernel.org/index.php/Ext4_Howto#.22No_Journaling.22_mode

danzgrace said:
Yes. Just stumbled upon lots of docu about ext4 and you are right about the performance gain when there's no journal involve but kind of risky.
https://ext4.wiki.kernel.org/index.php/Ext4_Howto#.22No_Journaling.22_mode
Click to expand...
Click to collapse
It should be no more risky than ext2. Been using it for a few days now and so far so good.

danzgrace said:
Yes. Just stumbled upon lots of docu about ext4 and you are right about the performance gain when there's no journal involve but kind of risky.
https://ext4.wiki.kernel.org/index.php/Ext4_Howto#.22No_Journaling.22_mode
Click to expand...
Click to collapse
But its not much more risky because writeback journal does not prevent data loss - it just removes the need of a filecheck after unclean unmounting. Data still can be lost or?
Sent from my GT-I9000 using XDA App

Can you implement this tweak in speedmod kernel?
Sent from my GT-I9000 using XDA App

IMO, keeping the journal, with the default data=ordered option, is a good safety vs. speed compromise.
However, have you tried fiddling with the commit= mount option? The default commit interval is 5 s - this could be what's detrimental to battery life (a wake every 5 seconds). Maybe upping this to 60, or even more, seconds? I myself wouldn't care if it were 5 minutes on a phone, but upping it to one minute should already show a significant battery life increase.

corgar said:
Can you implement this tweak in speedmod kernel?
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
Not that easy because I have to modify the recovery executable. Maybe at a later stage.

AnnihilatorSC said:
IMO, keeping the journal, with the default data=ordered option, is a good safety vs. speed compromise.
However, have you tried fiddling with the commit= mount option? The default commit interval is 5 s - this could be what's detrimental to battery life (a wake every 5 seconds). Maybe upping this to 60, or even more, seconds?
Click to expand...
Click to collapse
I'm not sure if this has any effect when there's no journal. But I guess it's worth a shot.

I hope there is a way to do this in a script and apply by update.zip in recovery. Please tell me this can be done...
In general use, just how much faster does this feel? I'm asking because regular ext4 does not feel much faster in general use than RFS using speedmod. Back when I was using JM8 + OCLF, k-9 Email was so much faster.

hardcore said:
I'm not sure if this has any effect when there's no journal. But I guess it's worth a shot.
Click to expand...
Click to collapse
It doesn't. But I aim to hang on to the journal.
You could try releasing a SpeedMod revision which mounts all ext4 fs's with commit=60. If you do, i'll be sure to report the battery life - the effect should already be obvious to me after a night on battery (I currently lose about 20% battery overnight - no-rfs advanced ext4, w/ defaults).

hardcore said:
I'm not sure if this has any effect when there's no journal. But I guess it's worth a shot.
Click to expand...
Click to collapse
I guess commit=60 or more and journal_async_commit, can save us a lot of battery power.

you can change the commit options by remounting the disk.. in adb or terminal with root..
mount -oremount,data=writeback,journal_async_commit,... /dev/block/... /data (for example)
you will lose it at phone reboot, too - but good for testing

bilboa1 said:
you can change the commit options by remounting the disk.. in adb or terminal with root..
mount -oremount,data=writeback,journal_async_commit,... /dev/block/... /data (for example)
you will lose it at phone reboot, too - but good for testing
Click to expand...
Click to collapse
not unless it was on your playlogos hack.

danzgrace said:
journal_async_commit, can save us a lot of battery power.
Click to expand...
Click to collapse
I sincerely doubt journal_async_commit would bring about better power utilization. Maybe a slight performance increase, but nothing significant. Personally, I wouldn't enable that option.

danzgrace said:
not unless it was on your playlogos hack.
Click to expand...
Click to collapse
SpeedMod and ULFK supports init scripts, without the playlogos hack.
Just name the script E_something.sh and place it in /system/etc/init.d/
For example /system/etc/init.d/E_startup.sh

hardcore said:
SpeedMod and ULFK supports init scripts, without the playlogos hack.
Just name the script E_something.sh and place it in /system/etc/init.d/
For example /system/etc/init.d/E_startup.sh
Click to expand...
Click to collapse
Thanks for the info. imho. I feel more safe putting the script on /data partition so if it fails I just factory reset rather than putting it on /system dir.

Related

[HOWTO] Optimal ext4 mount options

Hi guys,
Now that several lagfixes are using the ext4 filesystem, perhaps we should look at optimizing ext4 for performance and lifespan of the flash memory.
One of the main things we can change is the journaling method to data=writeback. This should reduce writes and improve performance at a slight expense of reliability. Quote:
"In data=writeback mode, ext4 does not journal data at all. This mode provides a similar level of journaling as that of XFS, JFS, and ReiserFS in its default mode - metadata journaling. A crash+recovery can cause incorrect data to appear in files which were written shortly before the crash. This mode will typically provide the best ext4 performance."
One explanation here:
http://blog.smartlogicsolutions.com...ions-to-improve-ext4-file-system-performance/
Reference here:
http://git.kernel.org/?p=linux/kern...02ac5fa36d7f4c07856fe9cf89391e08986f7;hb=HEAD
HOW TO
1. Change the default mount option of the partition using tune2fs. You need to use a version of tune2fs that supports ext4, the one in busybox 1.17 does NOT. A working version is attached to this post.
- Push the tune2fs file to the phone's SD CARD:
adb push tune2fs /sdcard/
- Copy the tune2fs file to /data/
adb shell
su
cp /sdcard/tune2fs /data/
Now change the options:
/data/tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
To verify:
/data/tune2fs -l /dev/block/mmcblk0p2
Look for the line that says:
Default mount options: journal_data_writeback
* Repeat the above for all other ext4 partitions.
It should take effect after a reboot. The next time it will be mounted automatically with data=writeback. You might have to do the tune2fs settings and reboot twice to get it to stick - I'm not sure why, but I had to.
You can verify this using the mount command:
# busybox mount | grep ext4
/dev/block/mmcblk0p2 on /data type ext4 (rw,noatime,barrier=0,nobh,data=writeback,noauto_da_alloc)
/dev/block/stl10 on /dbdata type ext4 (rw,noatime,barrier=0,nobh,data=writeback,noauto_da_alloc)
2. In addition to that, you can also edit the mount options to include the nobh option, which is a further minor optimization for data=writeback mode.
I personally use the options noatime,barrier=0,nobh,data=writeback. Voodoo already uses some of them like noatime and barrier=0.
I do it using a startup script (you need to know how to use/modify a startup script), with the following commands:
for k in $(busybox mount | grep ext4 | cut -d " " -f3)
do
sync
busybox mount -o remount,barrier=0,nobh $k
done
EDIT: Attached tune2fs that supports ext4. Works on Froyo kernels with ext4 support.
I posted the same request in another thread and i though it will be better if i do it here.
I found e2fsprogs-ext4.zip, but not sure if this is the correct zip.
it will be great if you can provide it here.
For others willing to try it, please change the /dev/block/mmcblk0pX to whatever you are using now.
my system is using /dev/block/mmcblk0p4
s88 said:
I posted the same request in another thread and i though it will be better if i do it here.
I found e2fsprogs-ext4.zip, but not sure if this is the correct zip.
it will be great if you can provide it here.
Click to expand...
Click to collapse
I've attached it here, it worked for me with the Universal Lagfix Froyo kernel that supports ext4.
hardcore said:
I've attached it here, it worked for me with the Universal Lagfix Froyo kernel that supports ext4.
Click to expand...
Click to collapse
And did you notice any improvements with new mount options?
busybox 1.17.1 says invalid option -o on tune2fs
==
i need the version attached to this thread, busybox version only supports ext2 and ext3
danzel said:
busybox 1.17.1 says invalid option -o on tune2fs
Click to expand...
Click to collapse
copy tune2fs into /system/xbin and chmod 755
Write back will cause data loses on crashes and it will increase read time on read miss since you need to write the block back to the main mem before reading a new block.
how & where do i edit mount options?
mdalacu said:
And did you notice any improvements with new mount options?
Click to expand...
Click to collapse
I didn't do any benchmarks, but in theory it should be better - reduced periodic journal writes (better battery life, flash lifespan and performance).
I don't know about performance but my SGS feels like a little bit snappier.
Thanks for this info.
chanw4 said:
Write back will cause data loses on crashes and it will increase read time on read miss since you need to write the block back to the main mem before reading a new block.
Click to expand...
Click to collapse
There is always a risk of slight data loss during crash, even with data=ordered. And we are already using some even more 'risky' options like barrier=0 and noauto_da_alloc anyway.
This setting increases the risk a bit more.
s88 said:
copy tune2fs into /system/xbin and chmod 755
Click to expand...
Click to collapse
He's referring to the busybox 1.17.1 version. It doesnt support the ext4 options. For the version attached here, you have to copy it to somewhere else like /data/ before u can execute it. You don't really need to copy it to /system/xbin.
hardcore said:
There is always a risk of slight data loss during crash, even with data=ordered. And we are already using some even more 'risky' options like barrier=0 and noauto_da_alloc anyway.
This setting increases the risk a bit more.
Click to expand...
Click to collapse
Yeah but I think at some point you're just throwing away the safety of EXT4, and might as well just use EXT2 since it writes faster even with these options on. (Can anybody confirm this? I did a check and EXT2 is still faster even with these mount options... while EXT4 reads faster. But writes are more important than reads on MoviNAND from my usability experience, since the reads are generally fast enough anyway.)
RyanZA said:
Yeah but I think at some point you're just throwing away the safety of EXT4, and might as well just use EXT2 since it writes faster even with these options on. (Can anybody confirm this? I did a check and EXT2 is still faster even with these mount options... while EXT4 reads faster. But writes are more important than reads on MoviNAND from my usability experience, since the reads are generally fast enough anyway.)
Click to expand...
Click to collapse
Hi Ryan, it's different. ext4 with data=writeback still uses journaling but only for metadata, which supposedly "provides a similar level of journaling as that of XFS, JFS, and ReiserFS".
So it's still safer than ext2 but without the speed (and more importantly, battery or flash write lifespan) impact full data+metadata journaling.
More detailed information in the sources here:
http://git.kernel.org/?p=linux/kern...02ac5fa36d7f4c07856fe9cf89391e08986f7;hb=HEAD
hardcore,
how do you change the mount options? like buffer from 1 to 0 and nobh, etc
s88 said:
hardcore,
how do you change the mount options? like buffer from 1 to 0 and nobh, etc
Click to expand...
Click to collapse
I've made a clearer procedure in the first post. To change some options you might need a startup script though.
hardcore said:
I didn't do any benchmarks, but in theory it should be better - reduced periodic journal writes (better battery life, flash lifespan and performance).
Click to expand...
Click to collapse
That sounds very promising
Followed the procedure - had to do it twice as well to make it stick...dont see any obvious changes in the last 5 minutes. Will update after using it for a while.
PS: how persistent is that setting? what circumstance does it get reset? When a new kernel is installed?
Does it work with 2.1 too?
bobbel said:
Does it work with 2.1 too?
Click to expand...
Click to collapse
yes, it does. I am using JM9, and it feel faster.
take note i only change the data to write_back, haven't figure out a way to do the rest.
for write back, it can be done on the terminal emulator.
s88 said:
yes, it does. I am using JM9, and it feel faster.
take note i only change the data to write_back, haven't figure out a way to do the rest.
for write back, it can be done on the terminal emulator.
Click to expand...
Click to collapse
Cool, I give it a try.
One Question:
When I enter the mount cmd I have:
/dev/block/mmcblk0p4 /data ext4 rw,noatime,...
So I have to use
/data/tune2fs -o journal_data_writeback /dev/block/mmcblk0p4 (instead mmcblk0p2)
Right?

Exploring how to get Android to cleanly unmount /data

Several of us are exploring how to change an Android build so that it unmounts the /data partition cleanly when shutting down. This thread is dedicated to discussion of how to do that. Solutions may eventually appear here, but will work their way into the various build and/or kernel threads.
reserved
Watch this space for a summary of answers and solutions.
Roughly how it works today
The Shutdown thread stops applications, and then tells the Volume Manager to shutdown. After that, the Shutdown thread calls reboot() which calls _reboot() which turns off power.
I think the key is in Volume Manager.
Volume Manager's Java code works with the C++ application "vold".
Volume Manager gets a list of mounted filesystems from vold.
Vold returns a list that it manages, not the same as "df" or "mount" from the command line. That list (at least in Fresh Froyo) does not include /data or /cache.
Volume Manager then, for each filesystem in the list, tells vold to unmount the filesystem. Each filesystem has a timeout, and Volume Manager eventually either finds success or gives up.
The "vold" application can be controlled with a command-line executable called "vdc". Commands like : "vdc volume unmount /sdcard" or "vdc volume list", use the same syntax as Volume Manager uses to talk to vold.
Perhaps the answer to all of this is to get /data registered with vold at startup.
What I have tried, with great failure, is a terrible hack where I modified the implementation of reboot() to call system("/system/bin/rosysdata") before calling _reboot(). Then I created /system/bin/rosysdata to remount /system and /data as r/o. That worked for a couple of shutdowns, but after that caused extreme filesystem failure a few times. It was a bad hack anyway, so I have never committed that.
If we can get the /data filesystem mounted by vold instead of just mounting it in the bootup scripts, it should get unmounted at shutdown, since VolumeManager gets a list of mounted volumes from vold and unmounts each of them.
I am trying this but don't have much success yet.
Another idea is to get android to execute a shutdown script as it shuts down.
The old initrd create severl problems with mounting because there was several binding to the data partition.
Now there is only one /data mounted to the partition.
The old script files has the problem with the binding but now they should work.
I think that vold can't be used with data so we need to exec:
Code:
sync
mount -o remount,ro /data
in a shutdown script.
energy cut
what about when the system crashes and battery has to be removed?
anergy cut ...
What about use different partitions?
/system, /data and /cache as different partitions...
the highest activity of reading and writing happens in /cache. Am I right?
I'll change the nbh and sysinit.rc to meet this.
tiagoclc said:
what about when the system crashes and battery has to be removed?
anergy cut ...
What about use different partitions?
/system, /data and /cache as different partitions...
the highest activity of reading and writing happens in /cache. Am I right?
I'll change the nbh and sysinit.rc to meet this.
Click to expand...
Click to collapse
Isn't /cache a symlink to /data/tmpcache ? couldn't we redirect to /mnt/sdcard/cache ? (or anywhere else ?)
Due to these issues I can reboot normally only if I clear Dalvik cache. Maybe it could be automatic on boot lol
drvitorino said:
Due to these issues I can reboot normally only if I clear Dalvik cache. Maybe it could be automatic on boot lol
Click to expand...
Click to collapse
I second this or how about we manually enter mount -o remount, ro /data on terminal before turning it off?
ohohoh, apparently L1qu1d fixed my issue with the new kernel and the update from http://forum.xda-developers.com/showthread.php?t=848921
Unfortunately wi-fi and data connection is still not working with the update in my kaiser. But L1qu1d may be happy to know that his code inside the update has something that fix data corruption when turning off/on the device.
drvitorino said:
ohohoh, apparently L1qu1d fixed my issue with the new kernel and the update from http://forum.xda-developers.com/showthread.php?t=848921
Unfortunately wi-fi and data connection is still not working with the update in my kaiser. But L1qu1d may be happy to know that his code inside the update has something that fix data corruption when turning off/on the device.
Click to expand...
Click to collapse
In my test, some data corruption still exists (when lots of widgets and data partition close to full) but is easily corrected by clearing the dalvik-cache, but some apps are lost in the launcher. I still think that unmounting the data partition before turning off or reboot is the best way to prevent this.
n2rjt said:
The Shutdown thread stops applications, and then tells the Volume Manager to shutdown. After that, the Shutdown thread calls reboot() which calls _reboot() which turns off power.
I think the key is in Volume Manager.
Volume Manager's Java code works with the C++ application "vold".
Volume Manager gets a list of mounted filesystems from vold.
Vold returns a list that it manages, not the same as "df" or "mount" from the command line. That list (at least in Fresh Froyo) does not include /data or /cache.
Volume Manager then, for each filesystem in the list, tells vold to unmount the filesystem. Each filesystem has a timeout, and Volume Manager eventually either finds success or gives up.
The "vold" application can be controlled with a command-line executable called "vdc". Commands like : "vdc volume unmount /sdcard" or "vdc volume list", use the same syntax as Volume Manager uses to talk to vold.
Perhaps the answer to all of this is to get /data registered with vold at startup.
Click to expand...
Click to collapse
Since our data is installed in NAND, I don't think "vold" can mount Nand partition. Not too sure though.
clemsyn said:
Since our data is installed in NAND, I don't think "vold" can mount Nand partition. Not too sure though.
Click to expand...
Click to collapse
from: http://osdir.com/ml/android-porting/2010-06/msg00279.html
Vold doesn't mount Nand.
Mounting of Nand partitions is done in init.rc
mountd: mount all fs defined in /system/etc/mountd.conf if started,
receive commands through local socket to mount any fs. The source is
in device/system/bin/mountd.
-
Sreekanth
On Jun 24, 5:47 pm, "Dennis.Yxun" <[email protected]> wrote:
> HI Community:
> I'm using donut branch, and my system have two block devices, I want them
> all mounted
> 1) nand flash: /dev/block/sdb
> 2) MMC/SD card: /dev/block/mmcblk0
>
> Current, I successfully use vold mount the MMC/SD card
> (/dev/block/vold/179:0 -> /dev/block/mmcblk0)
>
> My question here is :
> Does vold support to mount the Nand Device too? like
> mount /dev/block/sdb to /sdcard/nand
> mount /dev/block/mmcblk0 to /sdcard/mmc
>
> Dennis
is this true?

[~SOLVED] Problem: Can't mount sd-ext

SOLVED: This was fixed by adding and using e2fsck, see the link in post #3. I had issues using adb push to install the tools, see the CyanogenMod thread. I do NOT believe the parted files he linked were intended to be used on ext4, so YMMV, but it did convert my fscked up ext4 partition to a over-writable ext2.
*********************************
I am having a problem with my sd-ext partition being unable to mount. After a relatively routine procedure, I suddenly have this problem (below), for example when I tried to Nandroid Restore my sd-ext partition.
Code:
E:Can't mount /dev/block/mmcblk0p2
(File exists)
Setup: HTC Desire; HBOOT 0.93, S-ON; ClockWorkMod v2.5.0.7; CyanogenMod-6.0.2; DTapps2sd
I was trying the relatively simple procedure of removing a couple of system Apps, according to the instructions on the CyanogenMod Wiki:Barebones.
I had minor problems with capitalization since I'm using Windows.
I removed Calculator, Email, and Calendar. Upon restart, all of my Apps are gone, except the few system apps and GApps that were not moved via dtapps2sd.
The phone still "works", I can send/receive SMS, make calls etc., but it's pretty highly crippled.
I've tried a Nandroid Restore, but it gives this message above (as did my attempt to do a Nandroid Backup).
The dtapps2sd "repair" command also said something about "cannot mount".
I tried to wipe and reflash CyanogenMod, which worked (in that it did re-flash). But when I tried to then Restore, I got the same "Can't mount" problem.
I also tried the following fastboot command I found in another thread, with no effect
Code:
fastboot oem enableqxdm 0
fastboot reboot
I have noticed that whey I use Terminal Emulator, the Permissions on mmcblk0p2 don't match the other blocks. Could this be related? Sadly, my Linux karate is weak :/
Code:
$ cd /dev/block
$ ls -al
..
..
brw------ .. .. .. .. .. mmcblk0p1
brw-r--r--.. .. .. .. .. mmcblk0p2
brw------ .. .. .. .. .. mmcblk0p1
..
I guess I haven't yet tried the HTC RUU, which is always a possible fallback. Or I could try to flash a stock PB99IMG.ZIP file. But those seem like just a generic "solution" that doesn't really involve any understanding. And it certainly doesn't help others with this same problem, or to figure out what I did to create this problem, so others could avoid that.
UPDATE: Link for PB99IMG.ZIP. It's ~140MB, and ROM+Radio specific, so no I won't post it here.
http://shipped-roms.com/shipped/Bravo/
Still trying
I just tried another suggestion from these threads:
http://code.google.com/p/cyanogenmod/issues/detail?id=1614
http://forum.cyanogenmod.com/index.php?/topic/253-test-builds/page__st__380__p__6124#entry6124
Code:
adb shell
# su
# tune2fs -O ^huge_file /dev/block/mmcblk0p2
# sync
# reboot
But that did nothing for me.
More info
Following along from raskolnik
http://forum.cyanogenmod.com/topic/...ternal-storage/page__view__findpost__p__56396
I now have parted (and others) added to my ClockWorkMod Recovery
Below is the partition info for my SD card
Code:
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: SD USD (sd/mmc)
Disk /dev/block/mmcblk0: 8017MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 7444MB 7444MB primary fat32
2 7444MB 7979MB 535MB primary ext4
3 7979MB 8011MB 32.9MB primary linux-swap(v1)
I followed that up with a check with e2fsck
Code:
~ # e2fsck /dev/block/mmcblk0p2
e2fsck /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
e2fsck: Group descriptors look bad... trying backup blocks...
Superblock has an invalid journal (inode 8).
Clear<y>? n
no
e2fsck: Illegal inode number while checking ext3 journal for /dev/block/mmcblk0p2
I decided NOT to go through with clearing the journal, as I don't really understand what implications that would have.
UPDATE:
Actually, I could only do adb push for the fiiles parted et al. after I had rebooted into CWM Recovery. When I rebooted normally, now the files are gone. I suppose this has something to do with the fact that I am still S-ON, since when the adb push failed, I got a response like "... read-only file system"
More Info:
I just did adb pull /etc/fstab. It looks like this
Code:
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mmcblk0p1 /sdcard vfat rw
/dev/block/mmcblk0p2 /sd-ext auto rw
[SOLVED] kinda
LEARN BY DOING!!!
So, I got anxious and just went ahead with the e2fsck command from above.
There were a LOT of problems (so many I had to .zip the attachment, it was waay over the forum .txt size limit) But, probly the tool wasn't meant for ext4...? I know that the actual Linux version does support ext4, but this one...?
Anyway, see the attached log if you want to check out more details. I don't really know WHAT all happened, whether anything good or bad went down.
I haven't really "Learned" anything, but the problem is fixed, more or less. After doing e2fsck, I was able to do a Nandroid Restore, and the mmcblk0p2 problem(s) were gone.
Spoiler: Semi-related minutia
Of course, since I had been careless and not done a Backup in about a week, actually ended up restoring last weeks' backup, then restoring last nights' backup sans sd-ext, then doing dtapps2sd: repair, remove, reinstall, repair. Then some manual app reinstalls, a couple widgets, and some shortcuts. Overall, tho, I think I only lost one SMS through the whole deal.
ScottHW said:
LEARN BY DOING!!!
So, I got anxious and just went ahead with the e2fsck command from above.
There were a LOT of problems (so many I had to .zip the attachment, it was waay over the forum .txt size limit) But, probly the tool wasn't meant for ext4...? I know that the actual Linux version does support ext4, but this one...?
Anyway, see the attached log if you want to check out more details. I don't really know WHAT all happened, whether anything good or bad went down.
I haven't really "Learned" anything, but the problem is fixed, more or less. After doing e2fsck, I was able to do a Nandroid Restore, and the mmcblk0p2 problem(s) were gone.
Spoiler: Semi-related minutia
Of course, since I had been careless and not done a Backup in about a week, actually ended up restoring last weeks' backup, then restoring last nights' backup sans sd-ext, then doing dtapps2sd: repair, remove, reinstall, repair. Then some manual app reinstalls, a couple widgets, and some shortcuts. Overall, tho, I think I only lost one SMS through the whole deal.
Click to expand...
Click to collapse
hi, i'm facing problem more or less just like you. I'm trying using e2fsck but it keep saying the super block can not be read or does not describe a correct ext2 system.
do you have any idea?
semi-brick.
Linking the problems
Just trying to link the thread involving my problem issue to this one as both are similar.
http://forum.xda-developers.com/showthread.php?p=44617022#post44617022
e2fsck seems to be the key to solve it as S2E log could automatically solve it. S2E is not compatible with higher android version ROMs that's all.

[MOD] How to replace /cache partition with a virtual one (any size)

I found a solution to temporarily replace the /cache partition with a virtual one having any arbitrary size.
I made a script that creates an empty file (64MB but it can be larger) on /data/local. Then it creates an ext4 filesystem on the file, unmounts the /cache and finally mounts the file as the cache partition through the loop device.
This virtual partition works until the next reboot and then the old /cache partition is mounted again.
To test this, copy the script to your phone give it executable permissions and run it through adb shell or a terminal. You have to be root and have busybox installed
I tested the script on stock JVQ, Semaphore kernel and works OK.
You may find a CWM edition (thanks to corgar) here. This version will create the cache partition (50 MB) in the /dbdata.
Use this script only if you know what you are doing and with your own risk!.
What does this do exactly? Does it take part of the flash memory to use as cache instead of RAM? I dont know much about advanced hacking etc, but this sounds like it could fix my constantly restarting apps when there are too many apps opened at the same time, or too many processes running at the same time. or are those things unrelated with this?
neswii said:
What does this do exactly? Does it take part of the flash memory to use as cache instead of RAM? I dont know much about advanced hacking etc, but this sounds like it could fix my constantly restarting apps when there are too many apps opened at the same time, or too many processes running at the same time. or are those things unrelated with this?
Click to expand...
Click to collapse
No, it creates a file in the /data partition and mount it as cache. I don't think that this will solve you the problem.
I made it mostly for people who want to download applications more that 30 MB from market
Nice idea @stratosk! I must give this a try!
Anyone tried this?
Please for your feedback.
I'm ready to test during the day. Do you have any name of a free app bigger than 30 Mb we can download to validate it works?
I've runned the script with SGS Tools. It runs ok, and creates a bigger cache partition, but i still can't download bigger apps on market, although it now gives me a different error (before was something like: There isn't space on this device. And now it is something like: There was an error). Tried with "Battle Bears 1 Lite" and "Extreme Formula"
EDIT: is it ok to run with SGS tools? I don't know how to run them in Terminal! Someone could tell me how?
EDIT 2: Actually i've tried now, and i can't download any apps from market!
lucbl1 said:
I've runned the script with SGS Tools. It runs ok, and creates a bigger cache partition, but i still can't download bigger apps on market, although it now gives me a different error (before was something like: There isn't space on this device. And now it is something like: There was an error). Tried with "Battle Bears 1 Lite" and "Extreme Formula"
EDIT: is it ok to run with SGS tools? I don't know how to run them in Terminal! Someone could tell me how?
EDIT 2: Actually i've tried now, and i can't download any apps from market!
Click to expand...
Click to collapse
Are you sure you have enough space on /data ?
stratosk said:
Are you sure you have enough space on /data ?
Click to expand...
Click to collapse
Yeah, pretty sure.
I've rebooted my device now, and downloads work fine again, except of course of those bigger than 30mb (actually 26mb, since ext4 conversion uses 4mb on cache).
PS: thinking about it now, could it be that the 4mb of ext4 conversion is keeping me from downloading the apps properly?
Just modified that script to move cache in dbdata ( onenand). A little request how to mount without specify fs? Instead of mount -t ext4. Thx
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
Just modified that script to move cache in dbdata ( onenand). A little request how to mount without specify fs? Instead of mount -t ext4. Thx
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
I have to test this, because the script makes ext4 file system on the cache.img. So it should be mounted as ext4
lucbl1 said:
Yeah, pretty sure.
I've rebooted my device now, and downloads work fine again, except of course of those bigger than 30mb (actually 26mb, since ext4 conversion uses 4mb on cache).
PS: thinking about it now, could it be that the 4mb of ext4 conversion is keeping me from downloading the apps properly?
Click to expand...
Click to collapse
I'm not sure about this.
If you don't use this remember to delete the cache.img file from /data/local because it's 64MB
If i delete the conversion and want to make the script dynamic? Mount rfs if rfs or mount ext4 if ext4. Dbdata is converted by kernel and by user decision so making it dynamically check is a must have i think.
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
If i delete the conversion and want to make the script dynamic? Mount rfs if rfs or mount ext4 if ext4. Dbdata is converted by kernel and by user decision so making it dynamically check is a must have i think.
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
Actually you may have dbdata in rfs and the file system of the cache.img could be ext4. You make and independent file system on this file
ok after some testing and tuning up, and since market apps can go up to 50mb maximum, and dbdata is on fast onenand i've modified a bit your script.
Code:
#!/system/bin/sh
#
# stratosk - 27/07/2011
# Corgar - 28/07/2011 ( changed location of cache in dbdata for onenand i/o, decreased cache dimension to 50mb )
# Remount /cache partition with a larger one (54.5 MB / 50mb cache)
# create a file 54.4 MB
dd if=/dev/zero of=/dbdata/cache.img bs=1024 count=55808
# create ext4 filesystem
mke2fs -F -T ext4 /dbdata/cache.img
# unmounting old cache partition
umount /dev/block/stl11
# mount
losetup /dev/block/loop7 /dbdata/cache.img
mount -t ext4 /dev/block/loop7 /cache
chown system.cache /cache
chmod 770 /cache
here are the script to push in /system/init.d folder. i'm not making a cwm flashable zip because is still in test version and i prefer at the moment to be used only by "veteran" user.
thx anyway to stratosk.
Download Here!
Nice script !
But why not make it on the sdcard ?
It should not have any problem there regarding space issues.
sdcard is mounted and checked after fs integrity check.
sdcard is slow compared to onenand memory. also sdcard is more fragmented than internal memory.
Any feedback?
Anyone tried this?
Running flawlessy on my custom rom. Very nice job indeed. Thx man. If you need a link Just ask but It's only for italian customer.
Inviato dal mio GT-I9000 usando Tapatalk
corgar said:
Running flawlessy on my custom rom. Very nice job indeed. Thx man. If you need a link Just ask but It's only for italian customer.
Inviato dal mio GT-I9000 usando Tapatalk
Click to expand...
Click to collapse
Glad to hear that
Did you test it on market applications > 30 mb?
Thanks for feedback.
P.S. with similar manner you can make portable (and maybe encrypted) filesystem. Create a file mount it as filesystem, write anything you want in it, then umount and mount somewhere else... Even in other phone or in your linux box
Edit: yes please send me the link

[HowTo] Use swap to get much more performance !

What is Swap?
Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.
Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.
However, swapping does have a downside. Compared to memory, disks are very slow. Memory speeds can be measured in nanoseconds, while disks are measured in milliseconds, so accessing the disk can be tens of thousands times slower than accessing physical memory. The more swapping that occurs, the slower your system will be. Sometimes excessive swapping or thrashing occurs where a page is swapped out and then very soon swapped in and then swapped out again and so on. In such situations the system is struggling to find free memory and keep applications running at the same time. In this case only adding more RAM will help.
Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.
I want that on my Phone, how to do that?
Okay, here goes the real story. Since Android is Linux, that would be possible.
What is needed:
- Fast (Class 10) Micro-SD Card, if you dont have class 10, class 4 would be great too..
- CWM or Partitioning software
- Root (of course )
- Terminal Emulator app
- Kernel with swap and init.d support (for example our CM7, 9, 10 and 10.1 ROM)
- Root Exploring app (for example Root Browser or Root Explorer)
Steps:
1. Partition your SD Card, Ask Google how to do that. Make new Swap partition, or you want SD-ext too..
2. Open Terminal Emulator, do:
Code:
su
fdisk -l dev/block/mmcblk0
3. You'll see something like this:
Code:
/dev/block/mmcblk0p3 1861 1924 514080 82 Linux swap
4. Do the following code, change with your exact swap partition:
Code:
su
swapon /dev/block/mmcblk0p3
*change 3 with yours
5. Now you can check your swap partition by doing:
Code:
free
Now we create the script to do that automatically at boot
1. Open Root exploring apps, head to /system/etc/init.d
2. Make a new file, named 05swap
3. Edit that file, copy this up:
Code:
#!/system/bin/sh
echo Swap enabled
swapon -a
4. Save it and change the permission to :
V V V
V V V
V V V
*tick all the boxes (rwxrwxrwx)
5. Now head to /system/etc and create new file named fstab
6. Open it and enter this:
Code:
/dev/block/mmcblk0p3 swap swap
*remember, change the 3 with yours
Now we set the swappiness value
*the normal value is 60, but you can change to what number you want (max 100). Higher may help to improve overall performance, while setting it to lower may increase interactivity and overall stability.
1. Do this on Terminal Emulator
Code:
su
echo vm.swappiness=60 >> /system/etc/sysctl.conf
2. Reboot and you're done.
Thanks to:
- Linux.com (for the swap definitions)
- Segnale007 (for the swap how to)
First! :laugh: No just kidding. Great guide! Maybe you should cover the Swapper 2, it does it without any second partition.
X-zone said:
First! :laugh: No just kidding. Great guide! Maybe you should cover the Swapper 2, it does it without any second partition.
Click to expand...
Click to collapse
Swapper2 doesn't working fine on my phone lol
I get a error on your first step
"fdisk: can't open 'dev/block/mmcblk0': No such file or directory"
EvilKing009 said:
I get a error on your first step
"fdisk: can't open 'dev/block/mmcblk0': No such file or directory"
Click to expand...
Click to collapse
u need to partition ur sdcard first
simple and exlcellent
Thank you very much for this. :good:
AngSanley said:
u need to partition ur sdcard first
Click to expand...
Click to collapse
EvilKing009 said:
I get a error on your first step
"fdisk: can't open 'dev/block/mmcblk0': No such file or directory"
Click to expand...
Click to collapse
Is because the command does not use system path, it assumes you're in '/'.
Just use
fdisk -l /dev/block/mmcblk0
Sent from my GT-S5660 using xda app-developers app
AngSanley said:
Now we set the swappiness value
*the normal value is 60, but you can change to what number you want (max 100). Higher may help to improve overall performance, while setting it to lower may increase interactivity and overall stability.
1. Do this on Terminal Emulator
Code:
su
echo vm.swappiness=60 >> /system/etc/sysctl.conf
Click to expand...
Click to collapse
I can't find this file! I am in JellyBean 4.2.2, maybe its different file?
/system/etc/sysctl.conf
blazzer12 said:
I can't find this file! I am in JellyBean 4.2.2, maybe its different file?
/system/etc/sysctl.conf
Click to expand...
Click to collapse
Create it, new file
Btw i say do it in the terminal emulator, its easier
Sent from my GT-S5660 using xda premium
Can Plead
Please provide a zip file
To install the Recovery
Thank
$ su
#
# fdisk -l dev/block/mmcblk0
Disk dev/block/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
dev/block/mmcblk0p1 129 195840 6262784 b Win95 FAT32
Partition 1 does not end on cylinder boundary
dev/block/mmcblk0p2 195841 228608 1048576 83 Linux
Partition 2 does not end on cylinder boundary
dev/block/mmcblk0p3 228609 242464 443392 82 Linux swap
Partition 3 does not end on cylinder boundary
# free
total used free shared buffers
Mem: 285732 277168 8564 0 2584
-/+ buffers: 274584 11148
Swap: 443388 63756 379632
# swapon /dev/block/mmcblk0p3
swapon: /dev/block/mmcblk0p3: Device or resource busy
# free
total used free shared buffers
Mem: 285732 279088 6644 0 2592
-/+ buffers: 276496 9236
Swap: 443388 63240 380148
# swapon /dev/block/mmcblk0p3
swapon: /dev/block/mmcblk0p3: Device or resource busy
#
What is wrong? Is swap partition already on? I'm on M'rage rom.
Sent from my GT-S5660 using xda app-developers app
Excellent work man! :good:
It works perfect, but you should make flashable zip file for this work
i made flashable zip but at the moment dont have phone.. is this ok?View attachment swap.zip
doctor-who said:
i made flashable zip but at the moment dont have phone.. is this ok?View attachment 2880098
Click to expand...
Click to collapse
Anyone that tried this that can confirm if it works?
thanks
i am using Joyos 2. 3. 7. (Android)rom and this is what i get flashing the swam.zip...
E:error in storage/sdcard0/swap.zip
(status 0)
installation aborted
also adding the command su
echo vm.swappiness=60 >> /system/etc/sysctl.conf
cannot create /system/etc/sysctl.conf read-only file system
#
even after adding the files etc/sysctl.conf (with the aromat zip file manager) with read wright permission
i am using
Joyos 2. 3. 7. (Android)rom
Sent from my GT-S5660 using XDA Free mobile app
devrieshh said:
Joyos 2. 3. 7. (Android)
Sent from my GT-S5660 using XDA Free mobile app
Click to expand...
Click to collapse
WIll the flashable zip work with this rom?
p.s. - ANy change you can suggest another way for increasing the internal memory of the Gio?
Not yet,
See the result with flashing It,
E:error in storage/sdcard0/swap.zip
(status 0)
installation aborted
this happend also with the mmb. 7.2 rom
perhaps those roms havent- Kernel with swap and init.d support
things you can do,make an extra ext4 partition so you can put apps on it with special appstomemorycard programms see forum somewere
Sent from my GT-5660 using XDA Free mobile app
devrieshh said:
Not yet,
See the result with flashing It,
E:error in storage/sdcard0/swap.zip
(status 0)
installation aborted
this happend also with the mmb. 7.2 rom
perhaps those roms havent- Kernel with swap and init.d support
things you can do,make an extra ext4 partition so you can put apps on it with special appstomemorycard programms see forum somewere
Sent from my GT-5660 using XDA Free mobile app
Click to expand...
Click to collapse
thanks for the help and will try that solution. found a thread here with some interesting tips, so I'll have a go from there.
do everything manualy and will work... but i didnt felt some better ezxeprience with swap on my devixe with class 10 sd card... just read/write became decreased after few days using swap

Categories

Resources