Related
Hi guys,
sorry because this has probably been answered somewhere but I couldn't find it ....
So here it goes: I just installed Modaco's ROM and it works perfectly. Now I would like my apps to install directly on the SD card.
What I understand is that I need to create a EXT3 partition but I don't know what the hell that means, nor how to do it.
I just put my SD card in the hero, didn't format anything ....
Dould you give a step by step guide ? On how to create that EXT3 partition, how to use A2SD afterwards ? Also, what to do with the currently installed applications ?
Thanks
Geeum
Dould you give a step by step guide ?
Click to expand...
Click to collapse
http://androidandme.com/2009/08/news/how-to-manually-partition-your-sd-card-for-android-apps2sd/
how to use A2SD afterwards?
Click to expand...
Click to collapse
Just use MoDaCo's custom ROMs. (It will do it automatically)
can app2sd work with official ROMs not rooted?
Hi guys I finally partitioned my sdcard to have an ext3 partition.
I thought A2SD was automatic but apparently applications don't go to the sdcard: my phone memory has changed after I installed an app ...
Here is what I get if I type the 'print' command on parted
Code:
(parted) print
print
print
Model: SD 00000 (sd/mmc)
Disk /dev/block/mmcblk0: 8166MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 7110MB 7110MB primary fat32 lba
2 7110MB 8134MB 1024MB primary ext3
3 8134MB 8166MB 32.3MB primary linux-swap(v1)
So I DO have ext3. Then I found this post that explains how to check if A2SD is working:
Thanks! Here is my way to check if a2sd is working:
Check if the ext3 partition exists (please see androidandme.com for details):
Code:
# mount | grep mmcblk0p2
mount | grep mmcblk0p2
/dev/block/mmcblk0p2 on /system/sd type ext3 (rw,noatime,nodiratime,errors=continue,data=ordered)
Compare available/used space on mmcblk0p2:
Code:
adb shell
# df
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 98520 0 98520 0% /dev
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock3 174080 153460 20620 88% /system
/dev/block/mtdblock5 169728 27240 142488 16% /data
/dev/block/mtdblock4 133120 1160 131960 1% /cache
/dev/block/mmcblk0p2 468331 11767 431579 3% /system/sd
Now install an app from the market (as suggested by fleming222) and again run "df". Compare the available (or used) space on /dev/block/mmcblk0p2 with the first "df".
Click to expand...
Click to collapse
This is what I get (I can see on the first line that my ext3 is not listed ... weird)
Code:
/ # mount | grep mmcblk0p2
mount | grep mmcblk0p2
/ # df
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 98508 0 98508 0% /dev
/dev/block/mtdblock4 133120 1496 131624 1% /cache
HELP !
By the way I'm running MODACO's 2.6 custom ROM ...
Geeum said:
By the way I'm running MODACO's 2.6 custom ROM ...
Click to expand...
Click to collapse
The best way to do it if your not too good with the adb commands is to install the AMON recovery image for Hero.
It has all the options to create the correct sd card partitions from the recovery mode, then just install your custom rom and everything should work.
You will need to format your sd card so you may want to create a backup of it. And I would suggest that you wipe the phone clean as well. Once you install the modaco rom it automatically moves all of your apps to the sd card.
The link for the recovery image is here:
http://forum.xda-developers.com/showthread.php?t=561124
You will also need Instant Root (http://neilandtheresa.co.uk/Android/), which you should install first, it is an .apk file so you will need a file manager for your phone. It should pop up with a notification "instant root was successfully" or along those lines. (If you have a problem installing Instant Root make sure Settings>Applications>Unknown Sources is checked)
You should then place the AMON recovery image onto the sdcard making sure it is not put into any folders (root).
Instant root then allows for root access with adb shell using the following 2 commands:
1) adb shell
then
2) su
the icon should change from a $ to #.
Now flash the recovery image with the following command:
flash_image recovery /sdcard/recovery-RA-HERO-v1.2.3.img
That should do it, remove the usb and battery and once you have replaced the battery boot into recovery mode.
I ran the following commands in this order from recvoery mode:
- Wipe data + cache (factory reset)
- Wipe ext partition on SD-card
- Wipe Dalvik-cache on SD-card (NOT on /data !) [email protected] ALWAYS WORK
- Partition SD-card : 500MB Ext2, 32MB Swap, remaining Fat32
- Convert ext2 to ext3
- Installed ROM
Hope this helps
Hi and thanks for your reply. I finally sorted my problem, I was typing the commands from the recovery console, and now my ext3 shows:
Code:
# mount | grep mmcblk0p2
mount | grep mmcblk0p2
/dev/block/mmcblk0p2 on /system/sd type ext3 (rw,noatime,nodiratime,errors=conti
nue,data=ordered)
I checked the space with df, and I can see it changing when installing apps.
However, so does the 'internal memory of the phone' in the settings panel; it keeps getting smaller as I install apps
Why is that ?
really want to do this but i find it all to hard and confusing
Geeum said:
I checked the space with df, and I can see it changing when installing apps.
However, so does the 'internal memory of the phone' in the settings panel; it keeps getting smaller as I install apps
Why is that ?
Click to expand...
Click to collapse
I think this is inevitable as the app uses some part of the phone memory for cache files etc (I am not 100% certain on this, just saw it written in an older post on the same topic).
I do not know if this is a coincidence but for some reason I have tried partitioning manually (the way your doing it) in the past and have recently used the AMON recovery image for partitioning instead. I notice that the recovery image tends to use less of the internal storage for each installed app, I don't know why but you could try it out yourself.
guys, i am using modaco's 2.6 rom. so if i just create partitions this custom rom will automatically install newly installed apps to the sd card. right?
but what if i already got many apps installed? will those be deleted while creating partitions?
is there any way so that i can backup the whole application folder and restore after creating partitions?
cheers
apparently if you do ext2 + swap + fat32, you can't do a Nandroid backup (it keeps giving errors). anyone got similar issues?
kazuni said:
apparently if you do ext2 + swap + fat32, you can't do a Nandroid backup (it keeps giving errors). anyone got similar issues?
Click to expand...
Click to collapse
is it so? if so then that wud be a disaster.
Folks are starting to look at the ST partition table and the file layout on the ST. This post is intended for other folks with power tools to think about.
My goals:
- expose the BN content (so I can read the New Yorker on my NC, mostly, but also so I can manage the library on my ST with Calibre as I do on the NC)
- understand how much room I have on the internal memory
- increase the amount of memory available for sideloading.
I got in well over my head during a conference call last week, but my ST is reborn and now able to do cool things.
However: I did not start from a factory fresh partitioning scheme, sadly. My first backup of the device went permanently offline (the disk and linux install containing it) and I was unable to return to it after I'd borked the ST pretty badly on the call. All I really was sure of was the partition order.
The tools:
- "noogie." Available and discussed at http://nookdevs.com/NookTouch_Rooting
- the rooting disk from http://forum.xda-developers.com/showthread.php?t=1132693 (currently at 1-6-24 - mad props to the folks who put that together!)
- a working Linux installation with USB support. Vmware player in Windows works just fine for this.
Note: currently, that third element is key; this is not intended as a walkthrough that tons of people could follow today, but to spark awareness of the technique - it seems possible that something very much like the DeanG scripts for redoing the NC partitions could emerge. Hint Hint.
First: the noogie disk is super cool. You boot from it and it mounts all of your ST partitions. So you can get a complete backup in linux (or Mac) by :
#dd if=/dev/sdX of=virigin.ST.img bs=1M
A true disk image backup.
You could (if you were patient) get the individual partitions as well - there is value in doing that, because within the first three partitions your serial number is stored. It's possible to restore this image to a different ST -- but then you've also transferred your serial number. whoops.
You can mount the partitions in linux and copy all the files from each of them as well.
After you have a backup, power off, insert the simple touch root disk, and power up. It will boot to a screen that reads "rooted forever" (as does Noogie) and after a pause, will continue booting as it does some setup.
You will wind up with ADB enabled over wifi by default and google apps installed.
You may also need to restart immediately -- I've found that sometimes after rooting, my s/n is all zeroes. Restarting clears that.
I also find that in order to get the Android marketplace working, I need to hunt down a copy of Vending.apk that is 2 meg (2,125,824 bytes on disk) in size and install it over the copy that touchnooter installs. I believe this one is the one that folks use for cm7?
The command to install it is:
#adb install -r Vending.apk
The -r is needed to avoid getting told the signature's bad. It's a reinstall flag.
So , once rooted, you have access to ADB and to fdisk for examining and changing disk layout.
The layout is interesting. Here's the issue: I know the order of the layout, but I screwed up my partition boundaries before I started, so the actual values here are from AFTER I finished:
(these values are from the fdisk display; they are not commands)
/dev/block/mmcblk0p1 c Win95 FAT 1-38
/dev/block/mmcblk0p2 c Win95 FAT 39-46
/dev/block/mmcblk0p3 83 Linux 47-141
/dev/block/mmcblk0p4 5 Extended 142-926
/dev/block/mmcblk0p5 83 Linux 142-285
/dev/block/mmcblk0p6 6 FAT16 406-807
/dev/block/mmcblk0p7 83 Linux 808-926
/dev/block/mmcblk0p8 83 Linux 286-405
It's partitions 5-8 that are interesting.
5 is /system, and I leave it untouched.
6 is /media - the area you can copy files to. 6 is -- on my device -- the SECOND to last PHYSICAL partition.
7 is /cache. It is the LAST physical partition.
8 is /data - and it is the 6th PHYSICAL partition.
The device restore scripts from BN don't care how big the partitions are, but they do care what ORDER they're in.
I will give my current partition table at the end - I want to avoid posting a (wrong) copy of what I thought I started with, because I screwed it up.
A stock ST writes your purchases to /data, not to /media.
It writes them to /data/media, in fact.
So, first question: what happens if you do an
#rm -r
inside /data/media, then
#cd ..
#rmdir media
then do
#ln -s media /media to so you wind up with
lrwxrwxrwx root root 2011-08-29 20:19 media -> /media
in your /data partition?
1) It works
2) restart, grab stuff from BN - and you see it from your desktop system. Your content is visible.
Win!
Ok, so the next thing is: bugger . I only have 240 M or so of room for stuff now? Eh?
shell back in and use fdisk to delete the partitions and rebuild them.
The order is key here. They are named as they're made, but you need them laid out out of physical order.
The following worked for me:
#fdisk /dev/block/mmcblk0
d6
d6
d6
Partitions 6, 7 and 8 are gone now.
Next, to create partitions of a useful size in the correct order
n
(creates p6)
406 807
n
(creates p7)
808
926
n
(creates p8)
286 405
write your changes from fdisk.
reboot.
But - now you've picked stuff and moved it around. It's a Really Good Idea to reformat the partitions before use.
The best way is probably to use the mkfs tools on the device.
Best way, schmest way. I booted to Noogie and used qtparted in linux so I had a gui to doublecheck my partition layout.
formatted these as ext3 for the Linux partitions at 7 and 8, and as fat16 for the win partition at 6.
It's entirely possible that you could format that as fat32, but it comes from the factory at fat16 so I stuck with that.
Power down, remove noogie, power up.
I got a "failed to install" followed by a reboot followed by being back in the OS.
I did not have to reroot to get my apps, but I did need to reroot to fix the marketplace - the /data partition being blown out meant that the Android market was crashing.
Now, to finish:
go back in via adb and reestablish the symlink (you just blew it out when you resized /data)
So:
shell in
#cd /data/media
#rm -r
(only inside /data/media, it WILL tear out any files it sees.) then
#cd ..
#rmdir media
then do
#ln -s media /media
And your stuff is put on the /media directory and can be managed properly.
I think this stuff may well be scriptable.
There's a great thread on the repartitioning that I found last night, making use of sfdisk rather than fdisk:
http://forum.xda-developers.com/showthread.php?t=1225196
As far as I know, swapping /data/media out to /media is new, but if it's not I apologize for being unaware of it.
So, here's the layout I finished with:
Disk /dev/block/mmcblk0: 1958 MB, 1958739968 bytes
128 heads, 32 sectors/track, 934 cylinders
Units = cylinders of 4096 * 512 = 2097152 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 38 77808 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p2 39 46 16384 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p3 47 141 194560 83 Linux
/dev/block/mmcblk0p4 142 926 1607680 5 Extended
/dev/block/mmcblk0p5 142 285 294896 83 Linux
/dev/block/mmcblk0p6 406 807 823296 6 FAT16
/dev/block/mmcblk0p7 808 926 243696 83 Linux
/dev/block/mmcblk0p8 286 405 245728 83 Linux
Partition table entries are not in disk order
Can you please format your commands in such a way that they look correctly? Current formatting in the post with your commands seem strange and incorrect.
I think all are OK except the fdisk commands.
Unfortuantely, the fdisk commands are given inside of an ascii gui of sorts, to there's really no 'great' way to represent them, I don't think.
I've prepend the others with # so it's obvious they're shell commands.
How's about symlinking various things to a 2nd partition (ext4?) on the sdcard then?
gparted?
Has anybody tried gparted to resize the partitions? If it works it could be useful.
Have any one tried doing it on windows and using which software? I'm thinking of mini tool's partition manager. But i'm not sure. Anyone?
roustabout said:
#cd /data/media
#rm -r
(only inside /data/media, it WILL tear out any files it sees.) then
#cd ..
#rmdir media
then do
#ln -s media /media
And your stuff is put on the /media directory and can be managed properly.
Click to expand...
Click to collapse
Thanks a lot for this, but the second and last lines are wrong:
rm -r should be rm -r *
ln -s media /media should be ln -s /media media
Still, thanks for the idea!
I wonder if symlinking to the sdcard could fix the whole 'shelves don't work for sideloaded books on sdcards' problem.
I formatted my internal storage drive on my htc droid incredible to ntfs (comes with 8gb internal flash and 2gb external microsd)
I did this with windows However when you un-mount you will not be able to get back into it in windows or your android os afterwards leaving you with minimal storage space left on your internal flash. Now I only have roughly 600mb internal and somewhere a huge partition formatted to ntfs that cannot be assessed by windows or android. DOH! I've spend a few hours trying to find answers so I'm posting for help!
Also I am running Jellybean 4.1.1 RC2 (rooted)
I tried to mount and format with CWM and did not work (no app2sd partition)
There has got to be a way to use adb to reformat the ntfs space back to fat32 It seems way to easy to mess a phone up just by formating a storage space with windows.. Really need help here !
Go to CWM, mounts and storage and select format emmc. Do you get any errors there? It should make it fat32 again or at least fat which should be picked up by windows.
tiny4579 said:
Go to CWM, mounts and storage and select format emmc. Do you get any errors there? It should make it fat32 again or at least fat which should be picked up by windows.
Click to expand...
Click to collapse
CWM version is 5.0.2.0
Messages:
Formatting /emmc...
Error mounting /emmc!
Thanks for a reply btw!
blown4x4 said:
CWM version is 5.0.2.0
Messages:
Formatting /emmc...
Error mounting /emmc!
Thanks for a reply btw!
Click to expand...
Click to collapse
You're welcome. Have you tried formatting internal storage in the ROM itself?
If that doesn't work can you run from adb shell in the ROM or recovery? Try ROM as I think it will more likely work.
Code:
umount /storage/sdcard1
mkfs.vfat /dev/block/vold/179:3
If umount fails with not mounted that's good. Any other error let me know. The mkfs.vfat command should hopefully succeed. I don't want to try as I don't want to wipe emmc but that's the internal device name of the internal storage.
tiny4579 said:
You're welcome. Have you tried formatting internal storage in the ROM itself?
If that doesn't work can you run from adb shell in the ROM or recovery? Try ROM as I think it will more likely work.
Code:
umount /storage/sdcard1
mkfs.vfat /dev/block/vold/179:3
If umount fails with not mounted that's good. Any other error let me know. The mkfs.vfat command should hopefully succeed. I don't want to try as I don't want to wipe emmc but that's the internal device name of the internal storage.
Click to expand...
Click to collapse
on the umount /storage/sdcard1 command in adb shell i get an error stating that there was an invalid argument
blown4x4 said:
on the umount /storage/sdcard1 command in adb shell i get an error stating that there was an invalid argument
Click to expand...
Click to collapse
emmc shouldn't be mounted then. If you've confirmed that emmc (internal storage - 8gb) is ntfs then run the second command.
tiny4579 said:
You're welcome. Have you tried formatting internal storage in the ROM itself?
If that doesn't work can you run from adb shell in the ROM or recovery? Try ROM as I think it will more likely work.
Code:
umount /storage/sdcard1
mkfs.vfat /dev/block/vold/179:3
If umount fails with not mounted that's good. Any other error let me know. The mkfs.vfat command should hopefully succeed. I don't want to try as I don't want to wipe emmc but that's the internal device name of the internal storage.
Click to expand...
Click to collapse
Shouldnt it be:
Code:
umount /mnt/emmc
mkfs.vfat /dev/block/vold/179:3
Then to remount:
Code:
mount -t vfat /dev/block/vold/179:3 /mnt/emmc
umoumt /storage/sdcard1 just says failed if i try to run it.
blown4x4 said:
on the umount /storage/sdcard1 command in adb shell i get an error stating that there was an invalid argument
Click to expand...
Click to collapse
Tiny, I also tried the second part of the commands and got this " mkfs.vfat lseek: value too large for defined data type "
Actually, cmlusco my umount /storage/sdcard1 worked fine as root for me. But umount /mnt/emmc should work across all ROMs.
blown4x4 said:
Tiny, I also tried the second part of the commands and got this " mkfs.vfat lseek: value too large for defined data type "
Click to expand...
Click to collapse
Couldent you just try an ruu
Sent from my Droid Incredible using xda app-developers app
Thanks for the reply guys!
I get an invalid argument when trying to unmount emmc
blown4x4 said:
Tiny, I also tried the second part of the commands and got this " mkfs.vfat lseek: value too large for defined data type "
Click to expand...
Click to collapse
Does this work:
Code:
su
mkfs.vfat /dev/block/mmcblk0p3
If not check post #17 in this thread, replacing mmcblk0p14 with mmcblk0p3:
http://forum.xda-developers.com/showthread.php?t=1647806&page=2
---------- Post added at 07:36 PM ---------- Previous post was at 07:35 PM ----------
zachf714 said:
Couldent you just try an ruu
Sent from my Droid Incredible using xda app-developers app
Click to expand...
Click to collapse
It's a bit extreme for an improperly formatted partition.
I got the same result
" value too large for defined data type" Bolth methods
Again thank you for all your help guys!
This might be helpful?
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\User>cd miniadb_inc
The system cannot find the path specified.
C:\Users\User>cd C:
C:\Users\User
C:\Users\User>cd C:/
C:\>cd miniadb_inc
C:\miniadb_inc>umount /mnt/emmc
'umount' is not recognized as an internal or external command,
operable program or batch file.
C:\miniadb_inc>adb shell
[email protected]:/ # umount /mnt/emmc
umount /mnt/emmc
umount: can't umount /mnt/emmc: Invalid argument
1|[email protected]:/ # mount -t vfat /dev/block/vold/179:3 /mnt/emmc
mount -t vfat /dev/block/vold/179:3 /mnt/emmc
mount: mounting /dev/block/vold/179:3 on /mnt/emmc failed: Invalid argument
255|[email protected]:/ # su
su
[email protected]:/ # mkfs.vfat /dev/block/mmcblk0p3
mkfs.vfat /dev/block/mmcblk0p3
mkfs.vfat: lseek: Value too large for defined data type
1|[email protected]:/ # #cat /proc/partitions
#cat /proc/partitions
1|[email protected]:/ # cat /proc/partitions
cat /proc/partitions
major minor #blocks name
31 0 640 mtdblock0
31 1 4608 mtdblock1
31 2 3072 mtdblock2
31 3 253952 mtdblock3
31 4 640 mtdblock4
31 5 40960 mtdblock5
31 6 152576 mtdblock6
179 0 7757824 mmcblk0
179 1 778240 mmcblk0p1
179 2 204800 mmcblk0p2
179 3 6774776 mmcblk0p3
179 8 1931264 mmcblk1
179 9 1930240 mmcblk1p1
[email protected]:/ #
Try this:
/system/bin/busybox mkfs.vfat /dev/block/vold/179:3
Or
/system/xbin/busybox mkfs.vfat /dev/block/vold/179:3
Depending on where busybox is installed.
Thank you for the suggestion cmlusco! However I still get value too large for defined data type
Ok try
mkfs.vfat -F 32 /dev/block/vold/179:3
Or try formating it to something else first like ext2:
mkfs.ext2 /dev/block/vold/179:3
Try the post I linked, check post 17. Itt has a different busybox and you can push it to /data/local/tmp and run busybox according to the instructions there just replace /dev/block/mmcblk0p14 with /dev/block/mmcblk0p3. It may not work with your busybox version in the the ROM.
tiny4579 said:
Try the post I linked, check post 17. Itt has a different busybox and you can push it to /data/local/tmp and run busybox according to the instructions there just replace /dev/block/mmcblk0p14 with /dev/block/mmcblk0p3. It may not work with your busybox version in the the ROM.
Click to expand...
Click to collapse
Was just reading on google about newer busyboxes having lseek issues, so that will probably solve your issue. However i cant download the linked busybox.zip file from that thread. From the xda app it says failed to connect, and from the website it just sits there trying to load forever. Any idea what version of busybox will work, cant find that info anywhere.
cmlusco said:
Was just reading on google about newer busyboxes having lseek issues, so that will probably solve your issue. However i cant download the linked busybox.zip file from that thread. From the xda app it says failed to connect, and from the website it just sits there trying to load forever. Any idea what version of busybox will work, cant find that info anywhere.
Click to expand...
Click to collapse
I don't know the answer to that one. OP, try busybox 1.18.2 or 1.18.4. You can use stericson's busybox app to easily install an older busybox version but the free version is annoying with extra boxes that pop up. However once you install one that works you can uninstall the app. If you install busybox from there (wait for smart install to be ready but you can do normal), then you need to try the commands from the phone.
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
The SD card was removed while the device was running.
The device is running CM 7.2 and the SD card was partitioned to extend the internal memory.
Now, everything is out of whack.
The call log is gone, the texts are gone, I have no contacts, I have no favorites.
The widgets are gone, the home screen icons are gone.
Actually it'd be better to say what's still there: The apps themselves and some file content (pictures, videos, downloads) are there.
How do I rectify this and safe my data. I wouldn't mind migrating it to a new device as I have a new device.
Please advice if you can
what method did you use to partition your card ? some leave user data on internal memory some move that too on to external. i don't know if there's any PC software that can see your 2nd partition if you put your SDcard into a card reader on a PC for backing up.
3mel said:
what method did you use to partition your card ? some leave user data on internal memory some move that too on to external.
Click to expand...
Click to collapse
I don't know for sure but I think it was Data2SD from the package Data2sdV2withA2sdremover_by_jikantaru.zip
It is a 2 GB SD card and the phone shows an internal storage of 473 MB and 1,39 GB on the SD card.
3mel said:
i don't know if there's any PC software that can see your 2nd partition if you put your SDcard into a card reader on a PC for backing up.
Click to expand...
Click to collapse
I inserted it in a Ubuntu computer and got some output.
This is the relevant output from Ubuntu
Code:
[email protected]:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p1 1.4G 1.4G 21M 99% /media/ubuntu/F031-5199
/dev/mmcblk0p2 465M 393M 73M 85% /media/ubuntu/userdata
Code:
[email protected]:~$ sudo fdisk -l
Disk /dev/mmcblk0: 1.9 GiB, 2002780160 bytes, 3911680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ccb88
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 1 2912109 2912109 1.4G c W95 FAT32 (LBA)
/dev/mmcblk0p2 2912256 3911679 999424 488M 83 Linux
Code:
[email protected]:~$ sudo ls /media/ubuntu/F031-5199
AI Factory Stats LOST.DIR Safety Guide
Android media ScanToPDF_Free
aScreenshot miniclipId.txt SmsContactsBackup
busybox-stericson My Documents svox
clockworkmod My files System Volume Information
data Notifications TitaniumBackup
data2whateverlog.txt Pictures tmp
DCIM Quick Start Guide toolbox-stericson
download reboot-stericson User Manual
ezPDFReader Ringtones
kindle rosie_scroll
[email protected]:~$ sudo tail /media/ubuntu/F031-5199/data
Code:
[email protected]:~$ sudo lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
mmcblk0
├─mmcblk0p1 vfat F031-5199 /media/ubu
└─mmcblk0p2 ext3 userdata 6f6684d8-78c2-40b6-ae72-d9b089f623a1
Both partitions are still there and accessible. I did run fsck but it did not help with the lost thing (texts, etc.)
somebody else had trouble with that method a cm10.1 thread. I would have said try flashing it again but I don't know that method...