[Guide] Find7 9GB App storage and mount External SD-Card as SD0 - Oppo Find 7 and 7a

In this Guide you will learn how to modify your system to handle the 9GB Partition 29 as Data (App-Storage) and use the external SD-Card as internal.
Don't be afraid, this is a lot of text mostly to explain the whole procedure, the steps are straight forward.
Thanks go to Kishd (oppoforums), Coldbird and alienmind (xdadevelopers)
Beside of the public made solutions i will do the following:
Instead of repartitioning the device i will change only the partition name of "sdcard" to "userdata", mount the external SD as internal and use the remaining 3GB Partition as external SD.
So partition 15 will become "sdcard1" and partition 29 will become "userdata"
On the Find7a you will have 9 gigs of application space and xx gigs for the internal sd (size of the sdcard).
This should work on Find7 too, someone has to check the partition layout if it is equal, than you will have 25 gigs of application space and xx gigs for the internal sd (size of the sdcard).
PRECAUTIONS:
If you mess around with partition table you could brick your device, so be careful!
Thes procedure worked for me, i am not responseable for any missing or mistyped commands/procedures, so THINK BEFORE YOU DO ANYTHING!
I am not an android Pro, nor an Develper. My Spare time is very limited so i can't help you out if something goes wrong!
I've done this with Gummy Rom, not tryed with ColorOS or another custom rom but it should work on all AOSP-based ROMS.
The swapped SD-cards do not belong to recovery, so the internal SD is accessed as before.
What do you need:
1.: Time: This is not done in 5 minutes, so please be patient.
2.: A Linux-PC with working ADB and Fastboot
3.: TWRP recovery image on your PC or installed on the device: http://techerrata.com/browse/twrp2/find7a (I used 2.7.1.0)
4.: An SD card with at least 16Gb inseted into your Find7a
5.: Fully charge your Device before messing around, some jobs will need a lot of time.
6.: A fitting custom ROM installed, i've done this with Gummy-M2.3-06-29-14-NIGHTLY-find7 which is suitable for find7 and find7a which can be found here: http://crackflasher.com/gummy-m2-3-06-29-14-nightly-find7-zip-oppo-find-7a-gummy/
7.: The zip-file of the custom rom on your local PC
What are we going to do:
0.: Boot into recovery and access the Device via ADB
1.: Format external SD to Ext4 Filesystem
2.: Backup the original partition layout and all partitions too
3.: Copy Data from internal SD to external
4.: Rename two partitions
5.: Format the new "userdata" partition and move all content of the old to the new location
6.: Format the new "sdcard1" partition
7.: Edit/replace fstab files in /etc to tell TWRP and System the new mountpoints
OK, let's do the trick
Step0.: Booting into recovery and accessing the Device via ADB-shell:
Put the phone into fast boot mode. (Power Volume Up simultaneously)
Open a terminal in your linux-PC and do the following as root (sudo -r):
#: fastboot devices ( check that fastboot is up and running)
#: fastboot boot openrecovery-twrp-2.7.1.0-find7a.img (or boot into TWRP if already installed)
The phone will boot into twrp.
Connect the phone and go into adb
#: adb shell
After entering the adb shell you should see the following in your terminal:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
~ #
Step1.: Format external SD to Ext4 Filesystem
First we have to write a new partition table as i dont know how your SD-card looks:
umount /external_sd (could cause errors if no filesystem is present on SD - dont mind)
parted /dev/block/mmcblk1 (you should see parted welcome message, no errors!)
mklabel msdos (this will write a new partition table on your sdcard)
mkpart primary ext4 1 -1 (this will make a ext4 partition which uses the whole sd)
quit
Now we are going to format the ext4 partition:
mke2fs -t ext4 -m 0 -L sdcard /dev/block/mmcblk1p1
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk1p1
mount /dev/block/mmcblk1p1 /external_sd (Mount the new formatted sd-card -- this should show no errors)
If all is done without errors, proceed to step2
Step2.: Backup the original partition layout and all partitions too
dd makes physical imagea of partitions so you can put it back if needed
While DD is copying you will see no progress bar or any output, so BE PATIENT!
Code:
mkdir /external_sd/backup
parted /dev/block/mmcblk0 print > /external_sd/backup/partitions (original partition Layout for later reference)
dd if=/dev/block/mmcblk0p1 of=/external_sd/backup/modem
dd if=/dev/block/mmcblk0p2 of=/external_sd/backup/sbl1
dd if=/dev/block/mmcblk0p3 of=/external_sd/backup/dbi
dd if=/dev/block/mmcblk0p4 of=/external_sd/backup/ddr
dd if=/dev/block/mmcblk0p5 of=/external_sd/backup/aboot
dd if=/dev/block/mmcblk0p6 of=/external_sd/backup/rpm
dd if=/dev/block/mmcblk0p7 of=/external_sd/backup/boot
dd if=/dev/block/mmcblk0p8 of=/external_sd/backup/tz
dd if=/dev/block/mmcblk0p9 of=/external_sd/backup/pad
dd if=/dev/block/mmcblk0p10 of=/external_sd/backup/modemst1
dd if=/dev/block/mmcblk0p11 of=/external_sd/backup/modemst2
dd if=/dev/block/mmcblk0p12 of=/external_sd/backup/oppodycnvbk
dd if=/dev/block/mmcblk0p13 of=/external_sd/backup/oppostanvbk
dd if=/dev/block/mmcblk0p14 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/system.gz
dd if=/dev/block/mmcblk0p16 of=/external_sd/backup/persist
dd if=/dev/block/mmcblk0p17 of=/external_sd/backup/cache
dd if=/dev/block/mmcblk0p18 of=/external_sd/backup/recovery
dd if=/dev/block/mmcblk0p19 of=/external_sd/backup/fsg
dd if=/dev/block/mmcblk0p20 of=/external_sd/backup/fsc
dd if=/dev/block/mmcblk0p21 of=/external_sd/backup/ssd
dd if=/dev/block/mmcblk0p22 of=/external_sd/backup/misc
dd if=/dev/block/mmcblk0p23 of=/external_sd/backup/LOGO
dd if=/dev/block/mmcblk0p24 of=/external_sd/backup/DRIVER
dd if=/dev/block/mmcblk0p25 of=/external_sd/backup/reserve1
dd if=/dev/block/mmcblk0p26 of=/external_sd/backup/reserve2
dd if=/dev/block/mmcblk0p27 of=/external_sd/backup/reserve3
dd if=/dev/block/mmcblk0p28 of=/external_sd/backup/reserve4
dd if=/dev/block/mmcblk0p30 of=/external_sd/backup/grow
It is not urgently needed to make dd backups of userdata and (internal) sdcard but here for refernce:
Do a compressed multispan backup with dd so you can use the files on an FAT32 filesystem too:
dd if=/dev/block/mmcblk0p15 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/userdata.gz.
dd if=/dev/block/mmcblk0p29 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/sdcard.gz.
Example of restoring partition 29:
cat /external_sd/backup/userdata.gz.* | gzip -dc | dd of=/dev/block/mmcblk0p29
Step3.: Copy Data from internal SD to external SD:
cp -a -i /internal_sd/* /external_sd/ (this can take a while)
ls /external_sd/ (you should see a bunch of files here)
If nothing went wrong go to step4
Step4.: Rename partitions:
umount /internal_sd/
umount /and-sec/
umount /data/
parted /dev/block/mmcblk0
name 15 sdcard
name 29 userdata
print (should show you the renamed layout)
quit
If nothing went wrong go to step5
Step5.: Format the new "userdata" partition and move all content of the old to the new location:
mke2fs -t ext4 -m 0 -L userdata /dev/block/mmcblk0p29
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p29
mount /dev/block/mmcblk0p15 /internal_sd
mount /dev/block/mmcblk0p29 /data
cp -a -i /internal_sd/* /data/ (this can take a while)
If nothing went wrong go to step6
Step6.: Format the new "sdcard1" partition:
umount /internal_sd/
mke2fs -t ext4 -m 0 -L sdcard1 /dev/block/mmcblk0p15
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p15
If nothing went wrong go to step7
Step7.: Edit/replace fstab.qcom file to tell System the new mountpoints:
Guide from Coldbird: http://www.oppoforums.com/threads/unpack-repack-find-7-a-boot-img.14538/
Unpack update.zip and make a working directory.
copy file boot.img from update.zip into this directory
download https://github.com/xiaolu/mkbootimg_tools
unpack bootimage:
mkboot boot.img extracted (this will create a folder "extracted" with the content of boot.img where you can find fstab.qcom
edit fstab.qcom co match your needs (i.e. swap internal and external storage as shown below)
pack bootimage:
mkboot extracted newboot.img (creates newboot.img)
test bootimage (via fastboot):
sudo fastboot boot newboot.img
flash bootimage (via fastboot):
sudo fastboot flash boot newboot.img
sudo fatboot reboot
This is how the original file looks:
Code:
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337 wait
/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:29,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:auto,noemulatedsd
/devices/platform/xhci-hcd auto auto defaults voldmanaged=usbdisk:auto
Code:
This is the changed file:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
# Use internal sdcard as /data
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
#/dev/block/platform/msm_sdcc.1/by-name/sdcard /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
# CM11 hack: Swap sdcard1 and sdcard0 - both in ext4 and (internal)sdcard1 as emulated
#/devices/msm_sdcc.2/mmc_host auto vfat defaults voldmanaged=sdcard0:auto,noemulatedsd
#/dev/block/platform/msm_sdcc.1/by-name/userdata /storage/sdcard1 ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 defaults
#/dev/block/platform/msm_sdcc.1/by-name/sdcard auto ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 voldmanaged=sdcard1:29,nonremovable,noemulatedsd
# Original Entry of Gummy rom:
#/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:29,nonremovable,noemulatedsd
#/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:auto,noemulatedsd
# Working with switched sd-cards, Aut0mat3d:
/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:15,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:auto,nonremovable,noemulatedsd
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbdisk:auto

Reserved

Reserved1

This should work for most people until we fully unify the storage.
Good job there.

MrColdbird said:
This should work for most people until we fully unify the storage.
Good job there.
Click to expand...
Click to collapse
Thanks. without your Help with storage mounting i'd dropped the project

I really want to try it out but I fear that I screwed something up... I use the unofficial AOSB port. Could somebody check, if my modifications to the fstab.qcom file are correct?
Original file:
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
/devices/msm_sdcc.1/mmc_host auto ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 voldmanaged=sdcard0:29,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto vfat defaults voldmanaged=sdcard1:auto,noemulatedsd
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbdisk:auto
And the new one:
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
/devices/msm_sdcc.1/mmc_host auto auto noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 voldmanaged=sdcard1:15,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto defaults voldmanaged=sdcard0:auto,nonremovable,noemulatedsd
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbdisk:auto
Did I miss something? I would really appreciate your help because I don't want to mess up my device...

looks pretty fine, just give it a try. If it doesnt work it will not damage your device.
alternatively you can use the following lines tested on Gummy and CM11:
Code:
/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:15,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:auto,nonremovable,noemulatedsd
For getting the job more easy i have made a AROMA installer that handles with partition renaming and flashing boot.img:
http://www.oppoforums.com/threads/a...rage-and-mount-external-sd-card-as-sd0.17852/

This can use on stock color OS?

vincent_smoox said:
This can use on stock color OS?
Click to expand...
Click to collapse
in principe: Yes
You have to modify fstab in boot.img to swap sd cards

I did it
Thanks a lot. It worked. Now I have a 128 GB SD Card in my Find7.
If anybody reads this and wants the Files needed for AOSB 1.3.6 - I uploaded the ROM including new boot.img and the boot.img alone to mega. Download here:
ROM+Boot.img
Boot.img only
I hope it works for you too

Everything was working fine until after 2 days, without warning, the screen went blank and then when I rebooted, I'm unable to save screenshots and gallery images are unavailable and external storage unavailable is the error. Sdcard0 is empty under /storage
Sent from my Find7 using XDA Free mobile app

Happened Again! Random reboot followed by corrupt partition. Cannot repair via TWRP also.

defective SD card?
Gesendet von meinem Find7 mit Tapatalk

Possible.
Sent from my Find7 using XDA Free mobile app

can you repeat step 7 again? I don't understand which zip file I have to download and how are the next small steps (command lines)?
Thank you very much for your help

jowar said:
can you repeat step 7 again? I don't understand which zip file I have to download and how are the next small steps (command lines)?
Thank you very much for your help
Click to expand...
Click to collapse
update.zip means the zip file of custom rom you have installed. next steps are in command line like steps before.

Aut0mat3d said:
In this Guide you will learn how to modify your system to handle the 9GB Partition 29 as Data (App-Storage) and use the external SD-Card as internal.
Don't be afraid, this is a lot of text mostly to explain the whole procedure, the steps are straight forward.
Thanks go to Kishd (oppoforums), Coldbird and alienmind (xdadevelopers)
Beside of the public made solutions i will do the following:
Instead of repartitioning the device i will change only the partition name of "sdcard" to "userdata", mount the external SD as internal and use the remaining 3GB Partition as external SD.
So partition 15 will become "sdcard1" and partition 29 will become "userdata"
On the Find7a you will have 9 gigs of application space and xx gigs for the internal sd (size of the sdcard).
This should work on Find7 too, someone has to check the partition layout if it is equal, than you will have 25 gigs of application space and xx gigs for the internal sd (size of the sdcard).
PRECAUTIONS:
If you mess around with partition table you could brick your device, so be careful!
Thes procedure worked for me, i am not responseable for any missing or mistyped commands/procedures, so THINK BEFORE YOU DO ANYTHING!
I am not an android Pro, nor an Develper. My Spare time is very limited so i can't help you out if something goes wrong!
I've done this with Gummy Rom, not tryed with ColorOS or another custom rom but it should work on all AOSP-based ROMS.
The swapped SD-cards do not belong to recovery, so the internal SD is accessed as before.
What do you need:
1.: Time: This is not done in 5 minutes, so please be patient.
2.: A Linux-PC with working ADB and Fastboot
3.: TWRP recovery image on your PC or installed on the device: http://techerrata.com/browse/twrp2/find7a (I used 2.7.1.0)
4.: An SD card with at least 16Gb inseted into your Find7a
5.: Fully charge your Device before messing around, some jobs will need a lot of time.
6.: A fitting custom ROM installed, i've done this with Gummy-M2.3-06-29-14-NIGHTLY-find7 which is suitable for find7 and find7a which can be found here: http://crackflasher.com/gummy-m2-3-06-29-14-nightly-find7-zip-oppo-find-7a-gummy/
7.: The zip-file of the custom rom on your local PC
What are we going to do:
0.: Boot into recovery and access the Device via ADB
1.: Format external SD to Ext4 Filesystem
2.: Backup the original partition layout and all partitions too
3.: Copy Data from internal SD to external
4.: Rename two partitions
5.: Format the new "userdata" partition and move all content of the old to the new location
6.: Format the new "sdcard1" partition
7.: Edit/replace fstab files in /etc to tell TWRP and System the new mountpoints
OK, let's do the trick
Step0.: Booting into recovery and accessing the Device via ADB-shell:
Put the phone into fast boot mode. (Power Volume Up simultaneously)
Open a terminal in your linux-PC and do the following as root (sudo -r):
#: fastboot devices ( check that fastboot is up and running)
#: fastboot boot openrecovery-twrp-2.7.1.0-find7a.img (or boot into TWRP if already installed)
The phone will boot into twrp.
Connect the phone and go into adb
#: adb shell
After entering the adb shell you should see the following in your terminal:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
~ #
Step1.: Format external SD to Ext4 Filesystem
First we have to write a new partition table as i dont know how your SD-card looks:
umount /external_sd (could cause errors if no filesystem is present on SD - dont mind)
parted /dev/block/mmcblk1 (you should see parted welcome message, no errors!)
mklabel msdos (this will write a new partition table on your sdcard)
mkpart primary ext4 1 -1 (this will make a ext4 partition which uses the whole sd)
quit
Now we are going to format the ext4 partition:
mke2fs -t ext4 -m 0 -L sdcard /dev/block/mmcblk1p1
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk1p1
mount /dev/block/mmcblk1p1 /external_sd (Mount the new formatted sd-card -- this should show no errors)
If all is done without errors, proceed to step2
Step2.: Backup the original partition layout and all partitions too
dd makes physical imagea of partitions so you can put it back if needed
While DD is copying you will see no progress bar or any output, so BE PATIENT!
Code:
mkdir /external_sd/backup
parted /dev/block/mmcblk0 print > /external_sd/backup/partitions (original partition Layout for later reference)
dd if=/dev/block/mmcblk0p1 of=/external_sd/backup/modem
dd if=/dev/block/mmcblk0p2 of=/external_sd/backup/sbl1
dd if=/dev/block/mmcblk0p3 of=/external_sd/backup/dbi
dd if=/dev/block/mmcblk0p4 of=/external_sd/backup/ddr
dd if=/dev/block/mmcblk0p5 of=/external_sd/backup/aboot
dd if=/dev/block/mmcblk0p6 of=/external_sd/backup/rpm
dd if=/dev/block/mmcblk0p7 of=/external_sd/backup/boot
dd if=/dev/block/mmcblk0p8 of=/external_sd/backup/tz
dd if=/dev/block/mmcblk0p9 of=/external_sd/backup/pad
dd if=/dev/block/mmcblk0p10 of=/external_sd/backup/modemst1
dd if=/dev/block/mmcblk0p11 of=/external_sd/backup/modemst2
dd if=/dev/block/mmcblk0p12 of=/external_sd/backup/oppodycnvbk
dd if=/dev/block/mmcblk0p13 of=/external_sd/backup/oppostanvbk
dd if=/dev/block/mmcblk0p14 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/system.gz
dd if=/dev/block/mmcblk0p16 of=/external_sd/backup/persist
dd if=/dev/block/mmcblk0p17 of=/external_sd/backup/cache
dd if=/dev/block/mmcblk0p18 of=/external_sd/backup/recovery
dd if=/dev/block/mmcblk0p19 of=/external_sd/backup/fsg
dd if=/dev/block/mmcblk0p20 of=/external_sd/backup/fsc
dd if=/dev/block/mmcblk0p21 of=/external_sd/backup/ssd
dd if=/dev/block/mmcblk0p22 of=/external_sd/backup/misc
dd if=/dev/block/mmcblk0p23 of=/external_sd/backup/LOGO
dd if=/dev/block/mmcblk0p24 of=/external_sd/backup/DRIVER
dd if=/dev/block/mmcblk0p25 of=/external_sd/backup/reserve1
dd if=/dev/block/mmcblk0p26 of=/external_sd/backup/reserve2
dd if=/dev/block/mmcblk0p27 of=/external_sd/backup/reserve3
dd if=/dev/block/mmcblk0p28 of=/external_sd/backup/reserve4
dd if=/dev/block/mmcblk0p30 of=/external_sd/backup/grow
It is not urgently needed to make dd backups of userdata and (internal) sdcard but here for refernce:
Do a compressed multispan backup with dd so you can use the files on an FAT32 filesystem too:
dd if=/dev/block/mmcblk0p15 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/userdata.gz.
dd if=/dev/block/mmcblk0p29 | gzip -c | split -b 2000m -a 3 - /external_sd/backup/sdcard.gz.
Example of restoring partition 29:
cat /external_sd/backup/userdata.gz.* | gzip -dc | dd of=/dev/block/mmcblk0p29
Step3.: Copy Data from internal SD to external SD:
cp -a -i /internal_sd/* /external_sd/ (this can take a while)
ls /external_sd/ (you should see a bunch of files here)
If nothing went wrong go to step4
Step4.: Rename partitions:
umount /internal_sd/
umount /and-sec/
umount /data/
parted /dev/block/mmcblk0
name 15 sdcard
name 29 userdata
print (should show you the renamed layout)
quit
If nothing went wrong go to step5
Step5.: Format the new "userdata" partition and move all content of the old to the new location:
mke2fs -t ext4 -m 0 -L userdata /dev/block/mmcblk0p29
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p29
mount /dev/block/mmcblk0p15 /internal_sd
mount /dev/block/mmcblk0p29 /data
cp -a -i /internal_sd/* /data/ (this can take a while)
If nothing went wrong go to step6
Step6.: Format the new "sdcard1" partition:
umount /internal_sd/
mke2fs -t ext4 -m 0 -L sdcard1 /dev/block/mmcblk0p15
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p15
If nothing went wrong go to step7
Step7.: Edit/replace fstab.qcom file to tell System the new mountpoints:
Guide from Coldbird: http://www.oppoforums.com/threads/unpack-repack-find-7-a-boot-img.14538/
Unpack update.zip and make a working directory.
copy file boot.img from update.zip into this directory
download https://github.com/xiaolu/mkbootimg_tools
unpack bootimage:
mkboot boot.img extracted (this will create a folder "extracted" with the content of boot.img where you can find fstab.qcom
edit fstab.qcom co match your needs (i.e. swap internal and external storage as shown below)
pack bootimage:
mkboot extracted newboot.img (creates newboot.img)
test bootimage (via fastboot):
sudo fastboot boot newboot.img
flash bootimage (via fastboot):
sudo fastboot flash boot newboot.img
sudo fatboot reboot
This is how the original file looks:
Code:
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337 wait
/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:29,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:auto,noemulatedsd
/devices/platform/xhci-hcd auto auto defaults voldmanaged=usbdisk:auto
Code:
This is the changed file:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
# Use internal sdcard as /data
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
#/dev/block/platform/msm_sdcc.1/by-name/sdcard /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc,nomblk_io_submit,errors=panic wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
# CM11 hack: Swap sdcard1 and sdcard0 - both in ext4 and (internal)sdcard1 as emulated
#/devices/msm_sdcc.2/mmc_host auto vfat defaults voldmanaged=sdcard0:auto,noemulatedsd
#/dev/block/platform/msm_sdcc.1/by-name/userdata /storage/sdcard1 ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 defaults
#/dev/block/platform/msm_sdcc.1/by-name/sdcard auto ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,nodelalloc,uid=1023,gid=1023,dmask=0007,fmask=0007 voldmanaged=sdcard1:29,nonremovable,noemulatedsd
# Original Entry of Gummy rom:
#/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:29,nonremovable,noemulatedsd
#/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:auto,noemulatedsd
# Working with switched sd-cards, Aut0mat3d:
/devices/msm_sdcc.1/mmc_host/mmc0 auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard1:15,nonremovable,noemulatedsd
/devices/msm_sdcc.2/mmc_host auto auto uid=1023,gid=1023,fmask=0007,dmask=0007 voldmanaged=sdcard0:auto,nonremovable,noemulatedsd
/devices/platform/xhci-hcd auto vfat defaults voldmanaged=usbdisk:auto
Click to expand...
Click to collapse
Does this work with Color is 2.1.5?

unpack-repack-find-7-a-boot-img
Does anybody has unpack-repack-find-7-a-boot-img ? OppoForums are down. I need this file.

Related

Backup ext partition

Hi.
I've just bought a new memory card for my hero. Therefore I would like to know if it is possible to backup the est partition I have so I don't loose all my installed programs?
//ChosSimbaOne
Sent from my HTC Hero using XDA App
Hi,
I suggest theses command lines :
For that you should use adb sdk from :
http://developer.android.com/intl/fr/sdk/index.html
For BACKUP:
mount -t vfat /dev/block/mmcblk0p1 /sdcard
mount -t ext3 /dev/block/mmcblk0p2 /system/sd
cd /system/sd
tar cvf /sdcard/ext3.tar *
For RESTORE:
mount -t vfat /dev/block/mmcblk0p1 /sdcard
mount -t ext3 /dev/block/mmcblk0p2 /system/sd
cd /system/sd
tar xvpf /sdcard/ext3.tar
ChosSimbaOne said:
Hi.
I've just bought a new memory card for my hero. Therefore I would like to know if it is possible to backup the est partition I have so I don't loose all my installed programs?
//ChosSimbaOne
Sent from my HTC Hero using XDA App
Click to expand...
Click to collapse
first backup you all your apps to your PC in a folder of your choice, once you are done .
partition your new sdcard, once partitioning is done. just follow this guide:
http://villainrom.co.uk/wiki/index.php?title=Apps2SD

ext4 module 2.6.29 (enclair 2.1) without reflash (raw lag fix)

I compiled ext4 module to work with enclair 2.1 kernel 2.6.29, tested with XXJF5 stock firmware. Need root access, tune2fs and mke2fs static binary (e2fsprog-bin.tgz.zip)
mkdir -p /system/lib/modules/2.6.29/
#copy module.tar.gz in /system/lib/modules/2.6.29/
cd /system/lib/modules/2.6.29/
tar zxvf module.tar.gz
insmod /system/lib/modules/2.6.29/kernel/fs/jbd2/jbd2.ko
insmod /system/lib/modules/2.6.29/kernel/lib/crc16.ko
insmod /system/lib/modules/2.6.29/kernel/fs/ext4/ext4.ko
if=/dev/zero of=/sdcard/sd/filesystem.ext4 bs=1048576 count=2048
losetup /dev/block/loop1 /sdcard/sd/filesystem.ext4
mke2fs -t ex4 /dev/block/loop1
tune2fs -c 0 -i 0 -m 0 /dev/block/loop1
mkdir /sdcard/sddata
mount -t ext4 /dev/block/loop1 /sdcard/sddata
cp -rp /data/data /sdcard/sddata
cp -rp /data/system /sdcard/sddata
cp -rp /data/dalvik-cache /sdcard/sddata
cp -rp /data/app /sdcard/sddata
cp -rp /data/app-private /sdcard/sddata
mount -t ext4 -o bind /sdcard/sddata/data /data/data
mount -t ext4 -o bind /sdcard/sddata/system /data/system
mount -t ext4 -o bind /sdcard/sddata/dalvik-cache /data/dalvik-cache
mount -t ext4 -o bind /sdcard/sddata/app /data/app
mount -t ext4 -o bind /sdcard/sddata/app-private /data/app-private
run your quadrant test, i got 1793. enjoy.
ps: if you want make it permanent look at RyanZA playlogos1 trick. Also make sure your ext4 filesystem is available at boot time instead /sdcard/sddata
Note:
- due its nature ext4 keep data in RAM much more than ext3 before writing on disk, therefore if a powerloss happens before data got written this may results in lost of data. (see delayed allocation). On the other hand a temporary file wont be written to disk, but kept on RAM avoiding read/write cycles. Inode reservation can increase performance as well.
- barrier can be disabled but this may result in a corrupt journal
explain please
you may want to use ext4 without reflash, and at the same time keep your /data untouchable, just in case you need a recovery backup. eg: if /sdcard got corrupt, system will mount your original /data. (desynced)
I had to disable vold, and mv /etc/vold.conf /etc/vold.old, otherwise it coundnt find /sdcard/filesystem.ext4 so I mount it just before everything.
userinit.sh
--
/system/bin/mount -t vfat -o errors=remount-ro /dev/block/mmcblk1p1 /sdcard
insmod /system/lib/modules/2.6.29/kernel/fs/jbd2/jbd2.ko
insmod /system/lib/modules/2.6.29/kernel/lib/crc16.ko
insmod /system/lib/modules/2.6.29/kernel/fs/ext4/ext4.ko
/data/local/bin/losetup /dev/block/loop1 /sdcard/filesystem.ext4
/system/xbin/e2fsck -p /dev/block/loop1
/system/bin/mount -t ext4 /dev/block/loop1 /sdcard/sddata
/system/bin/mount -t ext4 -o bind /sdcard/sddata/data /data/data
/system/bin/mount -t ext4 -o bind /sdcard/sddata/system /data/system
/system/bin/mount -t ext4 -o bind /sdcard/sddata/dalvik-cache /data/dalvik-cache
/system/bin/mount -t ext4 -o bind /sdcard/sddata/app /data/app
/system/bin/mount -t ext4 -o bind /sdcard/sddata/app-private /data/app-private
--
mv /system/bin/playlogos1 /system/bin/playlogosnow
Do not forget to create /system/bin/playlogos1 as follow:
#!/system/bin/sh
sh /system/bin/userinit.sh
/system/bin/playlogosnow
I got 1858
this is just proof do not use on your device if you dont know what you doing. Since vold does not mount partition some application may not recognize /sdcard mounted that way.
id like to find a way to start vold before playlogos1 and resolve this issue, buts vold seems check argv[0] before start.
e2fsprogs recompiled as well ? In other words, will the e2fsprogs from cynogen work on ext4? These do use libs, btw.
I might build support for this into CFLagFix if I can freely use the files
yeah static bin.
husq510 said:
yeah static bin.
Click to expand...
Click to collapse
Just want to ask if it's ok to implament this in my lagfix zips
Ofc ill credit you
sure you can.
Thanks for the statically linked e2fsck
Nvm got it working on captivate also

data2ext for HTC Hero & G2 Touch

Hi!
I was experimenting with the data2ext script made for the Desire in following thread:
http://forum.xda-developers.com/showthread.php?t=859419
Now I managed to get it working with HTC Hero and Flykernel12a and Amon RA-s recovery v1.7.0.1 .
MAKING THIS WORKING IS A RISKY OPERATION! DO NOT START IF YOU DO NOT UNDERSTAND WHAT IS WRITTEN BELOW! I'M NOT RESPONSIBLE IF YOU DAMAGE YOUR PHONE OR YOU LOOSE YOUR DATA!
So here is what I made:
- make backup of your entire SD card, because we are going to repartition it, so all data will be lost on your SD card
- reboot to recovery and MAKE NANDROID BACKUP of your existing configuration!!! Then stay in recovery mode, and copy your NANDROID BACKUP to a safe place on your computer from the SD card!!!!! DURING THE OPERATION WE WILL ERASE THE WHOLE SD CARD!!!
- wipe your cache and dalvik-cache (only this 2, NO factory/data reset!!)
- connect to your phone with "adb shell" (while in recovery!!)
- in the shell execute following commands:
(do this only if you have active app2sd and your app/app-private/dalvik-cache directories are on the SD card EXT partition)
mount /data
rm -rf /data/app
rm - rf /data/app-private
rm - rf /data/dalvik-cache
mkdir /data/app
mkdir /data/app-private
mkdir /data/dalvik-cache
chmod 777 /data/app*
chmod 777 /data/dalvik-cache
chown 1000:1000 /data/app*
chown 1000:1000 /data/dalvik-cache
- now we will copy back the apps on the nand
mount /sd-ext
cp /sd-ext/app/* /data/app
cp /sd-ext/app-private/* /data/app-private
(no need to copy the dalvik-cache content!)
umount /sd-ext
- so now we have all our app on the nand again. next step is to put the 04data2extV4 script into the right place
umount /data
mount /system
exit
(now leaving shell to copy file)
in the command prompt execute:
adb push pathtothescript/04data2extV4 /system/etc/init.d/
adb shell
(back to shell again)
chmod 755 /system/etc/init.d/04data2extV4
chown 0:2000 /system/etc/init.d/04data2extV4
rm /system/etc/init.d/05mountsd
(remove script which mounts SD card differently)
rm /system/etc/init.d/10apps2sd
(remove script which makes app2sd)
umount /system
exit
(now leaving shell)
now we have to repartition your SD card to 2 ext and 1 fat partition. For this use the utility1 I uploaded which is modified version of the original utility in /sbin.
in command prompt:
adb push pathtoyourscript/utility1 /sbin/
adb shell
(back to shell)
chmod +x /sbin/utility1
(now execute the utility)
/sbin/utility1
choose 0 from menu: Partition SD 2 EXT 1 FAT (can set sizes)
enter the first EXT partition size (min. 3-400, I use 1300 - values are in MB)
enter second EXT partition size (min. 2-300, I use 300 - values are in MB)
the rest will be configured for the FAT32 file system
On the first EXT partition you will store the whole /data
On the second EXT partition you will store the /data/data in a loop file
Now we are hopefully ready to reboot, the rest will be managed by the 04data2extV4 script, wich creates the ext2 file systems, converts them to ext4, stets file system option such as journaling where needed, etc and copies everything from nand to ext4.
I hope this works for all. I reached Quadrant score for total system score about 455, without data2ext I had about 400. But I have a Class4 SD card. On class6 I'm sure it will be even faster.
Again, it is risky, so take care.
The boot process can be long, because at the first time it will copy the whole /data directory to the first EXT partition, the data/data directory on the 2nd partition, and will recreate the whole dalvik-cache (remember we wiped!).
Enjoy
Regards,
byr2
PS: in the RAR file you will find an FSTAB file. I removed the /sd-ext mount option from it. If you have trouble, try to replace the fstab file in /etc to this fstab file or remove the /sd-ext mount option from your fstab
Thank you for this.
Just a few questions. The EXT partitions, are they EXT 2, 3 or 4?
Are you using exactly the same script as ownhere? As in, you use exactly his method, aka the following one:
"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."
Are you running this stable? Reboots? All apps show after reboots?
Hi!
The two EXT partition is EXT4 partition. The script I provided is based on ownhere's script, wich is modified only in a few places.
For example on hero I do not have a /system/xbin/mkfs.ext4 like he had, but only a mkfs.ext2, so I have to create the EXT4 partition on a different way. Also the loopback device is set up in a different way than in the original script.
But what you quoted remains so, which means I did not modified any location of storage files, nor did modified filesystem parameters. First EXT4 ha no journaling ,second EXT4 has journaling, ext4 loop device has no journaling.
You can diff the two scripts to see the difference, but an example here:
Original part:
/system/xbin/mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk0p2
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
/system/bin/e2fsck /dev/block/mmcblk0p2
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk0p2
Modified part:
/system/xbin/mkfs.ext2 -b 4096 -m 0 -F -L extdata /dev/block/mmcblk0p2
/system/bin/e2fsck -y -v -f /dev/block/mmcblk0p2
/system/bin/tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
/system/bin/e2fsck -fpDC0 /dev/block/mmcblk0p2
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
/system/bin/e2fsck /dev/block/mmcblk0p2
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk0p2
As you can see I create an ext2 partition, check it, and with tune2fs I convert it to EXT4, check it again, and set the same parameters ownhere has set.
for loopback device I use:
$BUSYBOX losetup /dev/block/loop1 /mnt/asec/extdata/ext4
$BUSYBOX mount -t ext4 -o loop,sync,commit=3,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/loop1 /mnt/asec/tmpdata
the losetup is needed, because for some reason it won't mount as loop. But this way it is working.
Other parts of the script are untouched.
Regards,
byr2
"Are you running this stable? Reboots? All apps show after reboots?"
Till now everything runs OK, no reboot, all widgets, apps, settings were preserved. After reboot also everything OK. Made some phone calls, no problems so far.
Just with Class4 SD card the speed gain is not as huge as expected. The IO performance is slightly better, but not too much. I've read posts on CDMA Hero forum, where they managed to get quadrant score over 700, but I'm sure not with a Class4 SD card
But the funniest thing in settings is: Available internal phone storage: 1,17Gb
Excuse me for the noob question, but what this process basically does is make the entire phone run off of an ext4 partition on the SD card?
No, not the entry phone, just the /data directory is moved to ext4 partition (wich is accessed frequently by the OS, and where applications and application related data are stored). The kernel, firmware, etc. remains on the NAND.
I wonder what one does when flashing a new ROM =/ You have to go through this procedure every single time? What does AmonRA do when you Wipe Data/Factory Reset?
So essentially the differentiations are due to the fact that we lack a /system/xbin/mkfs.ext4 (since we only have an ext2) and you turn the first EXT4 partition into a non journaling one to fill the lack of that, if i understand correctly.
If you flash a new rom, then all this is gone, since if will overwrite the /system/etc/init.d where our data2ext script is located. So you're right, you have to do this every time you flash a new ROM. A solution would be to pack this script into the ROMs, so it would work out of the box without this hack mentioned in the first post.
The data/factory reset wont work I think, because it deletes from the nand, but since our data/settings are not on the nand but the SD, it will have no effect.
the first ext4 partition is non journaling because ownhere write the script so. You can read in his post why he choosed to do so.
The first EXT pratition where /data is stored is a EXT4 part without journaling
The second EXT partition where the loop file is stored is an EXT4 part with journaling
and the LOOP file which contains an EXT4 partition without journaling
from ownhere's post:
"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..."
This is the setup here also.
byr2
I see, the script is essentially the same, with your own critical changes to fit the Hero.
Now what i am trying to understand is what happens when you want to flash a new ROM.
Say you place the 04data2extV4 script in the new ROM's /system/etc/init.d and remove the other two scripts if they exit (05mountsd and 10apps2sd). Does this mean the partitions and this whole process won't have to be repeated?
Also when installing a new rom it is recommended you wipe data and system, if AmonRA doesn't wipe, what do we do?
Well, I've not tested to install a new rom, but let think:
- the partitions are preserved on your SD, so repartitioning is not needed.
- but as you mention all data/settings are currently on your SD, so a wipe does nothing with it, and if you simply put the 04data2extV4 script back to init.d I think it will mess things just up... but if you just delete everything off the two EXT partitions I think it will be fine
That's the only limitation i have so far as to not attempting this.
I wonder if i can mod the AmonRA Recovery to delete the content of those 2 partitions instead =/
I'm going to have a look.
Nice work!
By the way, I was thinking. Why not just make an ext partition, add a line for it in fstab and set the mountpoint for it to be /data. What would happen if I tried this?
Byr2.... just wanted to say this is first thing i read today and without coffee all I heard was
Blah blah blah dangerous blah blah blah faster blah blah risk blah blah even faster
Lmao
Once I get my head working it should prove interesting though
Thanks for this experiment
Sent from my HTC Hero using Tapatalk
ok, sitting down at pc now, drinking espresso...
this is starting to sink in
Instant benefit is huge storage space which, coupled with the method used, ought to have a general performance improvement over previous ext-based apps2sd, right? if so then removing ext-based apps2sd and using this script concept instead seems like a good plan if, for example, every rom builder switched to this concept and removed old apps2sd stuff simultaneously. Does that sound right or wrong?
if you have a fast sd card then the speed benefit should be very good, better than using ext-based "apps2sd" since it's the actual data partition on the ext card.
and I too would like to know the answer to the brief question someone already asked - what about just setting a mount point to data on the sd card and doing it that way in simple linux fashion? I'm not bothering to think this through - coffee's still kicking in - I'll leave the intelligence to you folks who are already awake.
IMHO this idea of yours is quite brilliant as a goal (well ok, it's not your idea, but you did it first on the gsm hero . The thing that slows my phone the most is reads and writes to phone memory and to my stock sd card. I can upgrade the sd card but the phone memory writes are still slow. This would improve the speed of the largest file writes when managing my apps and installing from the market which we all know brings our phones to a standstill briefly during installs and so on.
How's the performance when installing apps? does your phone still crawl for a bit at those crucial moments or is it all somewhat less of a dramatic slowdown now?
Hi All!
Well, If you do not change the ROMs frequently, it should not be a problem that ROM developers do not include this script. However till now only one ROM developers have taken care about this opportunity, I think it was Cronos. They have a modified ROM wich supports this kind of functionality.
The speed gain over app2sd comes from storing the whole data partition on a faster SD card than the internal NAND. As my tests show a class4 SD card is slightly faster than the internal NAND (not much, say about 5-10%). A class6 SD card could be much more faster. All application access the data partition to read and write settings/data. Even the Frimware stores things there, so if you have a fast SD card, overall system performance could be great.
Not to mention about stored data space. With app2sd you only store the downloaded apk-s on the EXT. With data2ext you have extra space for the application data/settings/cache wich size is determined by you and your SD card size ! (See screenshot!)
A simple fstab modification could work, however the script does do a lot of things beside copying everything to EXT. It also sets up some symlinks during every boot, so a part of the script is needed always. Also there is 2 EXT partitions, and the /data/data is stored on a 2nd EXT partition in an EXT4 loop file image So it's not that easy to simply mount it via fstab.
byr2
dkelley said:
Byr2.... just wanted to say this is first thing i read today and without coffee all I heard was
Blah blah blah dangerous blah blah blah faster blah blah risk blah blah even faster
Lmao
Click to expand...
Click to collapse
Hahaha. I've read this several times now and still all I get is what you wrote above.
I got this after all
Code:
$mount
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /acct type cgroup (rw,cpuacct)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,cpu)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime)
/dev/block/mtdblock5 on /mnt/asec/mtddata type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,size=0k,mode=000)
All correct?
This is mine:
Code:
rootfs on / type rootfs (ro,noatime)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /acct type cgroup (rw,cpuacct)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,cpu)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime)
/dev/block/mtdblock5 on /mnt/asec/mtddata type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0
020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_ut
ime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,size=0k,mode=000)
/dev/block/dm-0 on /mnt/asec/com.qualcomm.qx.neocore-1 type vfat (ro,dirsync,nosuid,nodev,noexec,uid=1000,fmask=0222,dmask=0222,code
page=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
Seems your's almost the same...
The key is this:
Code:
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
How is your phone performing? Was everything OK?
byr2
Everything seems to be ok )
There is no more sticking when new apk installed. Quadrant score around 500.
I have Class 10 sd card (prooflink).
But I have had a little problem - not enough nand space to hold all of my apks, so I've decided to push most of them via adb from my laptop after Hero's reboot.
Quadrant score not so high as I expected, but anyway I'm happy =)
if you push it via ADB after reboot, than it should get to the right place
The quadrant score is affected by 3D and CPU also, but can you feel the "speed" while testing the IO? Does it run fast? How long is the DB read/write, FS read/write?
I'm happy someone else could get this thing working
byr2

f2FS

Can we just reformat system partition with f2fs and boot using f2fs enabled kernel?
GR0S said:
Can we just reformat system partition with f2fs and boot using f2fs enabled kernel?
Click to expand...
Click to collapse
System partition is read only and you miss the point of f2fs benefits (improve random write performance) in that case.
In case you have kernel-3.8 and up, you need to add kernel configuration options:
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
Besides this, you need to re-create system.img as f2fs sparse image:
# create empty partition size file
dd if=/dev/zero of=system_f2fs.img bs=1024 count=<system partition block count>
# simulate block device
losetup -d /dev/loop0
losetup /dev/loop0 system_f2fs.img
# format f2fs partition
mkfs.f2fs /dev/loop0
mount -t f2fs /dev/loop0 /mnt/system/
# copy system partition content
cp -r <android workspace>/out/system/* /mnt/system/
umount /mnt/system
# create sparse partiotion
img2simg system_f2fs.img system_f2fs_sparce.img 1024
You need:
1. host side kernel supports f2fs
2. f2fs-tools on host side
3. img2simg tool (implemented by <android workspace>/system/core/libsparse)
4. change in fstab file to be able to mount /system as f2fs (<android workspace>/device)
Thanks.

[GUIDE] Make Link2SD use a disk image instead of a second ext2 partition

Was using Link2SD to move apps to the second partition of a micro SD card for the usual reasons... Then did -something- that broke the micro SD card slot. Now what to do?
Possible solutions:
Is it possible to repartition the internal NAND? -- Wouldn't that involve unpacking and repacking the kernel image? Better not... Although it was an inexpensive tablet, it would be an expensive brick.
Is it possible to bind-mount a directory on the "internal SD" for use with Link2SD? -- Would that even work with vfat? (Permissions and stuff...)
What about replacing the ext2 SD-card partition with a disk image
Materials:
Android tablet. (Broken SD card slot optional.)
Root with busybox installed.
Link2SD installed and configured -- This has to be done prior to breaking the SD card slot. Link2SD's startup scripts are needed, which it may not create without a "properly" formatted and installed SD card.
Computer with Linux installed OR a Linux Live DVD -- To create the disk image and transfer the contents from the physical SD card to the image file. I used Ubuntu.
USB transfer cable (optional) -- To transfer the disk image from the computer to the tablet. Also to execute terminal commands on the tablet. Possible to do over a network, but the cable can be faster and more convenient.
Do not try this unless you are fully prepared to brick your device.​
Method:
Create the disk image on the computer:
Code:
qemu-img create -f raw link2sd-disk.img 3G
Format the disk image to ext2:
Code:
mkfs.ext2 link2sd-disk.img
Mount the disk image to a newly created directory:
Code:
mkdir /tmp/link2sd-disk
sudo mount -o loop link2sd-disk.img /tmp/link2sd-disk
Mount the original SD card with the second ext2 partition.
Copy the contents of the sd card to the disk image. Use rsync to keep file permissions and other metadata. The trailing "/" on the directory names is important.
Code:
sudo -s
rsync --archive --hard-links /media/path-to-sd-card/ /tmp/link2sd-disk/
Unmount the sd card and disk image.
Code:
sudo umount /tmp/link2sd-disk
Transfer the disk image to your tablet.
Code:
adb push link2sd-disk.img /mnt/sdcard/link2sd-disk.img
Edit /system/bin/debuggerd on the tablet:
Code:
adb pull /system/bin/debuggerd
Edit debuggerd with your favorite text editor. Pay careful attention to the actual identity of the internal sd card as used on your tablet (/dev/block/mtdblock9). Notice that "busybox mount" is used. The normal mount command does not support the necessary options.
Code:
#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-debuggerd.log
ls -la /dev/block/ 1>>$LOG 2>>$LOG
echo 1>>$LOG 2>>$LOG
echo "$(date) mounting..." > $LOG
busybox mount -t vfat -o rw,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,shortname=mixed,errors=remount-ro /dev/block/mtdblock9 /mnt/sdcard 1>>$LOG 2>>$LOG
busybox mount -t ext2 -o loop,rw /mnt/sdcard/link2sd.img /data/sdext2 1>>$LOG 2>>$LOG
echo 1>>$LOG 2>>$LOG
mount >> $LOG
echo 1>>$LOG 2>>$LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
Backup the original file and transfer the new file and set permissions.
Code:
adb shell mv /system/bin/debuggerd /system/bin/debuggerd.001
adb push debuggerd /system/bin/debuggerd
adb shell chmod 755 /system/bin/debuggerd
All done. Reboot. :fingers-crossed:
Hope the above is useful or enlightening. Let me know if I need to explain anything in greater detail.
I've tested this on HTC One X and it does not work. After mounting sdcard and my image using these commands:
Code:
busybox mount -t vfat -o rw,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,shortname=mixed,errors=remount-ro dev/block/vold/179:14 /mnt/sdcard 1>>$LOG 2>>$LOG
busybox mount -t ext2 -o loop,rw /mnt/sdcard/link2sd.img /data/sdext2 1>>$LOG 2>>$LOG
I have access to the image file from /data/sdext2 but my sdcard is not visible in the system (but it is mounted in the /mnt/sdcard). Does anyone know how to mount .img during boot? Binding to debuggerd seems to be not the best option. :S
EDIT BELOW:
I've found a solution to this issue:
1. create 03mountsd file
2. put it in the /etc/init.d/ directory (for example, using adb)
3. reboot
03mountsd contents:
Code:
#!/system/bin/sh
#added by link2sd
LOG=/data/mountsd.log
COUNTER=60
ls -la /dev/block/ 1>>$LOG 2>>$LOG
echo 1>>$LOG 2>>$LOG
echo "$(date) mounting..." > $LOG
while [[ $COUNTER -gt 0 && ! -f /storage/sdcard0/app.img ]]; do
COUNTER=$(($COUNTER-1))
sleep 1
done
echo "=> COUNTER = $COUNTER" > $LOG
# busybox mount -t vfat -o rw,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,shortname=mixed,errors=remount-ro /dev/block/vold/179:14 /mnt/.sd 1>>$LOG 2>>$LOG
busybox mount -t ext4 -o loop,rw /storage/sdcard0/app.img /data/sdext2 1>>$LOG 2>>$LOG
echo 1>>$LOG 2>>$LOG
mount >> $LOG
echo 1>>$LOG 2>>$LOG
EDIT: still not working: applications moved using link2sd and this method are not visible for android. :/

Categories

Resources