Ascend G6 L11 -- use whole internal memory for apps+data - Huawei Ascend G6

Note: This is probably only helpful for people with a computer science or linux hacking background!
We all know the single biggest issue with this phone is the lack of internal memory for apps and app data. The internal partitioning looks like this:
/system 1 GB
/data 2 GB
sdcard0 4 GB -- lots of space that competes with external SD! Let's use it!
other stuff (tmp, boot, etc.) 1 GB
persona78 provided an excellent mod of the (most recent) stock ROM that gives you root and a working init.d:
https://forum.xda-developers.com/ascend-g6/general/root-upadtekinguser-zip-modded-extras-t3349679
This mod also enables to move apps to a new ext4 partition on the external SD card. My experience however is:
dalvik cache and app data (e.g. some social media apps caching videos etc.) will still fill up the /data partition
access to external SD, even a fast one, is much slower
if you also move app data to external SD, the phone becomes unusable (slow)
So I propose the following solution, successfully tested on my phone, that will use just short of 6 GB on the internal SD card for dalvik cache, apps and their data!
This is how to do it:
backup everything important from the phone
unlock bootloader and install the ROM from persona78, linked above. Make sure root works, adb works.
connect to a Linux machine via USB that has adb installed
select mass storage mode on the phone in the USB settings
Now in mass storage mode do the following:
the phone exposes a block device without partitioning (e.g. /dev/sdb) and a block device with partitioning (e.g. /dev/sdc, /dev/sdc1). the former is the internal storage (sdcard0), the latter external storage (sdcard1).
mount /dev/sdb to /mnt/internal and /dev/sdc1 to /mnt/external
rsync -a /mnt/internal/ /mnt/external/
umount /dev/sdb
mkfs.vfat -C /var/tmp/vfat 256000
dd if=/var/tmp/vfat of=/dev/sdb bs=1M (you can delete /var/tmp/vfat after this)
losetup /dev/loop0 /dev/sdb -o 262144000
mkfs.ext4 /dev/loop0
On the phone you can now change back the USB mode to MTP (but not to charge only -- a data mode is needed for adb to work).
Now run adb shell and obtain root in the shell via 'su'. In the adb root shell:
mkdir -p /data/sdext4
losetup -o 262144000 /dev/block/loop7 /dev/block/mmcblk0p25
mount -t ext4 /dev/block/loop7 /data/sdext4
in /data/sdext4, create two directories called 'data-app' and 'data-data'. Give them the respective permissions and group,ownership as with the current /data/app and /data/data directories.
cp -a /data/app/* /data/sdext4/data-app
cp -a /data/data/* /data/sdext4/data-data
rm -r /data/app/* /data/data/*
mount -o remount,rw /system
edit /etc/init.d/01AOBoot as follows
Content of /etc/init.d/01AOBoot:
#!/system/bin/sh
CONCURRENCY=makefile
# mount sdext4
losetup -o 262144000 /dev/block/loop7 /dev/block/mmcblk0p25
mount -t ext4 /dev/block/loop7 /data/sdext4
mount -o bind /data/sdext4/data-app /data/app
mount -o bind /data/sdext4/data-data /data/data
# change dalvik permissions
chmod 773 /data/dalvik-cache
# change scaling_min_freq to 300000
echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Click to expand...
Click to collapse
Now run adb reboot. It is done.
Explanation: Apps and their data need to reside on an ext4 partition. sdcard0 however has to be vfat, otherwise the phone will always complain and ask to format it. We can also not change the internal storage partitioning. Therefore we simply hide a large ext4 filesystem behind a small vfat filesystem on the same partition. Apps will startup fast and run fast, and all media files can be put on the external sd card.
I know this is very exotic to most, but maybe there are a few people like me with the necessary background who would like to follow my example. Happy hacking!

Are you kidding me?
This is a great work that you did. My phone keeps complaining about low disk space but I was gonna use parted to resize the data partition.

Related

How to run applications off the sdcard (Updated 6/3/09)

DOES NOT WORK ON CUPCAKE 1.5. Try one of the other apps to sd card threads.
I decided to create a new thread for hacking a rooted g1 to allow applications to run from the sdcard. The original thread's instructions don't work without some modifications and the original poster doesn't seem to have the time to update it.
I'll try to keep the original post as up to date as possible as new information comes.
Prerequisites:
1. Rooted g1 with jesus freak version 1.30 or 1.31, 1.41 (rc30, rc33) Works with all rooted US, UK, international versions of the g1.
2. Have "adb" from the android sdk installed on your desktop machine.
Sdcard preparation:
Divide your sdcard into 2 partitions. The first partition should be FAT, the second partition should be EXT2. This can be most easily accomplished using a linux or mac machine. For windows, you can use "paragon partition manager 9" to do this. It will allow you to partition your sdcard and format the 2nd partition to ext2 fs. It is very important that the 2nd partition be formatted as EXT2 or the rest of the procedure will NOT work. The 2nd ext2 partition will be used to store your installed apps.
In the original thread, somebody mentioned a HP sdcard partition tool program, but I don't believe that will allow you to format the partition to EXT2 fs.
Procedure:
1. With the phone off, insert your newly partitioned sdcard into the g1.
2. Connect your g1 to your desktop via the usb cable and turn it on.
3. Backup your original mountd.conf and initrc.rc files from your g1 by running the following commands on your desktop from the cmd shell:
adb pull /system/etc/mountd.conf <dir on your desktop>
adb pull /system/init.rc <dir on your desktop>
4. Mount your g1's /system directory as writable via the desktop cmd shell:
adb remount
5. IMPORTANT! Create a /system/sd directory on your g1 via the desktop cmd shell:
adb shell mkdir /system/sd
adb shell ls /system and make sure that the directory has been created.
6. Download the attached modified mountd.conf and init.rc files to your PC.
7. Push the modified mountd.conf to your g1 via the desktop cmd shell:
adb push /<dir on your desktop of modified file>/mountd.conf /system/etc/mountd.conf
8. Push the modified init.rc to your g1 via the desktop cmd shell:
adb push /<dir on your desktop of modified file>/init.rc /system/init.rc
9. Reboot your g1
10. Connect to the g1 shell via the desktop cmd shell:
adb remount
adb shell
11. Check to see that the ext2 partition has been created and mounted:
busybox df -h
You should see a line that looks similar to this:
/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd
If you don't see this line, you didn't partition your sdcard correctly. STOP! Go back and do that.
12. From the G1 shell run the following cmds to copy your app and app-private directories from the internal g1 storage to the sdcard.
busybox cp -a /data/app /system/sd
rm -r /data/app
ln -s /system/sd/app /data/app
busybox cp -a /data/app-private /system/sd/app-private
rm -r /data/app-private
ln -s /system/sd/app-private /data/app-private
13. Reboot, enjoy all the extra storage!
Undo Procedure by heldc:
Dunno if this has been posted yet, but the undo process is simple. I just did it with no problems, and thought others might want it as well. (Note-if you're copy pasting this to do it, anything following # til the end of a line is just a comment, don't copy/paste it.)
adb remount #makes your file system writeable
adb push /<place you backed up mount.conf to>/filenameofbackeduporiginalmount.conf /system/etc/mountd.conf #restores the original mount.conf
adb push /<place you backed up init.rc to>/filenameofbackeduporiginalinit.rc /system/init.rc #restores the original init.rc
adb shell #opens the phone shell
rm -r /data/app #deleting the symbolic link to /system/sd
mkdir /data/app #recreating /data/app
rm -r /data/app-private #deleting the symbolic link to /system/sd
mkdir /data/app-private #recreating /data/app-private
reboot
Instructions without adb using terminal app by LucidREM
this is a form of the instructions from this thread .. but modified slightly to be used directly from the "Terminal" .. i did not use my USB on my phone to root or run apps .. everything i did was on the G1
$su
#mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
#mkdir /system/sd
6. Download the attached modified mountd.conf and init.rc files to your SD.
#busybox cp -a /sdcard/mountd.conf /system/etc/mountd.conf
#busybox cp -a /sdcard/init.rc /system/init.rc
9. Reboot your g1
$su
#mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
#busybox df -h
You should see a line that looks similar to this:
/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd
If you don't see this line, you didn't partition your sdcard correctly. STOP! Go back and do that.
12. From the G1 shell run the following cmds to copy your app and app-private directories from the internal g1 storage to the sdcard.
#busybox cp -a /data/app /system/sd
#rm -r /data/app
#ln -s /system/sd/app /data/app
#busybox cp -a /data/app-private /system/sd
#rm -r /data/app-private
#ln -s /system/sd/app-private /data/app-private
Reboot your g1
Update 1/19/2009:
Installing non-wipe custom themes shouldn't cause any issues. I just installed the BUUF theme and I didn't have to re-do the procedure.
Update 1/20/2009:
Added undo procedure by heldc
Update 1/27/2009:
Added procedure for moving data directory to the sdcard, without performance issues.
This is not stable so I've moved it to the bottom.
13. Copy /data/data directory from internal storage to sdcard. This is OPTIONAL as some people are still reporting issues.
mkdir /system/sd/data
cp -rp /data/data /system/sd
rm -r /data/data
ln -s /system/sd/data /data/data
Reversal procedure:
rm /data/data
cp -rp /system/sd/data /data
Update 2/7/2009:
Add instructions by lucidrem that doesn't require adb. Allows you to apply the hack from the g1 using terminal app
going to try this right now..i will tell you if it works on my G1
i followed all the steps and i was able to boot into my phone without any problems. I was also able to install apps from market BUT when i instaled them my STORAGE LEFT went down from 54 to 51MB.
**I can see all the apps i installed in /system/sd/apps
please help,
thanks
Running apps off the SD card show any signs off slowness or laggyness?
Hey I would like to know what software are u using to create the partition on the sd, I tried partition magic 8 and partition mananger but the softwares can't see the sd card.
I use Paragon Partition Manager 9
vtecpower said:
i followed all the steps and i was able to boot into my phone without any problems. I was also able to install apps from market BUT when i instaled them my STORAGE LEFT went down from 54 to 51MB.
**I can see all the apps i installed in /system/sd/apps
please help,
thanks
Click to expand...
Click to collapse
Only the apk files are moved to the sdcard. The apps database files are still on the internal storage and all the cache files are still on the internal storage. Its still a good idea to manually move them over to the sdcard.
So as you install more apps, the internal storage will still shrink, but not as much as before and will go down slowly.
You can try to also move the /data/data directory over to the sdcard, that will move all the database files from the internal storage to the sdcard, but I haven't tried that. If you have a class 6 sdcard, try it and see if that slows things down.
dwang said:
Only the apk files are moved to the sdcard. The apps database files are still on the internal storage and all the cache files are still on the internal storage. Its still a good idea to manually move them over to the sdcard.
So as you install more apps, the internal storage will still shrink, but not as much as before and will go down slowly.
You can try to also move the /data/data directory over to the sdcard, that will move all the database files from the internal storage to the sdcard, but I haven't tried that. If you have a class 6 sdcard, try it and see if that slows things down.
Click to expand...
Click to collapse
I have a class 5 4gb card and i want to try to move /data/data to sd
Can you please post guide how to move /data/data to sd..
thanks
Just did this and so far, so good!
vtecpower said:
I use Paragon Partition Manager 9
Click to expand...
Click to collapse
I'm downloading the program now thanks...
Now I have to figure out how to do the partition in Ubuntu Lol
hi,
i'm a total noob to this. I've managed to pull the mountd and init files to back them up. When I get to step 5: adb mkdir /system/sd when I press enter the cmd shell gives me the adb menu. How can I tell if the dir was created?
Thanks for any help you guys can give.
1) adb shell
2) mkdir /system/sd
thanks a lot.
For the person that asked how to partition your sd card in Ubuntu you can use partition editor under system-administration- partition editor
ashshlay said:
For the person that asked how to partition your sd card in Ubuntu you can use partition editor under system-administration- partition editor
Click to expand...
Click to collapse
Thanks for the info but I just find out tha paragon partition mananger can creat ext2 partitions too
everything went right with the software it create my fat32 partition and the ext/2. what I don't know is if the ext/2 is formated and my computer with linux does not see sd card at all so right now I don't now how to confirm this.
ps. I try to look for the option SYSTEM THEN ADMITNISTRATION and it does not have the partition editor installed.
vtecpower said:
I have a class 5 4gb card and i want to try to move /data/data to sd
Can you please post guide how to move /data/data to sd..
thanks
Click to expand...
Click to collapse
Try this and see if it works... I haven't tried it myself as I only have the stock sdcard and I know its going to be too slow.
adb shell
cp -a /data/data /system/sd
rm -r /data/data
ln -s /system/sd/data /data/data
reboot
If this doesn't work or its too slow, to reverse it do the following:
adb shell
busybox cp -a /system/sd/data /data/data
If this works well, I'll modify the original post...
dwang said:
Try this and see if it works... I haven't tried it myself as I only have the stock sdcard and I know its going to be too slow.
adb shell
cp -a /data/data /system/sd
rm -r /data/data
ln -s /system/sd/data /data/data
reboot
If this doesn't work or its too slow, to reverse it do the following:
adb shell
busybox cp -a /system/sd/data /data/data
If this works well, I'll modify the original post...
Click to expand...
Click to collapse
goingto try it now..i will tell you how it turnsout
It worked but its kinda slow because as it turned out my card is Rank 4 not 5...i installed couple of apps and phone didnt crash
My Internal memory remaining is 52mb.
tahnks
vtecpower said:
It worked but its kinda slow because as it turned out my card is Rank 4 not 5...i installed couple of apps and phone didnt crash
My Internal memory remaining is 52mb.
tahnks
Click to expand...
Click to collapse
ok.. strange that your internal storage is still at 52mb though.. something else must be eating it...
do this:
adb shell
busybox df -h
cd /data
ls -l
and post the results...
# busybox df -h
busybox df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 48.4M 0 48.4M 0% /dev
tmpfs 4.0M 0 4.0M 0% /sqlite_stmt_journals
/dev/block/mtdblock3 67.5M 64.0M 3.5M 95% /system
/dev/block/loop0 1.4M 1.4M 0 100% /system/modules
/dev/block/loop1 3.1M 3.1M 0 100% /system/xbin
/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd
/dev/block/mtdblock5 74.8M 22.9M 51.9M 31% /data
/dev/block/mtdblock4 67.5M 1.6M 65.9M 2% /cache
/dev/block/mmcblk0p1 2.4G 39.8M 2.4G 2% /sdcard
# cd /data
cd /data
# ls -l
ls -l
drwxrwxrwx 1 1000 1000 2048 Jan 9 00:39 anr
lrwxrwxrwx 1 0 0 14 Jan 9 03:43 app -> /system/sd/app
lrwxrwxrwx 1 0 0 22 Jan 9 03:43 app-private -> /system/s
d/app-private
drwxrwx--x 1 1000 1000 2048 Jan 9 00:39 dalvik-cache
lrwxrwxrwx 1 0 0 15 Jan 9 04:08 data -> /system/sd/data
drwxrwx--x 1 2000 2000 2048 Jan 9 00:39 local
drwxrwx--- 1 0 0 2048 Jan 9 00:39 lost+found
drwxrwx--t 1 1000 9998 2048 Jan 9 00:39 misc
drwx------ 1 0 0 2048 Jan 9 00:39 property
drwxrwxr-x 1 1000 1000 2048 Jan 9 00:39 system
#

Sometimes impossible to mount system partition ?

How to explain that it is impossible to mount the system partition in recovery ? Should I format my sd card to correct that ?
the /system/ files do not reside in your sd card. They are stored in your phone. Are able to boot up your phone at all? If so you can mount it via a terminal app. You might also need busybox installed. At the terminal type the following
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system

HTC Sensation, Cyanogenmod 9.1, /sd-ext Encryption with Cryptsetup

Having encrypted /data, I'd been interested in encrypting the SD card, either in full, or a full partition. As a new poster to xda, posting without citing reference links does prove a bit more challenging, but here goes:
Given an HTC Sensation, rooted, with Cyanogenmod 9.1 (ICS), and Clockwork Recovery, I partitioned (thru Clockwork) the SD card into FAT32, ext, and swap. Your milage may vary on the next step, but using Fedora, I accessed the SD card, deleted the ext partition, and recreated as an encrypted partition, type ext4. (read up on cryptsetup for alternative ways to create this) For the sake of this post, we'll use the password, "ChangeMe".
I installed LUKS Manager from Google Play, which provides lm.cryptsetup, a renamed binary of Guardian Project's cryptsetup. I didn't use LUKS Manager's implementation of creating encrypted folders, instead, the whole sd-ext partition has been encrypted.
To mount the device at startup, I have the script 99sd-extLUKinit, located at /system/etc/init.d/
#!/system/bin/sh
# Not quite sure what these do, but kept them in
sync;
setprop lk.filesystem.ready 1;
# Remount the root file system to allow changes
mount -o remount,rw rootfs /
# Create the mount point and create a symbolic link
mkdir /mnt/sd-ext
ln -s /mnt/sd-ext /sd-ext
# Decrypt the SD card via cryptsetup, device resides on /dev/block/sd-ext
# Hopefully prompt user for password, but for now, echoed in
echo ChangeMe | lm.cryptsetup luksOpen /dev/block/mmcblk1p2 sd-ext
# Clean errors
e2fsck -y /dev/mapper/sd-ext
# Mount the SD Card via cryptsetup block device
mount -t ext4 -o noatime,nodiratime,barrier=1 /dev/mapper/sd-ext /mnt/sd-ext/
# Remount the root file system to prevent changes
mount -o remount,ro rootfs /
Once verified that the system will automount the encrypted ext4 /mnt/sd-ext partition:
ls /sd-ext
should return with lost & found directory
I moved /data/app and /data/app-private to the encrypted partition:
cp -a /data/app /sd-ext/app
rm -r /data/app
ln -s /sd-ext/app /data/app
cp -a /data/app-private /sd-ext/app-private
rm -r /data/app-private
ln -s /sd-ext/app-private /sd-ext/app-private

[Completed] Cyanogenmod 12 and 2nd partition in Sdcard

Any one can tell me what I make round. I have cyanogenmod with one sdcard with 2 partitions the first is mount with ext4 and the second I try fat32 ext4 ext3 ...
I no found fuse.ko in the system but internal partition and storage is mount with fuse in /storage/....
I try to mount the second partition by many difference ways . Always is mount and show up
I copy files from internal memory or sdcard first partition to the second partition
But if I try to open the files I got permission errors . Very possible is a Selinux problem but I have in permissive mode
I look with rootexplorer and files a copy in the 2nd partition in the sdcard for the owner only can read or write
Any ideas how to make the correct mounts for the 2nd Partition on SD card
I make a simple script for make test that is the last configuration I make but still only the owner can read or write that means any app can't open the files if is not root
that is the configuration I use
#!/system/bin/sh
# Mount SD Card Ext4 Script
mkdir /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/vold/179:66 /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
chown media_rw:media_rw /storage/sdcard2
chmod g+w /storage/sdcard2
ln -s /storage/sdcard2 /mnt/media_rw/sdcard2
ln -s /storage/sdcard2 /mnt/sdcard2
chown media_rw:media_rw /mnt/sdcard2
chmod g+w /mnt/sdcard2
Hi there,
I'm sorry but I can't find anything related to your question.
Please post that in the forum bellow for more answers from the experts:
> Android Development and Hacking > Android Q&A, Help & Troubleshooting
Good luck

Mount external partition using rooted Z3 with locked bootloader

Hello.
I just started messing around with my Z3 and so far followed the tutorial here https://forum.xda-developers.com/z3-compact/general/recovery-root-mm-575-lb-t3418714 to install root and recovery without unlocking the bootloader. Also took the chance to make a backup of the ta partition.
My objective was being able to mount an external ext4 partition so I could move game data and free some internal space. I believe the official kernel doesn't support init.d so I searched and found a script that worked and added it to the bottom of init.qcom.post_boot.sh.
Code:
### Init.d support ###
busybox run-parts /system/etc/init.d/
It's a very simple script that creates /sd-ext folder if it's missing and mounts /dev/block/mmcblk1p2 there
Code:
#!/system/bin/sh
#
# mounts ext partition from sd card
if [ ! -d /sd-ext ];
then
mount -o rw,remount /
install -m 774 -o 1000 -g 1000 -d /sd-ext
mount -o ro,remount /
fi
if [ ! -d /sd-ext ];
then
echo sd-ext not created >> /data/Test.log
else
mount -o rw -t ext4 /dev/block/mmcblk1p2 /sd-ext
fi
It was something that I got on some forum plus some trial and error and some Linux knowledge I have.
It seemed to work. The directory was created and mounted and I was able to move the games there using Titanium Backup.
But after I rebooted, the folder was there and all the data, but the apps don't show up on the apps list. I have to reinstall them...
Am I missing something? How can I fix this?

Categories

Resources