[UTIL] Android Toolkit - Recovery Console Tool - G1 Android Development

-- I originally posted this in the Q*A but I didn't get much response, so if a mod could close that one...Or merge this one with it...Thanks.
A toolkit for users who are tired of needing to do commands that are long and complex.
This will work on the G1, probably not the MT3g due to lack of keyboard.
Stuff to be added:
* Format fat32 and EXT
* Enable / Disable SD mounting -- Request
* Fix market problem.
This will help you in so many ways!!!
Any questions, let me know!
READ ME:
Android Toolkit 1.0 Beta
By: Natalic
http://scarlet-arrow.com
Functionality:
* Currently only does SDParted by 51dusty
Shouts: The Pres, 51dusty, Cyanogen, JAC,the XDA board and the developers who give me the inspiration to help others!
Donations:
PayPal - [email protected]
Forums - PM me for other methods!
Options:
* p - SDParted - Thanks to 51dusty!
* w - Wipe ext partition -- Will be added depending on response to app!
WARNING:
Defaults perform actions silently, meaning you have one chance to stop the action, that's when I prompt you!
Presets for SDParted:
1: 512MB EXT, Remaining FAT, 96M Swap, EXT2
2: 512MB EXT, Remaining FAT,96M Swap, EXT3
3: 512MB EXT, Remaining FAT,96M Swap, EXT4
4: 512MB EXT, Remaining FAT,32MB Swap, EXT 2
5: 512MB EXT, Remaining FAT,96M Swap, EXT3
6: 512MB EXT, Remaining FAT,96M Swap, EXT4
Coming:
7: Upgrade to EXT3
8: Upgrade to EXT4
9: Downgrade to EXT2
Usage:
*0 Copy files to your SD card -- WARNING: Using SDParted will erase them due to the partitioning!
*1 Enter the recovery console
*2 Type the following:
mount /sdcard
sh sdcard/loadatk
*3 EXAMPLE: Executing using SDParted
atk p *PARAMATERS*
Full example #1 (Using a default listed above)
atk p 1 - Using default 1
Any questions, please ask!
Click to expand...
Click to collapse

Please let me know if you have any suggestions or issues.

natalic said:
Please let me know if you have any suggestions or issues.
Click to expand...
Click to collapse
Maybe you should hook up with this guy and combine the tools as apposed to having multiple ones out on the forum.
http://forum.xda-developers.com/showthread.php?t=566669

Related

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

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

[Q] ext2/ext3/ex4 and lynux-swap with incubus RLS14/15

Hi, I have been testing several NAND set-ups
-system to NAND and data to resized data,img
-system to resized system.img and data to resized data.img
-system to NAND and data to ext2
...
I am currently using NAND and data to ext2 partition, so all apps are installed there. After lots of reading I can not understand posts that are obsolete and posts that are not so I would appreciate if someone can explain me the basics and optimal setup for incubus superfroyo RLS14/15 roms:
I have now 4 partitions:
1) fat32,
2) 1,5G ext2 (app, app-private etc),
3) 1,5G ext2 (lost+found folder) and
4) 96M lynux-swap.
- How can I turn ext2 to ext3? do I need to do so? I have also read about ext4. Upgrading to ext3/ext4 applies to my 2) partition, to my 3) partition or to both? will I loose data stored? "there is no ext3/ext4 fs because there isn't the support on the compiled kernel. Ext3/ex4 are journal file system so are bad for limited writing device like nand or sd and thre is no good rease to use it" answered by l1qd1.
- How can I check if my lynux-swap is enabled and used by the rom?
- Do partitions 2) and 3) really need to be <1,5 G? why so?
- Can I take apk from apps folder in partition 2) in case I want to keep them for future fresh installs?
- What is lynux-swap optimal size? a 1,5G partition would be worse than 96 M? Why?
- Which tools are you using with incubus roms to manage installaion location and similar functionalities?
Another big mark I have is about deoxeding installed aps (not belonging to the ROM). Should I do it? why? how?
Pretty basic stuff I guess for experienced users & programmers, but I am new to lynux and android. Have read lots of things but it is difficult to learn by myself what would work with our Polaris and incubus ROMS and dzo/kk kernels,
Stick to ext2 man, you won't turn your old engine to 240mph on a Ford Model T.
You're not getting some major boost if the hardware dosn't use it, so I'd stick with ext2.
And you also want Super FroYo on your ext2 partition, yes? I'm here to help.
- How can I check if my lynux-swap is enabled and used by the rom?
adb shell
Code:
free
if on swap you have 0 it isn't enabled.
Code:
swapon /dev/device
to enable it or i suggest you tu use compcache.
- Do partitions 2) and 3) really need to be <1,5 G? No
- Can I take apk from apps folder in partition 2) in case I want to keep them for future fresh installs? Yes but not all apk support this
- What is lynux-swap optimal size? a 1,5G partition would be worse than 96 M? Why? Too Big = more sparse but it's a problem only for real disk so you can create a swap big as you want but it's unuseful (100 M is enaught)
i suggest you to switch to my kernels because are more updated and kk move to another device.
Yah l1q1d I love ur kernels. Eager for more !
l1q1d, I am testing your kernel as you advised me. I could apply the wifi patch without problems using your androiupdate18-09-10, as you told me some time ago they are both 2.6.25.
However I do not manage to turn linux-swap on: that's what I do: I install ubuntu, I use G-Parted to create partitions on the sd card. When I do so, the third partition is always shown as linux-swap in G-Parted but when I test adb shell -> parted -> print, it always shows as ext2. I can not dismount and can not swap on it.
The other way round, if I deleted all partitions with G-Parted and create the partitions with mkpartsfs or if I use mkfs to change the third partition from ext2 to linux-swap, then sometimes I can swap on it (directly on adb shell or with G-Parted) but when I unplug the device will tell me the card is empty and will not be able to mount it, access it from ubuntu or from the device. If I reboot then, the system will hang until I install both data and sysetm to nand. This happens no matter if I activate or not from the polaris or even if I switch on or off usb mode. The card at that point is useless. I guess the partition table or some other basic file is messed.
Could you please explain a little more how can I come with a 13.5G fat32 partition, a 2,4 ext2 partiions and a 0,1 lynux swap swapped on partition??
I really need to test this set up, since with the standard set-up (system to nand, fat32 for files and ext2 for installed apps I can not install all apps I use since performance drops significantly).
regards
well, ... dumb me, maybe with compcache you are referring to launch a script?
where do I get this compcache.sh? how do I launch it? from adb? from the terminal? from the sd card?...

[DATA2EXT] [11/Dec] FULL BENCHMARK, V4, Improve the efficiency of IO

This script only for ROM Developers!
EDIT:2010/12/13 update explain:
1. Why three partition?
Answer:for get best balance of stabilty and performance.
2. Why don't use two partition and loopfile on 2nd partition(my script V1)?
Answer:Loopfile on 2nd partition need enable journaling on 2nd partittion file system to get stability after Unexpected loss of power or Unsafe reboot(without umount). And, enable journaling on a large partition is slower than small partition. In my phone, 1.3G /data/app don't need journal, only 300M /data/data need journal, so I use a small parition for safe and performance in V4.
3. Why not use ext4 directly at 3rd partition?
Answer:for speed up sqlite3, ext4 loopfile on ext4 device, make a huge improve for sqlite3 insert.
4.Why not NILFS2 or BRTFS?
Answer: I have already tried nilfs2 before I use ext4. nilfs2 crash my system. Brtfs marked 'EXPERIMENTAL' in kernel source(2.6.32.15), I like stability more than speed.
________________________________________________________________________________________
EDIT:2010/12/12 update V4 script:
/data/:ext4, disable journaling
/data/data:ext4 loopfile on ext4 device, enable journaling on ext4 device, disable journaling on ext4 loopfile, for fast and stable sqlite3 access.
really smooth this time. please trying...
________________________________________________________________________________________
EDIT:2010/12/11 FULL BENCHMARK: (all test use my sandisk C2 16G TF card, run in SuSE Linux 11.2 desktop)
I did a full benchmark for ext2/ext4, with loop or without loop, write, read, sqlite insert, this is result:
I do follow tests, umount after every test to prevent from kernel cache.
Sqlite3 db benchmark is insert 2000 records to db.
500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, enable journaling on ext4, sync after every file write.
write: 355 seconds
read: 52 seconds
db:76 seconds
500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, disable journaling on ext4, sync after every file write.
write: 212 seconds
read: 52 seconds
db:3 seconds
500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, with sync-in-mount-option, sync after every file write.
write: 380 seconds
read: 45 seconds
db: 3 seconds
500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, without sync-in-mount-option, sync after every file write.
write: 390 seconds
read: 45 seconds
db: 3 seconds
500 50k-2M files(random size) to ext4 device, enable journaling, sync after every file write.
write: 208 seconds
read: 47 seconds
db: 95 seconds
500 50k-2M files(random size) to ext4 device, disable journaling, sync after every file write.
write: 191 seconds
read: 48 seconds
db: 50 seconds
500 50k-2M files(random size) to ext4 device mount with loop option, enable journaling, sync after every file write.
write: 198 seconds
read: 51 seconds
db: 72 seconds
500 50k-2M files(random size) to ext4 device mount with loop option, disable journaling, sync after every file write.
write: 191 seconds
read: 50 seconds
db: 2 seconds
As you see, the best speed is: mount real ext4 device with loop option, disable journaling. The best balance of performance and safe is mount real ext4 device with loop option, enable journaling! We don't need a loopfile but just change mount option.
I attach my testsuit file below.
___________________________________________________________________
EDIT:2010/12/10 V3 changelog:
1.change loopback device to real partition for powersave and better write performance.
2.disable second partition's journaling.
3.You need 3rd partition for /data/data. But even without the third partition of this script can also work(not stable). My partition settings:second partition:1.5G, thrid partition:0.5G
Explain:
1.about NAND and SD: Desire have poor NAND memory for userdata, just 150M(this can be enlarged by MTD or HBOOT, but still small for me). This MTD partition need store app, dalvik-cache, app-data, it is too small to fill many apps.So someone think may be someting can be symbol link to SD, this is original Cyanogen A2SD, in this case , the /data/data directory is not moved to SD, because the battery reason and the speed need. This is what the HDROM 2NAND version do. So, the original A2SD is totally same as 2NAND. I don't known why the 2NAND be named. The NAND is not fast because it is yaffs2(journaling) filesystem, so if install many apps the phone will be slow(every app's sqlite have write demand)
2.about ext2/ext3/ext4: Ext2 have no journal feature, so lost power or just normal reboot will be crashed it, ext3 is journaling version of ext2. Ext4 is diffrent from ext2/ext3, it included Extends feautre, which provide better performance for large file(large than block size:4K). I analyze android system files, 4/5 is large than 4k, so the Extends feature is very useful. all EXTX system is base on Block, and the default block size is 1024 for small partition. Larger block size has better performance, so I force block size to 4096 when format.
3.about loopback device: The original Data2SD script make a huge loopback file for /data parition, then get better IO score. The reason is loopback device provide better Read performance. But the Write performance is wrose, so the phone got lag when install app or copy file.And the lag will occur suddenly. If system want to write data to loopback device, it is not real write, just write to kernel buffer/cache, the data will be flush to real disk when real filesystem(where loopback device stay on) got sync or commit command. So the real filesystem must enable journaling or do sync frequently。
4.about my old data2ext script: I try to splite directory to diffrent FS for the balance of performance and lag. Why I formated partition to EXT4? the reason can be found at item 2. Why create a small loopback device? the reason is item 3. But I found some bug with this case, any data write to loopback device need twice kernel IO command, one virtual one real, so the cpu usage will be high. Real EXT4 partition don't need journaling if no loopback device on it. For data integrity on virtual EXT4 loopback device, I had to enable journal on it.So I design new disk layout for better performance, it is DATA2EXT V3.
__________________________________________________________________
V2 change log:
1.change loopback device FS to EXT4 for journal, more stable
2.change mount option, add commit=large Prime number, reduce real IO, avoid concentration of commit. change journaling scheduler from Ordered to WriteBack to improve performance.
I would like to share my Data2EXT script, a collection of data2sd(Thanks to sibere) and the advantages of ext4, you can let the phone run at peak efficiency.
I use EXT4 for whole SD 2nd partition, and create a ext2 loopback device with 1/5 size of 2nd partition.
The files in /data/app,/data/.systemapp it not updated frequently. so store them in EXT4.
In /data/data and /data/app-private, a lot of small files and sqlite database, is updated frequently. so store thenm in EXT2 loopback device.
/data/dalvik-cache is stored in phone memory /mnt/asec/mtddata for distributed IO pressure.
/data/misc, /data/system, /data/property is stored in phone memory /mnt/asec/mtddata for system settings restore(or you will lost your timezone/language settings after reboot).
use this script, I can get quandrant score:2000+, IO:4000+, my phone is smooth and quickly.
this is great job
thx ownhere
If I have Data2SD already installed, I have to do it again, or simply copy this file to /system/etc/init.d and reboot?
I do not understand that I do, only copy the script and reboot and automatically makes the whole process or do I have any other operation, thanks and apologies.
PD. I have read and believed the other post, which is to automatically process, the only problem was the FC, which was corrected by manager rom also lose the wifi, this script solves these problems?
Do you need to use any and on this and can u use an ext2 partition
Sent from my HTC Desire using XDA App
noob question.. what do i do with the script?
http://forum.xda-developers.com/showpost.php?p=9541647&postcount=477
ownhere said:
I use EXT4 for whole SD 2nd partition, and create a ext2 loopback device with 1/5 size of 2nd partition.
Click to expand...
Click to collapse
I don't understand this......Can you explain it?
How partition the micro_SD card?
Can someone explain how to apply the script? Do we have to create the partitions ourself or will the script create them?
Does it work on DHD Roms?
Guys there's a thread only god knows how many pages long that explains every possible variation on EXT* loopback devices..how about scrolling just a little next time?
http://forum.xda-developers.com/showthread.php?t=852219
I think that is better always insert an how to guide!
As it is, is not very clear :-(
sent from the future
Good job ownhere, I want to try your script on AuraxTSense, but this rom don't have mkfs.ext4 or mkfs.ext3, can you attached it to 1st post please?
+1 for a bit more detailed information.
I am not requesting, I am just politely asking with gratitude already since I guess this script will be implemented in future roms to come i guess..
shawe_ewahs said:
Good job ownhere, I want to try your script on AuraxTSense, but this rom don't have mkfs.ext4 or mkfs.ext3, can you attached it to 1st post please?
Click to expand...
Click to collapse
Try /system/xbin/busybox mkfs.ext4
coutts99 said:
Try /system/xbin/busybox mkfs.ext4
Click to expand...
Click to collapse
I try this before ask, with version 1.17.1 don't work for me, requires 1.18.0 for work?
# /system/xbin/busybox mkfs.ext4
mkfs.ext4: applet not found
shawe_ewahs said:
I try this before ask, with version 1.17.1 don't work for me, requires 1.18.0 for work?
# /system/xbin/busybox mkfs.ext4
mkfs.ext4: applet not found
Click to expand...
Click to collapse
uploaded in 1st post.
ownhere said:
uploaded in 1st post.
Click to expand...
Click to collapse
Thanks ownhere!
busybox ---> /system/xbin
mkfs.ext4 ---> /system/xbin
01data2sd ---> init.d
yes i try again report back
It works well.
35.121 on LINPACK @ 998Mhz
bbk said:
It works well.
35.121 on LINPACK @ 998Mhz
Click to expand...
Click to collapse
how do you make this work?
i am now at splash for about 10min

[Utility] ext4 data2sd for Froyo ROMs

If you are always low on program memory, this data2sd might be for you. It works with any Froyo for the G3.
Note: This won't wipe your data, but you should have a backup, just in case. First backup the phone to the SD card, then the SD card to your computer. Be cautious. I give no guarantee whatsoever. If your phone behaves funny, even eats your cat afterwards, I take no responsibility.
Note: starting with version 3, the new storage size will NOT be reflected in the Task Manager or in Titanium Backup. I'll see what I can do about it.
You need a rooted phone and an SD card, preferably 2 GB or more and class 6 or better (higher). data2sd doesn't make your phone faster. Much to the contrary: it extends your memory at the cost of speed. That said, if your SD card is of a class smaller than 6, this will work too. The slowdown, however, will be noticeable in some situations.
Three steps are needed. First, we need a kernel with built-in ext4 if you don't have one. Second, we bring the data2sd into its place. And third, we create an ext 4 partition with the desired size. Now follows a detailed description of these steps.
Step 1: Check your kernel
You need a kernel with built-in ext4 capability. The custom ROMs mostly have one. If you are running a stock kernel, you must install one, e.g. from http://forum.xda-developers.com/showthread.php?t=978823 . Follow the installation steps detailed there. (Changing the kernel does not wipe your phone).
Step 2: Install data2sd
You now must install data2sd onto your phone. As long as you didn't modify your SD card (as long as partition #2 is not ext4), this will have no further impact on your phone.
Download data2sd.zip from below and unzip it. There's a single file in there: data2sd.sh. Use the tool that suits you best to transfer it to the SD card of your phone. With adb, you would do
Code:
adb push data2sd.sh /mnt/sdcard
Now either start a terminal emulator with a root shell or use adb again. With adb, you would execute
Code:
adb shell
Make sure you are root (the prompt reads '#'), else run "su". Now type in:
Code:
# sh /mnt/sdcard/data2sd.sh
You will see some lines about what is happening and a final confirmation.
That's it. Again, your phone will continue to behave as usual.
Step 3: Prepare your SD card
You can use any amount of program memory up to the size of your SD card, but be sure to leave some room for application data on the normal (#1, vfat) partition. As a rule of thumb, 0.5 GB of program memory will satisfy most needs, 1 GB is plenty.
If you're running Linux, prepare a second partition (must be partition #2) with the desired size. Use the usual utilities to do so. This includes gparted, but there are also other means. If you use gparted, you can follow the description for Parted Magic below.
If you have no access to a Linux computer, even not your friend's, your (probably) best choice is to run Parted Magic from a live CD. For this, go to http://partedmagic.com, and burn your CD. Instructions on how to do it with different burning tools are also there.
Step 3.1: Partition and format your SD card with Parted Magic (also applies to gparted)
The following describes the steps to partition your SD card with Parted Magic. You don't need to use this method - use the tool that suits you best.
I assume you have gparted or Parted Magic running and your SD card inserted into the card reader of your PC. Now select your card from the drop-down menu of available drives in the upper right corner. You better double check that you're on the correct drive (card). It will happily erase your system disk if told to do so.
Right click near top into the block designating your current partition #1. Select "resize". (I assume that your partition #1 is the only one. If not, delete the other partition(s)). Change the size to the total size of your SD card minus the desired size for program storage (/data). Confirm your selection.
There is now a gray block designating free space to the right of your first partition. Right click it and select "New". In the following window, leave the sizes as they are. Leave "create as" to be a primary partition, and change "file system" to ext4. Confirm your selection ("Add").
The gray block at the right has changed to a colored frame. Right click it again and select "Format as". Select "ext4".
If everything went well, you can now click on the green check mark in the icon bar near the top, confirm, and watch Parted Magic resizing your normal (#1, VFAT) partition and creating the new ext4 one.
4. Finale furioso
Now insert the SD card and reboot your phone. The Task Manager will report the new size in its rightmost tab, as do the other utilities like Titanium. All user apps and data should be in place. All will look like you have soldered in an extra chunk of internal memory. Despite not being directly visible, your program memory is resized to be the new partition. You see its size and its usage (in percent) by running
Code:
df
from adb or from a terminal emulator. Have a look at the subdirectories of /data displayed there.
As a final step, you can safely remove data2sd.sh from your SD card (/sdcard). It is not needed any more.
Q&A
* How can I remove my SD card while the phone is on?
You can't. Don't try. Always switch your phone off before you remove the SD card.​* How can I return to the state before data2sd?
Remove the SD card. All user data and apps will be there in the state you left them before you installed data2sd. The data2sd script you have installed simply does nothing as long as there is no ext4 #2 SD partition.
If you want to reuse the SD card, remove partition #2. This can be done with each partitioning tool, you don't need Linux.​• What about app2sd from Kyrillos 3.0? Is it compatible?
Yes. But "no" for the "no wipe" version which was offered for a short period of time. In the latter case, clear out the ext4 partition (important: do not forget the hidden .data2sd_initialized file) or simply reformat it before reusing it.​* It doesn't work. What can I do to help diagnose the problem?
See if the file /mnt/asec/data2sd/log.txt exists. If it does, have a look at it and try to make sense of it. If it doesn't tell you anything useful, add it to your error description in the forum here. If there is none, mention that in the description.​* What things must be considered if I flash a new ROM?
As always with such actions, make sure you have a backup. That said, just flash the new ROM and then install data2sd. When you reboot with the SD card in place, all user Apps and all data should be there. No restore from backup required.
Only in the rare case that the new ROM explicitly requires you to NOT restore your old data, e.g., from Titanium, you should reformat your ext4 partition (to clear it out) and proceed as advised by the ROM makers.​Versions:
2011-03-19 Initial release
2011-03-21 Version 2
- Updated for ROMs without /system/etc/init.d
- Simplified installation of the core parts
2011-03-23 Version 3
- Vibration bug fixed
- App2SD mode added: If the ext4 partition bears the volume label "app2sd" on a new blank SD, only /data/app is moved. This greatly reduces size benefits, but results in nearly no speed loss.
- Just run the data2sd.sh file (as described in step 2) to upgrade without data loss.
- Note: the actual size will NOT be reflected as described in the Task Manager or in Titanium.
Gosh this sounds so complex and risky! Isn't there a easier way?
☞★sent from my Galaxy3!!
♪drajax!! ♬♂ツ
drajax said:
Gosh this sounds so complex and risky! Isn't there a easier way?
☞★sent from my Galaxy3!!
♪drajax!! ♬♂ツ
Click to expand...
Click to collapse
Flash Kyrillos' v3.1 where's the script's allready built in...
It is less complex than it sounds. The description is just really very detailed. The details may sound confusing until you try it. And if you have access to Linux, it is really simple. We Linux users also have to use a different operating system when we flash our phones.
Alternative: Install Kyrillos 3.1. It contains the same data2sd and comes with a partitioning tool. But, as far as I can tell, you need to reformat the SD card's vfat part on the phone and lose the data there (not sure, however).
when i try to set permissions it says permission denied . Any help?
http://www.appbrain.com/app/move2sd-enabler-(root-only)/com.leinardi.setinstalllocation
Just one quick question....
I am having the stock JPM ROM... in that case do i need to have some new Kernel to use your data2sd???
I'll be using this!
Sent from my ACID Lestatious v1.4.5.5 Galaxy 3 FROYO
When i write down "/ # cd /system/etc/init.d/"
it says "sh: cd: can't cd /system/etc/init.d/"
What am i doing wrong???
Pinak.ahuja said:
when i try to set permissions it says permission denied . Any help?
Click to expand...
Click to collapse
You're not in a root shell. Enter "su" as your first command.
next2devil said:
When i write down "/ # cd /system/etc/init.d/"
it says "sh: cd: can't cd /system/etc/init.d/"
What am i doing wrong???
Click to expand...
Click to collapse
Don't know. Try this:
cd /system
cd etc
cd init.d
and report where it fails and if you are using adb or a terminal emulator. If it doesn't fail, continue with the line after the cd command.
Awesome work mizch!
We can refer to below link for partitioning of sd card to ext4 using adb
http://forum.xda-developers.com/showthread.php?t=534714
Hi Mizch,
Thanks for the script. have few questions; requesting for an answer:
1. Once data2sd is done, will sd card be auto mounted on reboot?
2. I am running JPM with Apollo's data2sd (ext2 partition for apps 1.1GB). What will be the benefit of ext4 over ext2?
3. I understand that i have to remove apollo's lagfix and then apply ext4 data2sd. Is there a way, i can also apply lagfix?
Thanks
jaskiratsingh said:
Hi Mizch,
Thanks for the script. have few questions; requesting for an answer:
1. Once data2sd is done, will sd card be auto mounted on reboot?
Click to expand...
Click to collapse
Yes. And for the first boot, it gets initialized too.
2. I am running JPM with Apollo's data2sd (ext2 partition for apps 1.1GB). What will be the benefit of ext4 over ext2?
Click to expand...
Click to collapse
Reliability, especially in crash cases and generally when the phone is shut down without a clean unmount. Ext 4, being a journaling file system, tries to keep the file system in a consistent state whenever possible. ext2 does nothing like that. So, when you forcible switch off your phone by long pressing the power button, most likely you are continuing with a damaged file system whose errors accumulate from now on and will eventually become visible at some time later.
There's one drawback, however: ext4 has to write more data than ext2. ext4 must always write the information needed to reconstruct a consistent file system to its journal.
3. I understand that i have to remove apollo's lagfix and then apply ext4 data2sd. Is there a way, i can also apply lagfix?
Click to expand...
Click to collapse
If I'm correct, the lagfix converts /data (your program storage) to ext2. Since /data is now handled by data2sd and converted to eyt4 anyway, you cannot use lagfix any more. You need to remove it.
mizch said:
If I'm correct, the lagfix converts /data (your program storage) to ext2. Since /data is now handled by data2sd and converted to eyt4 anyway, you cannot use lagfix any more. You need to remove it.
Click to expand...
Click to collapse
Thanks for the quick reply mizch. If i have to check apart from data, if anything else is converted into ext2, how can i do that?
jaskiratsingh said:
Thanks for the quick reply mizch. If i have to check apart from data, if anything else is converted into ext2, how can i do that?
Click to expand...
Click to collapse
have a look at the output of 'mount' or 'busybox mount'.
rm 02-app2sd for who use kyrillos ROM...i didn't do that command..but it seems works fine...what does it change if i use that command???
mizch said:
Don't know. Try this:
cd /system
cd etc
cd init.d
and report where it fails and if you are using adb or a terminal emulator. If it doesn't fail, continue with the line after the cd command.
Click to expand...
Click to collapse
I tried what you mentioned.... but again it shows the same error. It works well till "cd etc". Then, for init.d it shows out the error.
It seems the location for init.d is different in my device
next2devil said:
I tried what you mentioned.... but again it shows the same error. It works well till "cd etc". Then, for init.d it shows out the error.
It seems the location for init.d is different in my device
Click to expand...
Click to collapse
Yes. Probably there is none. What ROM are you using? Is it a Froyo ROM and from where?

[Script] swapconf - swap config

Description:
A small command line tool to create, delete, enable or disable swap file on sdcard and autostart swap file or partition on boot (zRam (compcache) is configured through system Settings))
Features:
- Automatic detection of partitions and files: if you do not have a dedicated swap partition, script uses swapping to file - first on sd-ext and if that one does not exist then it swaps to sdcard. Swap partition takes precedence over files. This should work no matter if you have or do not have ext partition (for app2ext) on sd card.
- create and delete swap file - you can test different sizes without rebooting
- ability to start and stop swapping where ever it may be configured: biggest advantage of this is that you can stop swap if you have it on your /sdcard so you can use mass storage mode. Also, you can test various sizes for swap files or how your system works when swap is disabled, without need for a reboot
- misc. activities: view status of swap partition/files and status of memory
Usage:
Code:
Disable startup: swapconf 0 -> disables startup script
Enable startup: swapconf 1 -> enables startup script
Create swap file: swapconf mkf size_in_MB -> creates swap file of specified size (e.g. swapconf mkf 30 for 30MB swap file)
Remove swap file: swapconf rmf -> removes previously created swap file
Start swap: swapconf start p|f -> starts swapping to partition (p) or file (f)
Stop swap: swapconf stop -> stops swapping whereever it may be started
View swap status: swapconf status -> view status of swaps and memory
NOTE: Enabling both swapping to partition and to file is not supported.
If you have a dedicated swap partition on sdcard it will be used if enabled. Otherwise you need to configure swap file.
The attachment is OpenRecovery flashable update zip. Simply apply update.
Startup script should persist across new ROM updates until you do a factory reset (wipe data)
Feedback is welcome
Changes for version 0.2:
- relocated script from /data/local/bin to /system/bin: if your terminal app does not export /data/local/bin to PATH that should not be an issue anymore. Script should still persist across ROM updates [thanks to kabaldan for the tips ], startup script should persist until you do a factory reset (or you delete/disable it ).
- reworked script commands: previously you were not able to create swap file without enabling startup script
- improved partitions detection
- fixed a bug where you could not stop swapping to file if zRam was active
- mics. fixes and cleanups
Changes for version 0.2b:
- fixed backup of swapconf script during ROM upgrade on CM10
Notes:
- script will not persist when changing different ROM versions, e.g. from CM7 to CM10
- kabaldan and Skrilax_CZ have informed me that it is a bad idea to have active swap on sdcard's FAT32 partition unless there is an app that will disable swapping when the sd card is going to be mounted to PC. So far, the only issue I have noticed is that you can not mount USB mass storage mode until you turn off swap so I left that possibility enabled. The choice is yours (btw., it uses fat32 partition only if you have no dedicated swap partition or ext partition).
Thanks a lot for the info.
Bravo mrvek!
"Svaka cast!"
Sent from my Milestone using xda app-developers app
Great piece of swap tool! Great jobs mrVek!
in my case i can't directly cmd 'swapconf status' as shown in your screenshot, but have to cmd 'sh swapconf status' than the script run...
Thank you anyway, save me lots of time.
@arttree: that's odd. I haven't had such issues. Do other commands have the same issue? What rom are you using?
That seems like a permissions problem, execute perm. maybe missing. I'll look into it. You can try to chmod 755 /data/local/bin/swapconf to see if it'll help.
/data/local/bin/swapconf permision is 755. i installed/flashed it using update-OR-swapconf.zip you posted in 1st post.
anyway other than execute using "sh", everything work fine, even after reboot my MS, swap partition detected automatically.
Do you have /data/local/bin in your PATH? Or you always navigate to /data/local/bin?
Try this:
echo $PATH
To see if /data/local/bin exists in your path, if not then:
export PATH= $PATH:/data/local/bin
after that you wont need "sh" or "./" before swapconf (and you will be able to execute swapconf cmd from everywhere)...
Remember that this is not permanent PATH export, you need to do that everytime, as mrvek guided me, in terminal's settings there is an option to execute some commands on console startup (similar to .bash_profile) and you should put there "export PATH= $PATH:/data/local/bin" so you don't have to do that every time on console startup.
Sent from my Milestone using xda app-developers app
great tips! It work! Thanks.
Little problem:
$ su
# swapconf 1
[[: /dev/block/mmcblk0p1: unknown operand
Created configuration.
Enabled startup script.
#
Seems like the script thinks that mmcblk0p1 is swap - but that's my ext-partition...
My swap is mmcblk0p2
But it seems like I'm misinterpreting this error, am I not?
Sent from my Milestone using xda app-developers app
Eiertschik said:
Little problem:
$ su
# swapconf 1
[[: /dev/block/mmcblk0p1: unknown operand
Created configuration.
Enabled startup script.
#
Seems like the script thinks that mmcblk0p1 is swap - but that's my ext-partition...
My swap is mmcblk0p2
But it seems like I'm misinterpreting this error, am I not?
Sent from my Milestone using xda app-developers app
Click to expand...
Click to collapse
mmcblk0 is sd card, if present. mmcblk0p1 is first partition and should be FAT32, mmcblk0p2 is second partition (ext, and it must be p2 because some things in system assume that ext is 2nd partition if it exists, otherwise it won't mount it) and mmcblk0p3 is 3rd (usualy swap).
Neverthelss, these are issues, especially on CM7, with the script that need to be fixed asap.
Updated OP with new version (0.2).
I have tested it with different configurations and it seems to be working. Let me know if I missed anything.
Thank you all for your feedback.
I hope not being nasty, more between your script and what we've used (-FuFu-v5), is there any difference important?
with this script you can config your settings by using the terminal
my script only aktivate swap and creates a swapfile (if needed), to config my script you must edit the script itself
Yes, interactivness.
ty!
bug fix
Updated OP (again).
Only change was a fix for CM10 so it should persist between rom upgrades (ie., swapconf script is properly backed up during CM10 install).
I'm sorry for the trouble, haven't noticed it before.
thank you for improving your scripts. Great piece of script that our life a lots lots easier.
btw, if i used swap file option, do i need to manually stop it before i enable the mass storage(connect to PC)?
arttree said:
thank you for improving your scripts. Great piece of script that our life a lots lots easier.
btw, if i used swap file option, do i need to manually stop it before i enable the mass storage(connect to PC)?
Click to expand...
Click to collapse
Yes but only if swap file is on sd card fat32 partition. If you do not have an ext partition then it was created in sdcard's fat32 (/sdcard/.swapfile)
If it is on your fat32 partition and is active you need to stop it before connecting to mass storage mode.
Please note that intended purpose of startup script is to enable swap on boot. To do that it uses certain priority - first it tries swap partition, if that did not exist then it tries ext partition (if you created file) and the last resort is sd card fat partition (also needs pre-created file). The same applies to manual creation of file - ext has precedence over fat32.
I guess that is not a design flaw.
is it fullly compatible with Compcache of zRam?
gambarini said:
is it fullly compatible with Compcache of zRam?
Click to expand...
Click to collapse
Hm... not sure if I understand.
zRam/compcache is controlled in ROMs settings.
On the other hand you can have zram enabled and still use this scrip to configure swap to partition or file but you can't manipulate zram with this script.

Categories

Resources