[MOD] Mounting sdcard as userdata(a/b dualboot hack) - OnePlus Nord N10 5G Guides, News, & Discussion

Here's the setup, it assumes you want to assign your sdcard as data partition for slot b...
Have the same system on both slots during setup.
Pull vendor partitions(instructions assume your using linux), modify fstab files, reflash vendor images.
adb pull /dev/block/mapper/vendor_a vendor_a.img
adb pull /dev/block/mapper/vendor_a vendor_a.img
Resize vendor image to modify files within, extend the image by 100MB
e2fsck -vfy vendor_a.img
e2fsck -vfy vendor_b.img
For vendor_b.img do:
Get current size in MB ex output 1253
du -m vendor_b.img
Resize +100MB
resize2fs vendor_b.img 1353M
Mount the image to access content
mkdir mnt
mount vendor_b.img mnt
Replace fstab.default and fstab.emmc with examples provided, sync, unmount.
cat fstab.default.sdmod.b.txt >mnt/etc/fstab.default
cat fstab.emmc.sdmod.b.txt >mnt/etc/fstab.emmc
sync
umount mnt
For vendor_a.img we hide the sdcard from vold. Keeping slot a system from declaring the sdcard as corrupted with the persistent notification about formating the card.
Get current size in MB ex output 1253
du -m vendor_a.img
Resize +100MB
resize2fs vendor_a.img 1353M
Mount the image to access content
mount vendor_a.img mnt
cat fstab.default.sdmod.a.txt >mnt/etc/fstab.default
cat fstab.default.emmc.a.txt >mnt/etc/fstabs.emmc
sync
umount mnt
Reboot phone into fastbootd, flash vendor images
fastboot flash vendor_a vendor_a.img
fastboot flash vendor_b vendor_b.img
Setup an sdcard with gpt partition map and one f2fs partition
Example device paths are: /dev/sdb(sdcard mounted with usb) or /dev/mmcblk0(sdcard mounted in card reader)
Get this CORRECT to avoid damaging other storage devices!
fdisk /dev/mmcblk0
g
n
(use defaults for partition size etc. We format with make_f2fs from platform tools next)
w
/path/to/platform-tools/make_f2fs /dev/mmcblk0p1
With freshly formated sdcard in phone, and both vendor a and b images flashed to respective slots, we set slot b as active and boot it.
fastboot set_active b
fastboot reboot
UFS(internal) data is/stays encrypted
SDHCI(sdcard) is not encrypted.
Mount slot b's data partition inside slot a with
adb shell mkdir /data/mnt
adb shell mount /dev/block/mmcblk0p1 /data/mnt
Use a root file explorer to get into /data/mnt
Todo:
Possibly encrypt sdcard, not sure if android allows two encrypted partitions, may be one or the other. I have an example fstab line in the file, however I did not get phone to boot with sdcard encrypted flags.
Modify orangefox recovery to see sdcard as data partition to allow formatting the partition on device(other than running make_f2fs from slot a)
Upload vender images to androidfilehost to download

mrbox23 said:
Here's the setup, it assumes you want to assign your sdcard as data partition for slot b...
Have the same system on both slots during setup.
Pull vendor partitions(instructions assume your using linux), modify fstab files, reflash vendor images.
adb pull /dev/block/mapper/vendor_a vendor_a.img
adb pull /dev/block/mapper/vendor_a vendor_a.img
Resize vendor image to modify files within, extend the image by 100MB
e2fsck -vfy vendor_a.img
e2fsck -vfy vendor_b.img
For vendor_b.img do:
Get current size in MB ex output 1253
du -m vendor_b.img
Resize +100MB
resize2fs vendor_b.img 1353M
Mount the image to access content
mkdir mnt
mount vendor_b.img mnt
Replace fstab.default and fstab.emmc with examples provided, sync, unmount.
cat fstab.default.sdmod.b.txt >mnt/etc/fstab.default
cat fstab.emmc.sdmod.b.txt >mnt/etc/fstab.emmc
sync
umount mnt
For vendor_a.img we hide the sdcard from vold. Keeping slot a system from declaring the sdcard as corrupted with the persistent notification about formating the card.
Get current size in MB ex output 1253
du -m vendor_a.img
Resize +100MB
resize2fs vendor_a.img 1353M
Mount the image to access content
mount vendor_a.img mnt
cat fstab.default.sdmod.a.txt >mnt/etc/fstab.default
cat fstab.default.emmc.a.txt >mnt/etc/fstabs.emmc
sync
umount mnt
Reboot phone into fastbootd, flash vendor images
fastboot flash vendor_a vendor_a.img
fastboot flash vendor_b vendor_b.img
Setup an sdcard with gpt partition map and one f2fs partition
Example device paths are: /dev/sdb(sdcard mounted with usb) or /dev/mmcblk0(sdcard mounted in card reader)
Get this CORRECT to avoid damaging other storage devices!
fdisk /dev/mmcblk0
g
n
(use defaults for partition size etc. We format with make_f2fs from platform tools next)
w
/path/to/platform-tools/make_f2fs /dev/mmcblk0p1
With freshly formated sdcard in phone, and both vendor a and b images flashed to respective slots, we set slot b as active and boot it.
fastboot set_active b
fastboot reboot
UFS(internal) data is/stays encrypted
SDHCI(sdcard) is not encrypted.
Mount slot b's data partition inside slot a with
adb shell mkdir /data/mnt
adb shell mount /dev/block/mmcblk0p1 /data/mnt
Use a root file explorer to get into /data/mnt
Todo:
Possibly encrypt sdcard, not sure if android allows two encrypted partitions, may be one or the other. I have an example fstab line in the file, however I did not get phone to boot with sdcard encrypted flags.
Modify orangefox recovery to see sdcard as data partition to allow formatting the partition on device(other than running make_f2fs from slot a)
Upload vender images to androidfilehost to download
Click to expand...
Click to collapse

I would rather buy another phone

Related

[REQ] Boot partition in internal memory.

Hi world!
I don't know if this is the right place to ask for this feature, since I guess this is more hardware dependent than just plain programming:
Is it possible to create a bootable partition in the internal memory of the Diamond?
This could possible kill my need for USB memory once and for all.
hello,
i do it with sd-cards under linux.
one possible way is to use vmware.
when you put your diamond to windows, select on diamond harddisc.
vmware-linux have to recognized a harddisc.
now you can make partitions with fdisk.
i know, my guideapplication is very grossly. but the two sentence
costs you more than five or more houers of work, if you dont know,
how to use fdisk or vmware with linux inside.
why you want partition your internal memory?
okokur
I do it in my X51V, it need if you want start a kernel linux boot.
with Linux partition manager you must create small partition swap in strorage memory and put the kernel img here, in the storage card you must put the haret.exe + config file.
the commands are:
The SD card needs to be partitioned into two partitions: one small FAT partition that WinCE can see, and one EXT2 partition used as root file system. I'll assume that the block device of the SD card is called /dev/sda. Replace this with the correct device on your system. Instruction could be slightly different for each version of fdisk :
* Delete all partitions on the SD card:
fdisk /dev/sda
d
1
d
2
d
3
* Create partitions, for example a 10MB /dev/sda1 and /dev/sda2 using the rest:
fdisk /dev/sda
n
p
1
<default> (should be cylinder 1)
+10M
n
p
2
<default>
<default> (should be last cylinder of the card)
t
1
4
w
* Create file systems, a VFAT on /dev/sda1 and EXT2 on /dev/sda2:
mkdosfs /dev/sda1
mke2fs /dev/sda2
* Copy HaRET, the kernel and default.txt onto sda1:
mount /dev/sda1 /mnt
[diamond] cp zImage???????????????/mnt/zImage
cp haret-0.4.8.exe /mnt/haret.exe
cp default.txt /mnt/default.txt
umount /dev/sda1
mount /dev/sda2 /mnt
[diamond] bzcat diamond?????????.rootfs.tar.bz2 | (cd /mnt; tar x)
umount /mnt
3) Boot
start haret.exe and tap the "Run" button...
enable Mirror Mode(Start -> Settings -> System>Mirror).
for Diamond you need Zimage and rootfs
look here http://linuxtogo.org/~lgorris/kaiser-bootkit/
for other problem or command here
http://forum.xda-developers.com/showthread.php?t=402002
I think it just works fine...
But Haret doesn't work on Diamond.

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.

How to put /data on external SD

WORD OF WARNING: if you do this, wiping /data from recovery will not actually wipe data. AND if you install a new ROM, via clean or dirty flash, chances are your large /data partition will go all screwy on you. It did for me. If I flashed anything, it tends to cause boot loops or hangs at the boot animation.
If you are dirty flashing anything, I would first get as much off of the large /data as you can to get it to 2 GB or less, then drop it on top of your 2 GB /data partition, then dirty flash, let everything come back up and get stable then repeat these steps starting at step 2 to blow away your large /data and then mirror your 2 GB /data to your large /data.
The problems I had could be related to xposed, but I am not 100% certain on this. It is my best guess from looking at my logcat (doesn't actually indicate a crash in there, but has a lot of stuff related to xposed).
These steps are more for the non-flashaholics amung us OR people who flash new stuff but roll back to nandroid. Once you pop the larger /data onto any ROM, your nandroid will likely not play nice with it anymore as your larger /data is not restored from a nandroid.
And the normal "warranty is now void" and "if things break, it isn't my fault" disclamer stuff too. But I'm running this right now and liking it (except when I go to jump to KK it may not be happy with me... gonna need to do some testing to nandroids work properly AND so I can flash ROMs without blowing everything up... thinking it is just the dalvik that is unhappy, but I am uncertain at this time)
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
chown system:system /data
restorecon /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the next command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
chown system:system /data - This gives system ownership of /data instead of root as is originally done
restorecon /data - we do this just in case the userdata partition has been reset.
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#!/system/bin/bash" > dataswap
echo "if [ -e \"/dev/block/mmcblk1p2\" ]" >>dataswap
echo "then" >> dataswap
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap
echo "chown system:system /data" >> dataswap
echo "restorecon /data" >> dataswap
echo "fi" >>dataswap
chown root:shell dataswap
chmod 777 dataswap
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
EDIT: cleaned up the instructions a little and added in some recommended steps (the chown and restorecon) and removed the waiting to mount /data as that just makes things unhappy long term.
EDIT: added error handling in case mmcblk1p2 does not exist to the startup script. If it does not exist, it will now NOT swap the partitions. So as a failsafe, if your phone gets stuck at the boot animation, you can power it down, remove the SD card and power it back up to boot with your default /data partition. This should not need to be done, but there is a chance that your SD card could die or your new /data partition get corrupted, this will allow you to recover safely and will likely only require you to re-create your data partition and NOT have to re-do your whole ROM due to something going bad on the big /data.
Dang...found a bug: it looks like if you leave it for a few days or reboot our something(have not narrowed it down yet) some apps stop working... investigating it and should have a solution sometime tonight... sorry to all those who have tried this... if you have not done much, I'd suggest switching back to normal /data until I get the bug sorted out. My best guess is that reboot doesn't unmount the partition cleanly but I'm not positive...
bmg002 said:
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the last command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#/sys/bin/bash" > dataswap.sh
echo "while [ \`mount | grep -c sdcard\` -lt 3 ]" >> dataswap.sh
echo "do" >> dataswap.sh
echo "sleep 10" >> dataswap.sh
echo "done" >> dataswap.sh
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap.sh
chown root:shell dataswap.sh
chmod 777 dataswap.sh
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
Click to expand...
Click to collapse
So found a solution to crashing apps . Load up the play store and update your apps. Worked for me anyways.
Now to fix a potential mounting bug in the op, put any scripts on a different ext4 position such as/system/xbin or/system/etc/init.d.
I'll keep you posted if I find other bugs.
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
Bleh new bug:
When you unplug it from a pc, it gets confused and you get io errors which cause it to crash back to the boot animation and get stuck there... too tired to debug out tonight but I'll poke at it tomorrow... thinking I may need to build a kernel module for this... or a custom kernel
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
So the unplugging issue seems quite intermittent and I am unable to get consistent results with it. So I am not sure if it is a bug or not. I updated the OP to have error handling so you can pull your SD card out to mount the 2 GB /data that your phone normally does instead of your big one in the event that something goes wrong.
Hrm... so my testing and further development with this has taken a temporary pause due to my SD card dying on me. Stupid SD card... haven't even had it a year. Hoping I can find the reciept. But once I get it replaced, I'll be jumping in on this some more. I have a few cool ideas that we can do by moving partitions to external storage...
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
hatememarkz said:
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
Click to expand...
Click to collapse
From my testing it seems to work but puts a heavy load the sd card. And if your sd card fails you will lose some data.
I have not tested this on KitKat yet but that is my plan soon.
Sent from my SM-T310 using xda app-developers app

[Q] Cannot boot by /system on SDCard

I had move the /system partition on sd card, and modified the init file to mount sdcard partition when booting. But it failed and the phone stayed at logo screen.
I create a FAT32 partition and ext4 partitions on sd card with MiniTool partition Wizard, and mount them under /mnt directory.
Then, copy /system partition to sdcard, by cp -a /system /mnt/system.
Finally, I extract the boot partition, modified the init file in ramdisk directory, repack and flash back to internal memory.
The mount info located in init.smdk4x12.rc as mount_all fstab.smdk4x12. So I modify the mount point of /system as sdcard partition.
The phone cannot boot, and stay at logo screen.
However, I use the same method to /cache and /data partitions, it works very well.
So, is there anything wrong with this method for /system partition?
Thanks for your help!!!

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

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.

Categories

Resources