Post Reply

[GUIDE] Internal /data on external storage

OP emilio1625

24th May 2014, 05:48 AM   |  #1  
OP Junior Member
Flag Mexico City
Thanks Meter: 0
 
1 posts
Join Date:Joined: May 2014
More
Hello XDA community!

I'm just a noob android user, but I've used GNU/Linux for several years so I'm not so lost in this things

I'm the owner of a Galaxy Pocket Neo and this guide was tested in this smartphone, but i have checked other galaxy smartphones based on jelly bean and the directories and partitions structure of the phones are almost the same, so it should work for those

I'd like to make this guide more general so it'll be good if some of you give me some information about the partition structure and folders of your phones

Note: this is very dangerous and I'm not responsible of the data you may lost
but in fact there is almost no risk

What you need:
  • Rooted phone with busybox
  • Partition table app
  • ROM Toolbox Lite app
  • Linux knowledge ( but you can always ask for help )
  • An 8gb MicrosdHC class 6 or superior

So let me explain what we're gonna do, your device's memory is not enough for all those apps you want to install that's not good. There are a lot of apps that link your apps to the extSdCard but all of them (at least the ones that I've tried) have problems with the widgets and other limitations, so lets do it ourself.

My hipothesis: I think I can mount a partition of my sdcard on the /data folder, yeah of course I can!

Procedure

First backup everything (phone and sdcard)

Then open the Partition Table app and toggle advanced mode you should see something like this


now you should look for a partition that is mounted on /data folder and check the filesystem it has, in my phone is the mmcblk0p12 with a ext4 filesystem


next thing you need to do is to partition your sdcard with 2 partitions the first will be your extSdCard storage with a fat filesystem the other will be the new /data folder in my case with a ext4 filesystem, now, you must consider that the /data partition in your phone is both internal storage for apps, and emulated internal storage, so make sure that the second partition of your sdcard is bigger than 8gb if internal and emulated are 4gb sized, for make this worth

there is an app for making partitions on the play store but i haven't tried it

in my 32gb sdcard I made an 26gb fat partition and a 4gb ext4 partition

you should see this in Partition table


We're now half way there

now go to the Rom Toolbox app and open the scripter and make a new script

Code:
#!/system/bin/sh
mount -t ext4 /dev/block/mmcblk1p2 /storage/UsbDriveA
cp -af /data/* /storage/UsbDriveA/
cp -af /data/.* /storage/UsbDriveA/
cp -af /data/*/.* /storage/UsbDriveA/
cp -af /data/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
cp -af /data/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.* /storage/UsbDriveA/
this may take long time
you may get some errors like 'cannot stat on */*/*/*/.* directory doesn't exist' or something like that, is normal

the red coloured text may change from phone to phone, so here is where you need some linux knowledge, I think there is a better way for do the script but this one work for me, if someone can improve it, it willl be great

so, now we have an exact copy of /data and /storage/sdcard0 in our microsd so let's mount it in the /data folder

Note: before you do this turn off wifi, bluetooth, gps, and deactive the android device manager, prey or other services like that

Now run this script

Code:
#!/system/bin/sh
mount -t ext4 /dev/block/mmcblk1p2 /data && killall system_server

this will do a fast reboot on your phone, and the first time may take even 10 min to boot, don't worry your phone is not bricked, if you get tired of waiting, you can press and hold the power button and your phone will reboot as if nothing had happened

now if it finally boot, you're not going to see something different, but some apps (especially google apps) will crash, this happens a few times you only need to clear the cache, and chek that the wifi direct is working, now you can activate android devce manager, prey, etc

now go to the storage menu, do you see that?
From this


to this:


but we have not finished yet, restart your phone, now you're again on your original /data partition, go to rom toolbox and set the second script at boot (the script will have some delay so the phone will show the boot animation twice), or if you have init.d support then put the script in the /etc/init.d folder with the right permissions

restart again and you're done.

You can do some little changes in the script, like

this is more stable
Code:
#!/system/bin/sh
mount -t ext4 -o nosuid -o nodev -o noatime -o discard -o noauto_da_alloc -o journal_async_commit /dev/block/mmcblk1p2 /data && killall system_server
this is more dangerous
Code:
#!/system/bin/sh
mount -t ext4 /dev/block/mmcblk1p2 /data && mount -t ext4 /dev/mmcblk0p12 /data/media && killall system_server
or

dangerous
Code:
#!/system/bin/sh
mount -t ext4 /dev/block/mmcblk1p2 /data && mount -t ext4 /dev/mmcblk0p12 /storage/sdcard0 && killall system_server
That's all any suggestion question or anything else, just comment

Sorry for my bad english if you find some mistake or if it's not clear what i'm trying to say, please correct me so I can fix it

Si necesitas ayuda en espaņol, comenta en espaņol
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android General by ThreadRank